Skip to content

Commit 3863f89

Browse files
committed
add comparison page
1 parent fe0cabe commit 3863f89

File tree

6 files changed

+63
-4
lines changed

6 files changed

+63
-4
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@types/react-dom": "^18.0.11",
2727
"@types/react-helmet": "^6.1.5",
2828
"@types/react-outside-click-handler": "^1.3.1",
29+
"@types/react-router-dom": "5.3.0",
2930
"copy-webpack-plugin": "^11.0.0",
3031
"esbuild-loader": "^3.0.1",
3132
"expose-loader": "^4.1.0",
@@ -60,6 +61,7 @@
6061
"react-notifications-component": "~3.1.0",
6162
"react-outside-click-handler": "^1.3.0",
6263
"react-redux": "^7.2.1",
64+
"react-router-dom": "5.3.0",
6365
"react-textarea-autosize": "8.3.0"
6466
}
6567
}

public/app/app.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,27 @@ import store, { persistor } from './redux/store';
66
import '@webapp/../sass/profile.scss';
77
import '@szhsin/react-menu/dist/index.css';
88
import Notifications from '@webapp/ui/Notifications';
9+
import { Router, Switch, Route } from 'react-router-dom';
10+
import history from '@webapp/util/history';
911

1012
import { SingleView } from './pages/SingleView';
13+
import { ComparisonView } from './pages/ComparisonView';
1114

1215
const container = document.getElementById('reactRoot') as HTMLElement;
1316
const root = ReactDOM.createRoot(container);
1417

1518
root.render(
1619
<Provider store={store}>
1720
<Notifications />
18-
19-
<SingleView />
21+
<Router history={history}>
22+
<Switch>
23+
<Route exact path={'/'}>
24+
<SingleView />
25+
</Route>
26+
<Route path={'/comparison'}>
27+
<ComparisonView />
28+
</Route>
29+
</Switch>
30+
</Router>
2031
</Provider>
2132
);

public/app/overrides/components/TimelineChart/TimelineChartWrapper.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,17 @@ interface TimelineChartWrapperProps {
2929
export default function (props: TimelineChartWrapperProps) {
3030
const ref = useRef<HTMLDivElement>(null);
3131

32-
// Since this element is inside a <Box>, also make the box hidden
32+
// Horrible hack to hide the parent <Box>
33+
// This won't be necessary after Timelines are implemented properly
3334
useEffect(() => {
3435
const parentElement = ref.current?.parentElement?.parentElement;
35-
if (parentElement) {
36+
37+
// When timelines are within a pyro-flamegraph (eg in comparison page, don't do anything)
38+
if (
39+
parentElement?.parentElement?.tagName.toLowerCase() !==
40+
'pyro-flamegraph' &&
41+
parentElement
42+
) {
3643
parentElement.style.display = 'none';
3744
}
3845
}, [ref.current]);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import ContinuousComparisonView from '@webapp/pages/ContinuousComparisonView';
2+
import { loadAppNames } from '../hooks/loadAppNames';
3+
4+
export function ComparisonView() {
5+
loadAppNames();
6+
7+
return <ContinuousComparisonView />;
8+
}

public/app/redux/store.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,41 @@ ReduxQuerySync({
7474
selector: (state: RootState) => state.continuous.until,
7575
action: continuousActions.setUntil,
7676
},
77+
leftFrom: {
78+
defaultValue: 'now-1h',
79+
selector: (state: RootState) => state.continuous.leftFrom,
80+
action: continuousActions.setLeftFrom,
81+
},
82+
leftUntil: {
83+
defaultValue: 'now-30m',
84+
selector: (state: RootState) => state.continuous.leftUntil,
85+
action: continuousActions.setLeftUntil,
86+
},
87+
rightFrom: {
88+
defaultValue: 'now-30m',
89+
selector: (state: RootState) => state.continuous.rightFrom,
90+
action: continuousActions.setRightFrom,
91+
},
92+
rightUntil: {
93+
defaultValue: 'now',
94+
selector: (state: RootState) => state.continuous.rightUntil,
95+
action: continuousActions.setRightUntil,
96+
},
7797
query: {
7898
defaultvalue: '',
7999
selector: (state: RootState) => state.continuous.query,
80100
action: continuousActions.setQuery,
81101
},
102+
rightQuery: {
103+
defaultvalue: '',
104+
selector: (state: RootState) => state.continuous.rightQuery,
105+
action: continuousActions.setRightQuery,
106+
},
107+
leftQuery: {
108+
defaultvalue: '',
109+
selector: (state: RootState) => state.continuous.leftQuery,
110+
action: continuousActions.setLeftQuery,
111+
},
82112
maxNodes: {
83113
defaultValue: '0',
84114
selector: (state: RootState) => state.continuous.maxNodes,

scripts/webpack/webpack.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = merge(common, {
66
mode: 'development',
77
devServer: {
88
port: 4040,
9+
historyApiFallback: true,
910
proxy: {
1011
'/pyroscope': 'http://localhost:4100',
1112
},

0 commit comments

Comments
 (0)