mirror of
https://github.com/OliveTin/OliveTin
synced 2025-12-16 02:55:39 +00:00
feature: Cleanup execution dialog, and log display status. (#378)
* feature: Cleanup execution dialog, and log display status. * fmt: Remove empty block * cicd: Use ActionStatusDisplay in test * bugfix: missed promise * bugfix: missed promise * bugfix: Didnt return getText on ActionStatusDisplay
This commit is contained in:
41
webui.dev/js/ActionStatusDisplay.js
Normal file
41
webui.dev/js/ActionStatusDisplay.js
Normal file
@@ -0,0 +1,41 @@
|
||||
export class ActionStatusDisplay {
|
||||
constructor (parentElement) {
|
||||
this.exitCodeElement = document.createElement('span')
|
||||
this.statusElement = document.createElement('span')
|
||||
this.statusElement.innerText = 'unknown'
|
||||
|
||||
parentElement.innerText = ''
|
||||
parentElement.appendChild(this.statusElement)
|
||||
parentElement.appendChild(this.exitCodeElement)
|
||||
}
|
||||
|
||||
getText () {
|
||||
return this.statusElement.innerText
|
||||
}
|
||||
|
||||
update (logEntry) {
|
||||
this.statusElement.classList.remove(...this.statusElement.classList)
|
||||
|
||||
if (logEntry.executionFinished) {
|
||||
this.statusElement.innerText = 'Completed'
|
||||
this.exitCodeElement.innerText = ', Exit code: ' + logEntry.exitCode
|
||||
|
||||
if (logEntry.exitCode === 0) {
|
||||
this.statusElement.classList.add('action-success')
|
||||
} else if (logEntry.blocked) {
|
||||
this.statusElement.innerText = 'Blocked'
|
||||
this.statusElement.classList.add('action-blocked')
|
||||
this.exitCodeElement.innerText = ''
|
||||
} else if (logEntry.timedOut) {
|
||||
this.statusElement.innerText = 'Timed out'
|
||||
this.statusElement.classList.add('action-timeout')
|
||||
this.exitCodeElement.innerText = ''
|
||||
} else {
|
||||
this.statusElement.classList.add('action-nonzero-exit')
|
||||
}
|
||||
} else {
|
||||
this.statusElement.innerText = 'Still running...'
|
||||
this.exitCodeElement.innerText = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user