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}`">
|
<div v-for="(item, index) in log" :key="`log_entry_${index}`">
|
||||||
{{ item.message }}
|
{{ item.message }}
|
||||||
</div>
|
</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>
|
||||||
<div id="progress-and-cancel-row">
|
<div id="progress-and-cancel-row">
|
||||||
<div class="stretchy">
|
<div class="stretchy">
|
||||||
|
|
@ -62,6 +65,14 @@
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="!taskStarted"
|
||||||
|
type="button"
|
||||||
|
class="uk-button not-stretchy"
|
||||||
|
@click="hideModal"
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -134,7 +145,8 @@ export default {
|
||||||
progress: null,
|
progress: null,
|
||||||
taskStarted: false,
|
taskStarted: false,
|
||||||
taskRunning: false,
|
taskRunning: false,
|
||||||
log: []
|
log: [],
|
||||||
|
taskStatus: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -242,7 +254,10 @@ export default {
|
||||||
if (this.selfUpdate) {
|
if (this.selfUpdate) {
|
||||||
this.getFormData();
|
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 })
|
.get(this.taskUrl, { baseURL: this.$store.getters.baseUri })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
var result = response.data.status;
|
var result = response.data.status;
|
||||||
|
this.taskStatus = result;
|
||||||
// If the task ends with success
|
// If the task ends with success
|
||||||
if (result == "completed") {
|
if (result == "completed") {
|
||||||
resolve(response.data);
|
resolve(response.data);
|
||||||
|
|
@ -274,13 +290,13 @@ export default {
|
||||||
// If task ends with an error
|
// If task ends with an error
|
||||||
else if (result == "error") {
|
else if (result == "error") {
|
||||||
// Pass the error string back with reject
|
// Pass the error string back with reject
|
||||||
|
if (!this.progress) this.progress = 1;
|
||||||
reject(new Error(response.data.output));
|
reject(new Error(response.data.output));
|
||||||
}
|
}
|
||||||
// If task ends with termination
|
// If task ends with termination
|
||||||
else if (result == "cancelled") {
|
else if (result == "cancelled") {
|
||||||
// Pass a generic termination error back with reject
|
// Pass a generic termination error back with reject
|
||||||
|
if (!this.progress) this.progress = 100;
|
||||||
reject(new Error("Task cancelled"));
|
reject(new Error("Task cancelled"));
|
||||||
} else {
|
} else {
|
||||||
// Since the task is still running, we can update the progress bar
|
// 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() {
|
terminateTask: function() {
|
||||||
axios.delete(this.taskUrl);
|
axios.delete(this.taskUrl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue