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

feat(ui-study): add button to display display 'digest' file on successful tasks in task list #2101

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

skamril
Copy link
Member

@skamril skamril commented Jul 23, 2024

ANT-1905

@skamril skamril self-assigned this Jul 23, 2024
@skamril skamril requested a review from hdinia July 23, 2024 06:48
Comment on lines 22 to 26
await new Promise((res) => {
setTimeout(() => {
res(1);
}, 5000);
});
Copy link
Member

Choose a reason for hiding this comment

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

is that for dev testing ? consider removing it

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks

@@ -37,6 +39,15 @@ export const ColorStatus = {
failed: "error.main",
};

const iconSx = {
Copy link
Member

Choose a reason for hiding this comment

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

optional: iconStyles

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

Comment on lines 82 to 84
const [openDigestDialog, setOpenDigestDialog] = useState<LaunchJob | null>(
null,
);
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using a single state to manage both the visibility and the data of the dialog, you should use two states: one for controlling the visibility and another for storing the data to be passed to the dialog.

 const [openDigestDialog, setOpenDigestDialog] = useState(false);
 const [selectedJob, setSelectedJob] = useState<LaunchJob | null>(null);

then adapt the rest:

// add the event handler
  const handleOpenDigestDialog = (job: LaunchJob) => {
    setSelectedJob(job);
    setOpenDigestDialog(true);
  };
  
  // use it here
  {job.status === "success" && (
      <Tooltip title="Digest">
        <EqualizerIcon
           onClick={handleOpenDigestDialog}
            sx={iconSx}
             />
        </Tooltip>
  )}

adapt this too/

{openDigestDialog && selectedJob && (
        <DigestDialog
          open
          studyId={selectedJob.studyId}
          outputId={selectedJob.outputId}
          onOk={() => setOpenDigestDialog(false)}
        />
      )}

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to change few codes because the view must be redesigned, but I will make a change.

@skamril skamril force-pushed the feature/ANT-1905_digest branch 2 times, most recently from 870ef94 to 177ebb8 Compare July 23, 2024 14:23
@skamril skamril merged commit 2aaa00c into dev Jul 23, 2024
5 of 6 checks passed
@skamril skamril deleted the feature/ANT-1905_digest branch July 23, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants