diff --git a/esp/src/src-react/components/ECLArchive.tsx b/esp/src/src-react/components/ECLArchive.tsx index 92e230cfd67..ca4ee1de6ae 100644 --- a/esp/src/src-react/components/ECLArchive.tsx +++ b/esp/src/src-react/components/ECLArchive.tsx @@ -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"; @@ -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"] @@ -54,8 +57,15 @@ export const ECLArchive: React.FunctionComponent = ({ 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}`); diff --git a/esp/src/src-react/components/forms/Fields.tsx b/esp/src/src-react/components/forms/Fields.tsx index 16bdf49b754..9321582024d 100644 --- a/esp/src/src-react/components/forms/Fields.tsx +++ b/esp/src/src-react/components/forms/Fields.tsx @@ -136,8 +136,8 @@ const AsyncDropdown: React.FunctionComponent = ({ }, [onChange, selectedItem, selectedIdx, selectedKey]); return options === undefined ? - : - setSelectedItem(item)} placeholder={placeholder} disabled={disabled} required={required} errorMessage={errorMessage} className={className} />; + : + setSelectedItem(item)} placeholder={placeholder} disabled={disabled} required={required} errorMessage={errorMessage} className={className} />; }; interface DropdownMultiProps {