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-30313 ECL Watch v9 fix Files remote copy dialog replicate checkbox #17807

Merged
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
27 changes: 25 additions & 2 deletions esp/src/src-react/components/forms/RemoteCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -58,6 +59,9 @@ export const RemoteCopy: React.FunctionComponent<RemoteCopyProps> = ({
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) => {
Expand Down Expand Up @@ -89,6 +93,24 @@ export const RemoteCopy: React.FunctionComponent<RemoteCopyProps> = ({
}
);

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 <MessageBox title={nlsHPCC.RemoteCopy} show={showForm} setShow={setShowForm}
footer={<>
<PrimaryButton text={nlsHPCC.Copy} onClick={handleSubmit(onSubmit)} />
Expand Down Expand Up @@ -164,13 +186,14 @@ export const RemoteCopy: React.FunctionComponent<RemoteCopyProps> = ({
<Controller
control={control} name="destGroup"
render={({
field: { onChange, name: fieldName, value },
field: { onChange, name: fieldName },
fieldState: { error }
}) => <TargetGroupTextField
key={fieldName}
label={nlsHPCC.Group}
required={true}
onChange={(evt, option) => {
setSelectedDestGroup(option.key.toString());
onChange(option.key);
}}
errorMessage={error && error.message}
Expand Down Expand Up @@ -233,7 +256,7 @@ export const RemoteCopy: React.FunctionComponent<RemoteCopyProps> = ({
control={control} name="replicate"
render={({
field: { onChange, name: fieldName, value }
}) => <Checkbox name={fieldName} checked={value} onChange={onChange} label={nlsHPCC.Replicate} disabled={true} />}
}) => <Checkbox name={fieldName} checked={value} onChange={onChange} label={nlsHPCC.Replicate} disabled={replicateDisabled} />}
/></td>
<td><Controller
control={control} name="superCopy"
Expand Down
Loading