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 Jun 23, 2021
1 parent c3ba9f8 commit 9022f7f
Show file tree
Hide file tree
Showing 12 changed files with 116 additions and 27 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)
);
}
88 changes: 79 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,13 @@
dependencies:
regenerator-runtime "^0.12.0"

"@babel/runtime@^7.12.1":
version "7.13.10"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d"
integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/template@^7.1.0", "@babel/template@^7.1.2", "@babel/template@^7.2.2":
version "7.2.2"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.2.2.tgz#005b3fdf0ed96e88041330379e0da9a708eb2907"
Expand Down Expand Up @@ -6201,6 +6208,18 @@ history@^4.5.1, history@^4.6.3, history@^4.7.2:
value-equal "^0.4.0"
warning "^3.0.0"

history@^4.9.0:
version "4.10.1"
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
dependencies:
"@babel/runtime" "^7.1.2"
loose-envify "^1.2.0"
resolve-pathname "^3.0.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
value-equal "^1.0.1"

hmac-drbg@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
Expand Down Expand Up @@ -8369,6 +8388,14 @@ min-document@^2.19.0:
dependencies:
dom-walk "^0.1.0"

mini-create-react-context@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
integrity sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==
dependencies:
"@babel/runtime" "^7.12.1"
tiny-warning "^1.0.3"

mini-css-extract-plugin@0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.3.tgz#98d60fcc5d228c3e36a9bd15a1d6816d6580beb8"
Expand Down Expand Up @@ -10873,16 +10900,18 @@ react-redux@^5.0.6:
react-is "^16.6.0"
react-lifecycles-compat "^3.0.0"

react-router-dom@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.3.1.tgz#4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6"
react-router-dom@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662"
integrity sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==
dependencies:
history "^4.7.2"
invariant "^2.2.4"
"@babel/runtime" "^7.1.2"
history "^4.9.0"
loose-envify "^1.3.1"
prop-types "^15.6.1"
react-router "^4.3.1"
warning "^4.0.1"
prop-types "^15.6.2"
react-router "5.2.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

react-router-redux@5.0.0-alpha.6:
version "5.0.0-alpha.6"
Expand All @@ -10892,7 +10921,23 @@ react-router-redux@5.0.0-alpha.6:
prop-types "^15.5.4"
react-router "^4.1.1"

react-router@^4.1.1, react-router@^4.3.1:
react-router@5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.0.tgz#424e75641ca8747fbf76e5ecca69781aa37ea293"
integrity sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==
dependencies:
"@babel/runtime" "^7.1.2"
history "^4.9.0"
hoist-non-react-statics "^3.1.0"
loose-envify "^1.3.1"
mini-create-react-context "^0.4.0"
path-to-regexp "^1.7.0"
prop-types "^15.6.2"
react-is "^16.6.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

react-router@^4.1.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e"
dependencies:
Expand Down Expand Up @@ -11307,6 +11352,11 @@ regenerator-runtime@^0.12.0:
version "0.12.1"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de"

regenerator-runtime@^0.13.4:
version "0.13.7"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==

regenerator-transform@^0.13.4:
version "0.13.4"
resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.13.4.tgz#18f6763cf1382c69c36df76c6ce122cc694284fb"
Expand Down Expand Up @@ -11511,6 +11561,11 @@ resolve-pathname@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879"

resolve-pathname@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==

resolve-url@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
Expand Down Expand Up @@ -12597,6 +12652,16 @@ timsort@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"

tiny-invariant@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==

tiny-warning@^1.0.0, tiny-warning@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==

tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
Expand Down Expand Up @@ -13005,6 +13070,11 @@ value-equal@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7"

value-equal@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==

vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
Expand Down

0 comments on commit 9022f7f

Please sign in to comment.