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-30327 ECL Watch v9 spray multiple files open multiple tabs to WUs #17811

Merged
Show file tree
Hide file tree
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
33 changes: 27 additions & 6 deletions esp/src/src-react/components/forms/landing-zone/BlobImportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export const BlobImportForm: React.FunctionComponent<BlobImportFormProps> = ({

delete data.selectedFiles;

const requests = [];

files.forEach(file => {
request = data;
if (!isContainer) {
Expand All @@ -88,23 +90,42 @@ export const BlobImportForm: React.FunctionComponent<BlobImportFormProps> = ({
}
request["sourcePath"] = file.SourceFile;
request["fullPath"] = file.SourceFile;
FileSpray.SprayFixed({
requests.push(FileSpray.SprayFixed({
request: request
}).then((response) => {
}));
jeclrsg marked this conversation as resolved.
Show resolved Hide resolved
});

Promise.all(requests).then(responses => {
if (responses.length === 1) {
const response = responses[0];
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
logger.error(err);
} else if (response.SprayFixedResponse?.wuid) {
pushUrl(`/dfuworkunits/${response.SprayFixedResponse.wuid}`);
pushUrl(`#/dfuworkunits/${response.SprayFixedResponse.wuid}`);
}
});
});
} else {
const errors = [];
responses.forEach(response => {
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
errors.push(err);
logger.error(err);
} else if (response.SprayFixedResponse?.wuid) {
window.open(`#/dfuworkunits/${response.SprayFixedResponse.wuid}`);
}
});
if (errors.length === 0) {
closeForm();
}
}
}).catch(err => logger.error(err));
},
err => {
logger.error(err);
}
)();
}, [handleSubmit, isContainer]);
}, [closeForm, handleSubmit, isContainer]);

const componentStyles = mergeStyleSets(
FormStyles.componentStyles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ export const DelimitedImportForm: React.FunctionComponent<DelimitedImportFormPro

delete data.selectedFiles;

const requests = [];

files.forEach(file => {
request = data;
if (!isContainer) {
Expand All @@ -109,23 +111,42 @@ export const DelimitedImportForm: React.FunctionComponent<DelimitedImportFormPro
file.TargetName && file.TargetName.substring(0, 2) !== "::"
) ? "::" : "") + file.TargetName;
request["destNumParts"] = file.NumParts;
FileSpray.SprayVariable({
requests.push(FileSpray.SprayVariable({
request: request
}).then((response) => {
}));
jeclrsg marked this conversation as resolved.
Show resolved Hide resolved
});

Promise.all(requests).then(responses => {
if (responses.length === 1) {
const response = responses[0];
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
logger.error(err);
} else if (response.SprayResponse?.wuid) {
pushUrl(`/dfuworkunits/${response.SprayResponse.wuid}`);
pushUrl(`#/dfuworkunits/${response.SprayResponse.wuid}`);
}
});
});
} else {
const errors = [];
responses.forEach(response => {
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
errors.push(err);
logger.error(err);
} else if (response.SprayResponse?.wuid) {
window.open(`#/dfuworkunits/${response.SprayResponse.wuid}`);
}
});
if (errors.length === 0) {
closeForm();
}
}
}).catch(err => logger.error(err));
},
err => {
logger.error(err);
}
)();
}, [handleSubmit, isContainer]);
}, [closeForm, handleSubmit, isContainer]);

const componentStyles = mergeStyleSets(
FormStyles.componentStyles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export const FixedImportForm: React.FunctionComponent<FixedImportFormProps> = ({

delete data.selectedFiles;

const requests = [];

files.forEach(file => {
request = data;
if (!isContainer) {
Expand All @@ -93,23 +95,42 @@ export const FixedImportForm: React.FunctionComponent<FixedImportFormProps> = ({
file.TargetName && file.TargetName.substring(0, 2) !== "::"
) ? "::" : "") + file.TargetName;
request["destNumParts"] = file.NumParts;
FileSpray.SprayFixed({
requests.push(FileSpray.SprayFixed({
request: request
}).then((response) => {
}));
jeclrsg marked this conversation as resolved.
Show resolved Hide resolved
});

Promise.all(requests).then(responses => {
if (responses.length === 1) {
const response = responses[0];
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
logger.error(err);
} else if (response.SprayFixedResponse?.wuid) {
pushUrl(`/dfuworkunits/${response.SprayFixedResponse.wuid}`);
pushUrl(`#/dfuworkunits/${response.SprayFixedResponse.wuid}`);
}
});
});
} else {
const errors = [];
responses.forEach(response => {
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
errors.push(err);
logger.error(err);
} else if (response.SprayFixedResponse?.wuid) {
window.open(`#/dfuworkunits/${response.SprayFixedResponse.wuid}`);
}
});
if (errors.length === 0) {
closeForm();
}
}
}).catch(err => logger.error(err));
},
err => {
logger.error(err);
}
)();
}, [handleSubmit, isContainer]);
}, [closeForm, handleSubmit, isContainer]);

