Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"tsc-lint": "tsc --build",
"tsc-lint-debug": "tsc --listFiles",
"start": "cd packages/jaeger-ui && npm run start",
"start:with-data": "cd packages/jaeger-ui && npm run start:with-data",
"update-snapshots": "cd packages/jaeger-ui && npm test -- -u"
},
"prettier": {
Expand Down
1 change: 1 addition & 0 deletions packages/jaeger-ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
__REACT_APP_GA_DEBUG__: false,
__REACT_APP_VSN_STATE__: false,
__APP_ENVIRONMENT__: false,
__REACT_APP_USE_SAMPLE_DATA__: false,
},
overrides: [
{
Expand Down
1 change: 1 addition & 0 deletions packages/jaeger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"coverage": "npm run test-ci -- --coverage",
"start:ga-debug": "REACT_APP_GA_DEBUG=1 REACT_APP_VSN_STATE=$(../../scripts/get-tracking-version.js) vite",
"start": "vite",
"start:with-data": "REACT_APP_USE_SAMPLE_DATA=true vite",
"test": "jest --maxWorkers=50%",
"test-ci": "CI=1 jest --silent --color --maxWorkers=4"
},
Expand Down
23 changes: 22 additions & 1 deletion packages/jaeger-ui/src/components/DependencyGraph/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import './index.css';
import withRouteProps from '../../utils/withRouteProps';
import { shouldUseSampleDAGData } from '../../utils/constants';

// export for tests
export const GRAPH_TYPES = {
Expand All @@ -38,6 +39,16 @@

const dagMaxNumServices = getConfigValue('dependencies.dagMaxNumServices') || FALLBACK_DAG_MAX_NUM_SERVICES;

let sampleDAGDataset = [];
export async function loadSampleData() {
if (shouldUseSampleDAGData() === 'true') {
const module = await import('./sample_dag_dataset.json');
sampleDAGDataset = module.default;
return sampleDAGDataset;

Check warning on line 47 in packages/jaeger-ui/src/components/DependencyGraph/index.jsx

View check run for this annotation

Codecov / codecov/patch

packages/jaeger-ui/src/components/DependencyGraph/index.jsx#L45-L47

Added lines #L45 - L47 were not covered by tests
}
return [];
}

// export for tests
export class DependencyGraphPageImpl extends Component {
static propTypes = {
Expand Down Expand Up @@ -73,6 +84,10 @@

componentDidMount() {
this.props.fetchDependencies();
loadSampleData().then(data => {
const selectedLayout = data.length > dagMaxNumServices ? 'sfdp' : 'dot';
this.setState({ selectedLayout });
});
}

handleServiceSelect = service => {
Expand Down Expand Up @@ -212,7 +227,13 @@
links = formatted.links;
nodes = formatted.nodes;
}
return { loading, error, nodes, links, dependencies };
return {
loading,
error,
nodes,
links,
dependencies: shouldUseSampleDAGData() === 'true' ? sampleDAGDataset : dependencies,
};
}

// export for tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
import React from 'react';
import { shallow } from 'enzyme';

import {
DependencyGraphPageImpl as DependencyGraph,
GRAPH_TYPES,
mapDispatchToProps,
mapStateToProps,
} from './index';
import { DependencyGraphPageImpl as DependencyGraph, mapDispatchToProps, mapStateToProps } from './index';
import LoadingIndicator from '../common/LoadingIndicator';

const childId = 'boomya';
Expand Down
Loading
Loading