Skip to content

Commit

Permalink
Merge pull request #48 from CodeKaio/31-stack-deletion-confirm-dialog
Browse files Browse the repository at this point in the history
✨ : add confirm message before stopping a stack
  • Loading branch information
juwit authored Jul 17, 2019
2 parents 2d86153 + 05e2fda commit 75c1994
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
<artifactId>ace-builds</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap-vue</artifactId>
<version>2.0.0-rc.26</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/templates/layout/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

<link rel="stylesheet" href="/webjars/font-awesome/5.8.2/css/all.css" />

<link rel="stylesheet" href="/webjars/bootstrap-vue/2.0.0-rc.26/dist/bootstrap-vue.css" />

<!-- custom css -->
<link rel="stylesheet" href="/css/style.css" />
<link rel="stylesheet" href="/css/color_2.css" />
Expand Down
22 changes: 20 additions & 2 deletions src/main/resources/templates/stack.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<script src="/webjars/bootstrap/4.3.1/js/bootstrap.min.js"></script>

<script src="/webjars/vue/2.5.16/vue.js"></script>
<script src="/webjars/bootstrap-vue/2.0.0-rc.26/dist/bootstrap-vue.js"></script>

<div th:replace="vue_templates/stack-vars"></div>

Expand All @@ -48,7 +49,7 @@

<a :href="'/stacks/' + stack.id + '/preview'" v-if="stack.state !== 'RUNNING'" class="btn btn-info"><i class="fas fa-binoculars"></i> Preview</a>

<a :href="'/stacks/' + stack.id + '/stop'" v-if="stack.state === 'RUNNING' || stack.state === 'TO_UPDATE'" class="btn btn-danger"><i class="fas fa-stop-circle"></i> Stop</a>
<a href="#" @click="stopStack" v-if="stack.state === 'RUNNING' || stack.state === 'TO_UPDATE'" class="btn btn-danger"><i class="fas fa-stop-circle"></i> Stop</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -246,7 +247,24 @@ <h2><span><i class="fas fa-history"></i> Job history</span></h2>
success: () => message.update({type: "success", message: "Stack saved."}),
error: () => message.update({type: "error", message: "Error saving stack."})
});
}
},
stopStack: function () {
// ask for confirmation
this.$bvModal.msgBoxConfirm('This will completely stop the stack. Continue?', {
title: 'Stop request',
centered: true,
noCloseOnBackdrop: true,
cancelTitle: 'No',
okVariant: 'danger',
okTitle: 'Yes',
returnFocus: 'body'
}).then(value => {
if (value) {
// redirect
window.location = `/stacks/${stack.id}/stop`;
}
})
},
}
});
}
Expand Down

0 comments on commit 75c1994

Please sign in to comment.