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

CORE-1183: async path list creation #570

Merged
merged 3 commits into from
Apr 12, 2024
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
1 change: 1 addition & 0 deletions public/static/locales/en/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"asyncDataDeletePending": "Deletion in progress. You will be notified when completed.",
"asyncDataEmptyTrashPending": "Emptying trash. You will be notified when completed.",
"asyncMovePending": "Move in progress. You will be notified when completed.",
"asyncPathListPending": "Path List creation in progress. You will be notified when completed.",
"asyncRenamePending": "Rename in progress. You will be notified when completed.",
"asyncDataRestorePending": "Restoring requested item(s). You will be notified when completed.",
"automateCreateHtPathList": "Generate HT analysis path list",
Expand Down
11 changes: 10 additions & 1 deletion src/components/data/PathListAutomation.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import buildID from "components/utils/DebugIDUtil";
import FormTextField from "components/forms/FormTextField";
import FormSwitch from "components/forms/FormSwitch";

import { announce } from "components/announcer/CyVerseAnnouncer";
import { INFO } from "components/announcer/AnnouncerConstants";

import SaveAsField from "./SaveAsField";
import ids from "./ids";
import { validateDiskResourceName } from "./utils";
Expand Down Expand Up @@ -100,7 +103,13 @@ export default function PathListAutomation(props) {
{
onSuccess: (data) => {
setCreatePathListError(null);
onCreatePathList(data.file.id, data.file.path);
if (data.async_task_id) {
announce({
text: t("asyncPathListPending"),
variant: INFO,
});
}
onCreatePathList(data?.file?.id, data?.file?.path);
},
onError: (error, { onError }) => {
let errMsg = null;
Expand Down
4 changes: 3 additions & 1 deletion src/components/data/toolbar/DataDotMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ function DataDotMenu(props) {
onClose={() => setPathListDlgOpen(false)}
onCreatePathList={(id, path) => {
setPathListDlgOpen(false);
routeToFile(id, path);
if (id && path) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, at the very least, the following line should be updated to check for undefined path and id as well:

onCreatePathList(data.file.id, data.file.path);

Such as onCreatePathList(data?.file?.id, data?.file?.path);

We'll probably also want to display an alert that the request is processing, and the user will get a notification when it's complete. Like we do when moving files/folders, for example:

const { mutate: resourcesMove, status } = useMutation(move, {
onSuccess: (data) => {
announce({
text: t("asyncMovePending"),
variant: INFO,
});
onClose();
},
onError: setMoveError,
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good and I really appreciate the pointers to how to change some of these things since I haven't been working with the UI that much 😅

I think I've fixed both of these things

routeToFile(id, path);
}
}}
onCancel={() => setPathListDlgOpen(false)}
startingPath={path}
Expand Down
Loading