Skip to content

Commit 8dab59c

Browse files
change warnings displayed when a user approves a previous job spec
1 parent ab9474d commit 8dab59c

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/screens/JobProposal/SpecsView.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ interface Props extends WithStyles<typeof styles> {
7272
}
7373

7474
interface ConfirmationDialogArgs {
75-
action: 'reject' | 'approve' | 'cancel'
75+
action: 'reject' | 'approve' | 'approvePrevious' | 'cancel'
7676
id: string
7777
}
7878

@@ -81,6 +81,25 @@ const confirmationDialogText = {
8181
title: 'Approve Job Proposal',
8282
body: 'Approving this job proposal will start running a new job. WARNING: If a job using the same contract address already exists, it will be deleted before running the new one.',
8383
},
84+
approvePrevious: {
85+
title: 'Approve Previous Version of Job Proposal',
86+
body: (
87+
<div>
88+
<p>
89+
⚠️ You have selected a job spec version that is not the most recent
90+
one.
91+
</p>
92+
<p>
93+
Approving this job proposal will start running a new job with the old
94+
spec version.
95+
</p>
96+
<p>
97+
WARNING: If a job using the same contract address already exists, it
98+
will be deleted before running the new one.
99+
</p>
100+
</div>
101+
),
102+
},
84103
cancel: {
85104
title: 'Cancel Job Proposal',
86105
body: 'Cancelling this job proposal will delete the running job. Are you sure you want to cancel this job proposal?',
@@ -207,7 +226,12 @@ export const SpecsView = withStyles(styles)(
207226
<Button
208227
variant="contained"
209228
color="primary"
210-
onClick={() => openConfirmationDialog('approve', specID)}
229+
onClick={() =>
230+
openConfirmationDialog(
231+
specID == latestSpec.id ? 'approve' : 'approvePrevious',
232+
specID,
233+
)
234+
}
211235
>
212236
Approve
213237
</Button>
@@ -295,6 +319,7 @@ export const SpecsView = withStyles(styles)(
295319
if (confirmationDialog) {
296320
switch (confirmationDialog.action) {
297321
case 'approve':
322+
case 'approvePrevious':
298323
onApprove(confirmationDialog.id)
299324

300325
break

0 commit comments

Comments
 (0)