Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-32210 WU Next/Previous + Metrics shows incorrect graph #18855

Merged
Show file tree
Hide file tree
Changes from all commits
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
49 changes: 32 additions & 17 deletions esp/src/src-react/components/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,20 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
// Timeline ---
const timeline = useConst(() => new WUTimelineNoFetch()
.maxZoom(Number.MAX_SAFE_INTEGER)
.on("click", (row, col, sel) => {
setTimelineFilter(sel ? row[7].__hpcc_id : "");
if (sel) {
setSelectedMetricsSource("scopesTable");
pushUrl(`${parentUrl}/${row[7].Id}`);
}
})
);

React.useEffect(() => {
timeline
.on("click", (row, col, sel) => {
setTimelineFilter(sel ? row[7].__hpcc_id : "");
if (sel) {
setSelectedMetricsSource("scopesTable");
pushUrl(`${parentUrl}/${row[7].Id}`);
}
}, true)
;
}, [parentUrl, timeline]);

React.useEffect(() => {
timeline
.scopes(metrics)
Expand All @@ -233,13 +238,18 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
.multiSelect(true)
.metrics([], options, timelineFilter, scopeFilter)
.sortable(true)
.on("click", debounce((row, col, sel) => {
if (sel) {
scopesSelectionChanged("scopesTable", scopesTable.selection());
}
}, 100))
);

React.useEffect(() => {
scopesTable
.on("click", debounce((row, col, sel) => {
if (sel) {
scopesSelectionChanged("scopesTable", scopesTable.selection());
}
}), true)
;
}, [scopesSelectionChanged, scopesTable]);

React.useEffect(() => {
scopesTable
.metrics(metrics, options, timelineFilter, scopeFilter)
Expand All @@ -265,13 +275,18 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
const metricGraphWidget = useConst(() => new MetricGraphWidget()
.zoomToFitLimit(1)
.selectionGlowColor("DodgerBlue")
.on("selectionChanged", () => {
const selection = metricGraphWidget.selection().filter(id => metricGraph.item(id)).map(id => metricGraph.item(id).id);
setSelectedMetricsSource("metricGraphWidget");
pushUrl(`${parentUrl}/${selection.join(",")}`);
})
);

React.useEffect(() => {
metricGraphWidget
.on("selectionChanged", () => {
const selection = metricGraphWidget.selection().filter(id => metricGraph.item(id)).map(id => metricGraph.item(id).id);
setSelectedMetricsSource("metricGraphWidget");
pushUrl(`${parentUrl}/${selection.join(",")}`);
}, true)
;
}, [metricGraph, metricGraphWidget, parentUrl]);

React.useEffect(() => {
metricGraph.load(metrics);
}, [metrics, metricGraph]);
Expand Down
15 changes: 10 additions & 5 deletions esp/src/src-react/components/MetricsSQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ export const MetricsSQL: React.FunctionComponent<MetricsDataProps> = ({
.multiSelect(true)
.sortable(true)
.noDataMessage(nlsHPCC.loadingMessage)
.on("click", debounce((row, col, sel) => {
if (sel) {
onSelectionChanged(scopesTable.selection());
}
}, 100))
);

React.useEffect(() => {
scopesTable
.on("click", debounce((row, col, sel) => {
if (sel) {
onSelectionChanged(scopesTable.selection());
}
}, 100), true)
;
}, [onSelectionChanged, scopesTable]);

React.useEffect(() => {
if (columns.length === 0 && data.length === 0 && sqlError) {
scopesTable
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/WorkunitDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
<Shimmer />
</>
}>
<Metrics wuid={wuid} selection={state?.metrics} />
<Metrics wuid={wuid} parentUrl={`${parentUrl}/${wuid}/metrics`} selection={state?.metrics} />
</React.Suspense>
</DelayLoadedPanel>
<DelayLoadedPanel visible={tab === "workflows"} size={size}>
Expand Down
Loading