Skip to content

Commit

Permalink
Merge pull request #1517 from pierotofy/restartchk
Browse files Browse the repository at this point in the history
Add restart confirmation
  • Loading branch information
pierotofy authored Jul 3, 2024
2 parents 7baf02e + 22f41a1 commit 5677eec
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 76 deletions.
16 changes: 13 additions & 3 deletions app/static/app/js/components/TaskListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class TaskListItem extends React.Component {
return items;
}

genRestartAction(rerunFrom = null){
genRestartAction(rerunFrom = null, options = {}){
const { task } = this.state;

const restartAction = this.genActionApiCall("restart", {
Expand Down Expand Up @@ -388,10 +388,20 @@ class TaskListItem extends React.Component {
});
};

return () => {
let doAction = () => {
setTaskRerunFrom(rerunFrom)
.then(restartAction);
};

return () => {
if (options.confirm){
if (window.confirm(options.confirm)){
doAction();
}
}else{
doAction();
}
};
}

moveTaskAction = (formData) => {
Expand Down Expand Up @@ -485,7 +495,7 @@ class TaskListItem extends React.Component {
task.can_rerun_from[1] :
null;

addActionButton(_("Restart"), "btn-primary", "glyphicon glyphicon-repeat", this.genRestartAction(rerunFrom), {
addActionButton(_("Restart"), "btn-primary", "glyphicon glyphicon-repeat", this.genRestartAction(rerunFrom, {confirm: _("Are you sure you want to restart this task?")}), {
subItems: this.getRestartSubmenuItems()
});
}
Expand Down
Loading

0 comments on commit 5677eec

Please sign in to comment.