From 43cbd8b368408c9bf110a6d2c41334a3b1c40fb0 Mon Sep 17 00:00:00 2001 From: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:00:06 -0400 Subject: [PATCH] HPCC-32209 ECL Watch v9 fix result filter dialog blank form Fixes an issue where the Result (WU or file contents) page's Filter dialog would be empty, not displaying any fields. Also fixes the issue of the Result filter fields not updating when using the Next / Previous WU buttons. Signed-off-by: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> --- esp/src/src-react/components/Result.tsx | 27 +++++++++++++++---------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/esp/src/src-react/components/Result.tsx b/esp/src/src-react/components/Result.tsx index 505bef943a8..a9d47294417 100644 --- a/esp/src/src-react/components/Result.tsx +++ b/esp/src/src-react/components/Result.tsx @@ -11,7 +11,7 @@ import { csvEncode } from "src/Utility"; import { useWorkunit, useMyAccount, useConfirm } from "../hooks/index"; import { HolyGrail } from "../layouts/HolyGrail"; import { AutosizeHpccJSComponent } from "../layouts/HpccJSAdapter"; -import { pushParams } from "../util/history"; +import { pushParams, replaceUrl } from "../util/history"; import { ShortVerticalDivider } from "./Common"; import { Fields } from "./forms/Fields"; import { Filter } from "./forms/Filter"; @@ -243,6 +243,12 @@ export const Result: React.FunctionComponent = ({ .pageSize(50) as ResultWidget ); + const { currentUser } = useMyAccount(); + const [wu] = useWorkunit(wuid); + const [result, setResult] = React.useState(resultTable.calcResult()); + const [FilterFields, setFilterFields] = React.useState({}); + const [showFilter, setShowFilter] = React.useState(false); + React.useEffect(() => { resultTable .wuid(wuid) @@ -251,7 +257,7 @@ export const Result: React.FunctionComponent = ({ .logicalFile(logicalFile) .filter(filter) .renderHtml(renderHTML) - .lazyRender() + .render(() => setResult(resultTable.calcResult())) ; }, [cluster, filter, logicalFile, renderHTML, resultName, resultTable, wuid]); @@ -259,12 +265,6 @@ export const Result: React.FunctionComponent = ({ resultTable.filter(filter); }, [filter, resultTable]); - const { currentUser } = useMyAccount(); - const [wu] = useWorkunit(wuid); - const [result] = React.useState(resultTable.calcResult()); - const [FilterFields, setFilterFields] = React.useState({}); - const [showFilter, setShowFilter] = React.useState(false); - React.useEffect(() => { result?.fetchXMLSchema().then(() => { const filterFields: Fields = {}; @@ -276,8 +276,13 @@ export const Result: React.FunctionComponent = ({ }; }); setFilterFields(filterFields); - }).catch(err => logger.error(err)); - }, [result]); + }).catch(err => { + logger.error(err); + if (err.message.indexOf("Cannot open the workunit result") > -1) { + replaceUrl(`/workunits/${wuid}/outputs/`); + } + }); + }, [result, wuid]); // Filter --- const [filterFields, hasHtml] = React.useMemo(() => { @@ -310,7 +315,7 @@ export const Result: React.FunctionComponent = ({ key: "refresh", text: nlsHPCC.Refresh, iconProps: { iconName: "Refresh" }, onClick: () => { resultTable.reset(); - resultTable.lazyRender(); + resultTable.render(() => setResult(resultTable.calcResult())); } }, { key: "divider_1", itemType: ContextualMenuItemType.Divider, onRender: () => },