Make failed modal actions stay on screen
There's not currently any way to view the log of a failed action - an easy win is to keep the log on screen until it's closed by the user.
This commit is contained in:
parent
c7f828e373
commit
2bc585fe33
1 changed files with 24 additions and 4 deletions
|
|
@ -41,6 +41,9 @@
|
|||
<div v-for="(item, index) in log" :key="`log_entry_${index}`">
|
||||
{{ item.message }}
|
||||
</div>
|
||||
<div v-if="taskStatus=='error'" class="uk-alert-danger">
|
||||
The task failed due to an error - use the button below to close this dialog.
|
||||
</div>
|
||||
</div>
|
||||
<div id="progress-and-cancel-row">
|
||||
<div class="stretchy">
|
||||
|
|
@ -62,6 +65,14 @@
|
|||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
v-if="!taskStarted"
|
||||
type="button"
|
||||
class="uk-button not-stretchy"
|
||||
@click="hideModal"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -134,7 +145,8 @@ export default {
|
|||
progress: null,
|
||||
taskStarted: false,
|
||||
taskRunning: false,
|
||||
log: []
|
||||
log: [],
|
||||
taskStatus: ""
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -242,7 +254,10 @@ export default {
|
|||
if (this.selfUpdate) {
|
||||
this.getFormData();
|
||||
}
|
||||
UIkit.modal(this.$refs.statusModal).hide();
|
||||
if (this.taskStatus != "error") {
|
||||
// Leave the modal up if there was an error.
|
||||
UIkit.modal(this.$refs.statusModal).hide();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -267,6 +282,7 @@ export default {
|
|||
.get(this.taskUrl, { baseURL: this.$store.getters.baseUri })
|
||||
.then(response => {
|
||||
var result = response.data.status;
|
||||
this.taskStatus = result;
|
||||
// If the task ends with success
|
||||
if (result == "completed") {
|
||||
resolve(response.data);
|
||||
|
|
@ -274,13 +290,13 @@ export default {
|
|||
// If task ends with an error
|
||||
else if (result == "error") {
|
||||
// Pass the error string back with reject
|
||||
|
||||
if (!this.progress) this.progress = 1;
|
||||
reject(new Error(response.data.output));
|
||||
}
|
||||
// If task ends with termination
|
||||
else if (result == "cancelled") {
|
||||
// Pass a generic termination error back with reject
|
||||
|
||||
if (!this.progress) this.progress = 100;
|
||||
reject(new Error("Task cancelled"));
|
||||
} else {
|
||||
// Since the task is still running, we can update the progress bar
|
||||
|
|
@ -301,6 +317,10 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
hideModal() {
|
||||
UIkit.modal(this.$refs.statusModal).hide()
|
||||
},
|
||||
|
||||
terminateTask: function() {
|
||||
axios.delete(this.taskUrl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue