-
Notifications
You must be signed in to change notification settings - Fork 211
PM-3080 Fix delete submission #7157
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ export default function Submission(props) { | |
| onOpenRatingsListModal, | ||
| status, | ||
| allowDelete, | ||
| hasPendingWorkflowRuns, | ||
| isWorkflowRunComplete, | ||
| } = props; | ||
| const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A'); | ||
| const onDownloadSubmission = onDownload.bind(1, submissionObject.id); | ||
|
|
@@ -71,8 +71,6 @@ export default function Submission(props) { | |
| && track === COMPETITION_TRACKS.DES | ||
| && safeForDownloadCheck === true; | ||
|
|
||
| const showPendingTooltip = !allowDelete && hasPendingWorkflowRuns; | ||
|
|
||
| return ( | ||
| <tr styleName="submission-row"> | ||
| <td styleName="id-col"> | ||
|
|
@@ -154,11 +152,12 @@ export default function Submission(props) { | |
| ><DownloadIcon /></button> | ||
| */ } | ||
| {showDeleteButton && ( | ||
| !showPendingTooltip ? ( | ||
| isWorkflowRunComplete ? ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| <button | ||
| styleName="delete-icon" | ||
| onClick={() => onDelete(submissionObject.id)} | ||
| type="button" | ||
| disabled={!allowDelete} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| > | ||
| <DeleteIcon /> | ||
| </button> | ||
|
|
@@ -239,5 +238,5 @@ Submission.propTypes = { | |
| allowDelete: PT.bool.isRequired, | ||
| onOpenDownloadArtifactsModal: PT.func, | ||
| onOpenRatingsListModal: PT.func, | ||
| hasPendingWorkflowRuns: PT.bool.isRequired, | ||
| isWorkflowRunComplete: PT.bool.isRequired, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,19 +87,15 @@ export default function SubmissionsTable(props) { | |
| ? submissionWorkflowRuns[subObject.id] | ||
| : null; | ||
|
|
||
| let isWorkflowRunComplete = true; // allow delete if no runs | ||
| const hasRuns = workflowRunsForSubmission && workflowRunsForSubmission.length > 0; | ||
|
|
||
| if (workflowRunsForSubmission && workflowRunsForSubmission.length > 0) { | ||
| isWorkflowRunComplete = workflowRunsForSubmission.length === 0 | ||
| || workflowRunsForSubmission.every(run => TERMINAL_STATUSES.includes(run.status)); | ||
| } | ||
| const isWorkflowRunComplete = !hasRuns | ||
| ? true | ||
| : workflowRunsForSubmission.every(run => TERMINAL_STATUSES.includes(run.status)); | ||
|
|
||
| const allowDelete = submissionPhaseStartDate | ||
| && moment(subObject.submissionDate).isAfter(submissionPhaseStartDate) | ||
| && isWorkflowRunComplete; | ||
| && moment(subObject.submissionDate).isAfter(submissionPhaseStartDate); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
|
|
||
| const hasPendingWorkflowRuns = workflowRunsForSubmission | ||
| && workflowRunsForSubmission.some(run => !TERMINAL_STATUSES.includes(run.status)); | ||
|
|
||
| const submission = ( | ||
| <Submission | ||
|
|
@@ -115,7 +111,7 @@ export default function SubmissionsTable(props) { | |
| allowDelete={allowDelete} | ||
| onOpenDownloadArtifactsModal={onOpenDownloadArtifactsModal} | ||
| onOpenRatingsListModal={onOpenRatingsListModal} | ||
| hasPendingWorkflowRuns={hasPendingWorkflowRuns} | ||
| isWorkflowRunComplete={isWorkflowRunComplete} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| /> | ||
| ); | ||
| submissionsWithDetails.push(submission); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗
correctness]The variable
isWorkflowRunCompleteis used to determine if the delete button should be enabled. Ensure that this variable accurately reflects the completion status of the workflow run, as any discrepancy could lead to incorrect UI behavior.