Skip to content

Commit

Permalink
HPCC-31354 ECL Watch v9 display ECL for failed WUs
Browse files Browse the repository at this point in the history
For failed WUs, /WsWorkunits/WUFile wouldn't return a usable result, so
on the ECL tab of the WU Details page fetch the ECL text via WUInfo

Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed Mar 15, 2024
1 parent a39d899 commit ad83e18
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions esp/src/src-react/components/ECLArchive.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from "react";
import { CommandBar, ContextualMenuItemType, ICommandBarItemProps } from "@fluentui/react";
import { WUDetails, IScope } from "@hpcc-js/comms";
import { Workunit, WUDetails, IScope } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
import { useWorkunitArchive } from "../hooks/workunit";
import { useWorkunitMetrics } from "../hooks/metrics";
Expand All @@ -12,6 +13,8 @@ import { ECLArchiveTree } from "./ECLArchiveTree";
import { ECLArchiveEditor } from "./ECLArchiveEditor";
import { MetricsPropertiesTables } from "./MetricsPropertiesTables";

const logger = scopedLogger("src-react/components/ECLArchive.tsx");

const scopeFilterDefault: WUDetails.RequestNS.ScopeFilter = {
MaxDepth: 999999,
ScopeTypes: ["graph"]
Expand Down Expand Up @@ -54,8 +57,15 @@ export const ECLArchive: React.FunctionComponent<ECLArchiveProps> = ({
setSelectionText(archive?.content(selection) ?? "");
setMarkers(archive?.markers(selection) ?? []);
setSelectedMetrics(archive?.metrics(selection) ?? []);
} else {
if (archive && !archive.build) {
const wu = Workunit.attach({ baseUrl: "" }, wuid);
wu.fetchQuery().then(function (query) {
setSelectionText(query?.Text ?? "");
}).catch(err => logger.error(err));
}
}
}, [archive, metrics.length, selection]);
}, [archive, metrics.length, selection, wuid]);

const setSelectedItem = React.useCallback((selId: string) => {
pushUrl(`${parentUrl}/${selId}`);
Expand Down

0 comments on commit ad83e18

Please sign in to comment.