Skip to content

Commit

Permalink
Upgrade to react-router-dom v5.2.0 (jaegertracing#727)
Browse files Browse the repository at this point in the history
* feat: upgrade to react-router-dom v5.2.0

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>

* fix: lint

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>

* fix

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>

* update snapshots to accomodate latest changes

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>

* fix

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>

* fix: object only has getter

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>

* fix: tests

Signed-off-by: Meenal Trivedi <meenaltrivedi6102@gmail.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
  • Loading branch information
meenal06 authored and vvvprabhakar committed Jul 4, 2021
1 parent e97bf81 commit 3669eb9
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/jaeger-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"react-icons": "2.2.7",
"react-metrics": "^2.3.2",
"react-redux": "^5.0.6",
"react-router-dom": "^4.3.1",
"react-router-dom": "^5.2.0",
"react-router-redux": "5.0.0-alpha.6",
"react-virtualized-select": "^3.1.0",
"react-vis": "^1.7.2",
Expand Down
7 changes: 3 additions & 4 deletions packages/jaeger-ui/src/components/App/TopNav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@ describe('<TopNav>', () => {

describe('renders the default menu options', () => {
it('renders the "JAEGER UI" link', () => {
const items = wrapper.find(Link).findWhere(link => /JAEGER UI/.test(link.text()));
const items = wrapper.find(Link).findWhere(link => link.prop('to') === '/');
expect(items.length).toBe(1);
});

it('renders the "Search" button', () => {
const items = wrapper.find(Link).findWhere(link => /Search/.test(link.text()));
const items = wrapper.find(Link).findWhere(link => link.prop('to') === '/search');
expect(items.length).toBe(1);
});

it('renders the "System Architecture" button', () => {
const items = wrapper.find(Link).findWhere(link => /System Architecture/.test(link.text()));
const items = wrapper.find(Link).findWhere(link => link.prop('to') === '/dependencies');
expect(items.length).toBe(1);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,16 @@ exports[`JaegerUIApp does not explode 1`] = `
<Redirect
exact={true}
path="/"
push={false}
to="/search"
/>
<Redirect
exact={true}
path=""
push={false}
to="/search"
/>
<Redirect
exact={true}
path="/"
push={false}
to="/search"
/>
<Route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import * as reactRouterDom from 'react-router-dom';

import { ROUTE_PATH, matches, getUrl, getUrlState, sanitizeUrlState } from './url';

jest.mock('react-router-dom', () => ({
matchPath: jest.fn(),
}));

describe('DeepDependencyGraph/url', () => {
describe('matches', () => {
const path = 'path argument';
Expand Down
4 changes: 4 additions & 0 deletions packages/jaeger-ui/src/components/QualityMetrics/url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import * as reactRouterDom from 'react-router-dom';

import { ROUTE_PATH, matches, getUrl, getUrlState } from './url';

jest.mock('react-router-dom', () => ({
matchPath: jest.fn(),
}));

describe('TraceDiff/url', () => {
const lookback = 42;
const service = 'test-service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ exports[`DiffSelection renders multiple traces as expected 1`] = `
className="DiffSelection--message"
>
<Link
replace={false}
to="/trace/trace-id-0...trace-id-1?cohort=trace-id-0&cohort=trace-id-1"
>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ exports[`ResultItemTitle renders as expected 1`] = `
/>
<Link
className="ResultItemTitle--item ub-flex-auto"
replace={false}
to="linkToValue"
>
<span
Expand Down
4 changes: 4 additions & 0 deletions packages/jaeger-ui/src/components/SearchTracePage/url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import * as reactRouterDom from 'react-router-dom';
import { MAX_LENGTH } from '../DeepDependencies/Graph/DdgNodeContent/constants';
import { ROUTE_PATH, getUrl, getUrlState, isSameQuery, matches } from './url';

jest.mock('react-router-dom', () => ({
matchPath: jest.fn(),
}));

describe('SearchTracePage/url', () => {
const span0 = 'span-0';
const span1 = 'span-1';
Expand Down
4 changes: 4 additions & 0 deletions packages/jaeger-ui/src/components/TraceDiff/url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import * as reactRouterDom from 'react-router-dom';

import { ROUTE_PATH, matches, getUrl } from './url';

jest.mock('react-router-dom', () => ({
matchPath: jest.fn(),
}));

describe('TraceDiff/url', () => {
describe('matches', () => {
const path = 'path argument';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,24 @@ exports[`AltViewOptions renders correctly 1`] = `
</a>
</MenuItem>
<MenuItem>
<Link
<ForwardRef
onClick={[MockFunction]}
rel="noopener noreferrer"
replace={false}
target="_blank"
to="/api/traces/test trace ID?prettyPrint=true"
>
Trace JSON
</Link>
</ForwardRef>
</MenuItem>
<MenuItem>
<Link
<ForwardRef
onClick={[MockFunction]}
rel="noopener noreferrer"
replace={false}
target="_blank"
to="/api/traces/test trace ID?raw=true&prettyPrint=true"
>
Trace JSON (unadjusted)
</Link>
</ForwardRef>
</MenuItem>
</Menu>
}
Expand Down
15 changes: 13 additions & 2 deletions packages/jaeger-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import './site-prefix';

import React from 'react';
import { BrowserRouter } from 'react-router-dom';
import ReactDOM from 'react-dom';
import { document } from 'global';

Expand All @@ -37,8 +38,18 @@ const UI_ROOT_ID = 'jaeger-ui-root';

if (trackingContext) {
trackingContext.context(() => {
ReactDOM.render(<JaegerUIApp />, document.getElementById(UI_ROOT_ID));
ReactDOM.render(
<BrowserRouter>
<JaegerUIApp />
</BrowserRouter>,
document.getElementById(UI_ROOT_ID)
);
});
} else {
ReactDOM.render(<JaegerUIApp />, document.getElementById(UI_ROOT_ID));
ReactDOM.render(
<BrowserRouter>
<JaegerUIApp />
</BrowserRouter>,
document.getElementById(UI_ROOT_ID)
);
}

0 comments on commit 3669eb9

Please sign in to comment.