const componentStyles = mergeStyleSets(
FormStyles.componentStyles,
Expand Down
33 changes: 27 additions & 6 deletions esp/src/src-react/components/forms/landing-zone/JsonImportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export const JsonImportForm: React.FunctionComponent<JsonImportFormProps> = ({

delete data.selectedFiles;

const requests = [];

files.forEach(file => {
request = data;
if (!isContainer) {
Expand All @@ -97,23 +99,42 @@ export const JsonImportForm: React.FunctionComponent<JsonImportFormProps> = ({
) ? "::" : "") + file.TargetName;
request["sourceRowTag"] = file.TargetRowPath;
request["destNumParts"] = file.NumParts;
FileSpray.SprayVariable({
requests.push(FileSpray.SprayVariable({
request: request
}).then((response) => {
}));
jeclrsg marked this conversation as resolved.
Show resolved Hide resolved
});

Promise.all(requests).then(responses => {
if (responses.length === 1) {
const response = responses[0];
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
logger.error(err);
} else if (response.SprayResponse?.wuid) {
pushUrl(`/dfuworkunits/${response.SprayResponse.wuid}`);
pushUrl(`#/dfuworkunits/${response.SprayResponse.wuid}`);
}
});
});
} else {
const errors = [];
responses.forEach(response => {
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
errors.push(err);
logger.error(err);
} else if (response.SprayResponse?.wuid) {
window.open(`#/dfuworkunits/${response.SprayResponse.wuid}`);
}
});
if (errors.length === 0) {
closeForm();
}
}
}).catch(err => logger.error(err));
},
err => {
logger.error(err);
}
)();
}, [handleSubmit, isContainer]);
}, [closeForm, handleSubmit, isContainer]);

const componentStyles = mergeStyleSets(
FormStyles.componentStyles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export const VariableImportForm: React.FunctionComponent<VariableImportFormProps

delete data.selectedFiles;

const requests = [];

files.forEach(file => {
request = data;
if (!isContainer) {
Expand All @@ -87,26 +89,45 @@ export const VariableImportForm: React.FunctionComponent<VariableImportFormProps
}
request["sourcePath"] = file.SourceFile;
request["destLogicalName"] = data.namePrefix + ((
data.namePrefix && data.namePrefix.substr(-2) !== "::" &&
file.TargetName && file.TargetName.substr(0, 2) !== "::"
data.namePrefix && data.namePrefix.substring(-2) !== "::" &&
file.TargetName && file.TargetName.substring(0, 2) !== "::"
) ? "::" : "") + file.TargetName;
FileSpray.SprayFixed({
requests.push(FileSpray.SprayFixed({
request: request
}).then((response) => {
}));
jeclrsg marked this conversation as resolved.
Show resolved Hide resolved
});

Promise.all(requests).then(responses => {
if (responses.length === 1) {
const response = responses[0];
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
logger.error(err);
} else if (response.SprayFixedResponse?.wuid) {
pushUrl(`/dfuworkunits/${response.SprayFixedResponse.wuid}`);
pushUrl(`#/dfuworkunits/${response.SprayFixedResponse.wuid}`);
}
});
});
} else {
const errors = [];
responses.forEach(response => {
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
errors.push(err);
logger.error(err);
} else if (response.SprayFixedResponse?.wuid) {
window.open(`#/dfuworkunits/${response.SprayFixedResponse.wuid}`);
}
});
if (errors.length === 0) {
closeForm();
}
}
}).catch(err => logger.error(err));
},
err => {
logger.error(err);
}
)();
}, [handleSubmit, isContainer]);
}, [closeForm, handleSubmit, isContainer]);

const componentStyles = mergeStyleSets(
FormStyles.componentStyles,
Expand Down
33 changes: 27 additions & 6 deletions esp/src/src-react/components/forms/landing-zone/XmlImportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export const XmlImportForm: React.FunctionComponent<XmlImportFormProps> = ({

delete data.selectedFiles;

const requests = [];

files.forEach(file => {
request = data;
if (!isContainer) {
Expand All @@ -96,23 +98,42 @@ export const XmlImportForm: React.FunctionComponent<XmlImportFormProps> = ({
) ? "::" : "") + file.TargetName;
request["sourceRowTag"] = file.TargetRowTag;
request["destNumParts"] = file.NumParts;
FileSpray.SprayVariable({
requests.push(FileSpray.SprayVariable({
request: request
}).then((response) => {
}));
jeclrsg marked this conversation as resolved.
Show resolved Hide resolved
});

Promise.all(requests).then(responses => {
if (responses.length === 1) {
const response = responses[0];
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
logger.error(err);
} else if (response.SprayResponse?.wuid) {
pushUrl(`/dfuworkunits/${response.SprayResponse.wuid}`);
pushUrl(`#/dfuworkunits/${response.SprayResponse.wuid}`);
}
});
});
} else {
const errors = [];
responses.forEach(response => {
if (response?.Exceptions) {
const err = response.Exceptions.Exception[0].Message;
errors.push(err);
logger.error(err);
} else if (response.SprayResponse?.wuid) {
window.open(`#/dfuworkunits/${response.SprayResponse.wuid}`);
}
});
if (errors.length === 0) {
closeForm();
}
}
}).catch(err => logger.error(err));
},
err => {
logger.error(err);
}
)();
}, [handleSubmit, isContainer]);
}, [closeForm, handleSubmit, isContainer]);

const componentStyles = mergeStyleSets(
FormStyles.componentStyles,
Expand Down
Loading