Fix end of action behaviours and looging errors

This commit is contained in:
Julian Stirling 2025-11-09 16:49:16 +00:00
parent dd0a57520b
commit 8b785823ab
2 changed files with 21 additions and 55 deletions

View file

@ -7,7 +7,8 @@
</div>
</div>
<div v-if="taskStatus == 'error'" class="uk-alert uk-alert-danger">
The task failed due to an error. There may be more information in the log.
<p><b>The task failed due to an error:</b></p>
<p>{{ errorMessage }}</p>
</div>
<div v-if="taskStatus == 'cancelled'" class="uk-alert uk-alert-warning">
The task was cancelled.
@ -43,6 +44,21 @@ export default {
};
},
computed: {
errorMessage() {
let logLength = this.log.length;
var defaultMessage = "Unexpected error, please check the logs";
if (logLength == 0) {
return defaultMessage;
}
// Cannot use .at until we update OpenFlexure Connect
if (this.log[logLength - 1].levelname != "ERROR") {
return defaultMessage;
}
return this.log[logLength - 1].message || defaultMessage;
},
},
watch: {
log: function () {
this.scrollToBottom();