From 872736f9659ba2be91736807a85aa79277465267 Mon Sep 17 00:00:00 2001 From: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:29:30 -0400 Subject: [PATCH] HPCC-30313 ECL Watch v9 fix Files remote copy dialog replicate checkbox Check if the replicate checkbox should be enabled based upon the selected Group Signed-off-by: Jeremy Clements <79224539+jeclrsg@users.noreply.github.com> --- .../src-react/components/forms/RemoteCopy.tsx | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/esp/src/src-react/components/forms/RemoteCopy.tsx b/esp/src/src-react/components/forms/RemoteCopy.tsx index c605782f654..f50bb4885a6 100644 --- a/esp/src/src-react/components/forms/RemoteCopy.tsx +++ b/esp/src/src-react/components/forms/RemoteCopy.tsx @@ -4,6 +4,7 @@ import { Controller, useForm } from "react-hook-form"; import { scopedLogger } from "@hpcc-js/util"; import nlsHPCC from "src/nlsHPCC"; import * as FileSpray from "src/FileSpray"; +import * as WsTopology from "src/WsTopology"; import * as FormStyles from "./landing-zone/styles"; import { TargetGroupTextField } from "./Fields"; import { MessageBox } from "../../layouts/MessageBox"; @@ -58,6 +59,9 @@ export const RemoteCopy: React.FunctionComponent = ({ const [showError, setShowError] = React.useState(false); const [errorMessage, setErrorMessage] = React.useState(""); + const [selectedDestGroup, setSelectedDestGroup] = React.useState(""); + const [replicateDisabled, setReplicateDisabled] = React.useState(true); + const onSubmit = React.useCallback(() => { handleSubmit( (data, evt) => { @@ -89,6 +93,24 @@ export const RemoteCopy: React.FunctionComponent = ({ } ); + React.useEffect(() => { + WsTopology.TpGroupQuery({ + request: {} + }).then(response => { + const groups = response.TpGroupQueryResponse.TpGroups?.TpGroup ?? []; + for (const index in groups) { + if (groups[index].Name === selectedDestGroup) { + if (groups[index].ReplicateOutputs === true) { + setReplicateDisabled(false); + break; + } + setReplicateDisabled(true); + break; + } + } + }).catch(err => logger.error(err)); + }, [selectedDestGroup]); + return @@ -164,13 +186,14 @@ export const RemoteCopy: React.FunctionComponent = ({ { + setSelectedDestGroup(option.key.toString()); onChange(option.key); }} errorMessage={error && error.message} @@ -233,7 +256,7 @@ export const RemoteCopy: React.FunctionComponent = ({ control={control} name="replicate" render={({ field: { onChange, name: fieldName, value } - }) => } + }) => } />