Add prompt dialog when launching overnight task

This commit is contained in:
Lance Edgar 2022-11-23 11:40:03 -06:00
parent 9abbc001b3
commit 42888c0983

View file

@ -60,8 +60,8 @@
{{ props.row.description }}
</b-table-column>
<b-table-column field="script"
label="Script">
{{ props.row.script }}
label="Command">
{{ props.row.script || props.row.class_name }}
</b-table-column>
<b-table-column field="last_date"
label="Last Date"
@ -72,10 +72,52 @@
<b-button type="is-primary"
icon-pack="fas"
icon-left="arrow-circle-right"
:disabled="overnightTaskLaunching == props.row.key"
@click="overnightTaskLaunch(props.row)">
{{ overnightTaskLaunching == props.row.key ? "Working, please wait..." : "Launch" }}
@click="overnightTaskLaunchInit(props.row)">
Launch
</b-button>
<b-modal has-modal-card
:active.sync="overnightTaskShowLaunchDialog">
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Launch Overnight Task</p>
</header>
<section class="modal-card-body"
v-if="overnightTask">
<b-field label="Task" horizontal>
<span>{{ overnightTask.description }}</span>
</b-field>
<b-field label="Last Date" horizontal>
<span :class="overnightTextClass(overnightTask)">
{{ overnightTask.last_date || "n/a" }}
</span>
</b-field>
<p class="block">
Launching this task will schedule it to begin
within one minute.&nbsp; See the Luigi Task
Visualizer after that, for current status.
</p>
</section>
<footer class="modal-card-foot">
<b-button @click="overnightTaskShowLaunchDialog = false">
Cancel
</b-button>
<b-button type="is-primary"
icon-pack="fas"
icon-left="arrow-circle-right"
@click="overnightTaskLaunchSubmit()"
:disabled="overnightTaskLaunching">
{{ overnightTaskLaunching ? "Working, please wait..." : "Launch" }}
</b-button>
</footer>
</div>
</b-modal>
</b-table-column>
</template>
<template #empty>
@ -206,6 +248,8 @@
% if master.has_perm('launch_overnight'):
ThisPageData.overnightTasks = ${json.dumps(overnight_tasks)|n}
ThisPageData.overnightTask = null
ThisPageData.overnightTaskShowLaunchDialog = false
ThisPageData.overnightTaskLaunching = false
ThisPage.methods.overnightTextClass = function(task) {
@ -221,11 +265,16 @@
}
}
ThisPage.methods.overnightTaskLaunch = function(task) {
this.overnightTaskLaunching = task.key
ThisPage.methods.overnightTaskLaunchInit = function(task) {
this.overnightTask = task
this.overnightTaskShowLaunchDialog = true
}
ThisPage.methods.overnightTaskLaunchSubmit = function() {
this.overnightTaskLaunching = true
let url = '${url('{}.launch_overnight'.format(route_prefix))}'
let params = {key: task.key}
let params = {key: this.overnightTask.key}
this.submitForm(url, params, response => {
this.$buefy.toast.open({
@ -234,6 +283,7 @@
duration: 5000, // 5 seconds
})
this.overnightTaskLaunching = false
this.overnightTaskShowLaunchDialog = false
})
}