Files
OliveTin/webui/js/ExecutionDialog.js
James Read 2ada67be04 Migrate integration-test infrastucture from Cypress to Selenium+Mocha (#170)
* cicd: Move cypress to selenium+mocha

* cicd: with is not supported unless using an a container

* cicd: relative path to mocha

* cicd: the integration-tests runner now starts/stops OliveTin

* cicd: Knowing the CWD helps debugging

* cicd: Headless chrome

* cicd: wait for integration-test server to be started

* fmt: Mostly fix isses from eslint

* cicd: #169 - Test multiple combo boxes

* fmt: let should be const

* cicd: Remove cypress entirely
2023-10-09 21:44:29 +00:00

67 lines
2.1 KiB
JavaScript

// This ExecutionDialog is NOT a custom HTML element, but rather just picks up
// the <dialog /> element out of index.html and just re-uses that - as only
// one dialog can be shown at a time.
export class ExecutionDialog {
constructFromJson (json) {
this.executionUuid = json
this.dlg = document.querySelector('dialog#execution-results-popup')
this.domIcon = this.dlg.querySelector('.icon')
this.domTitle = this.dlg.querySelector('.title')
this.domStdout = this.dlg.querySelector('.stdout')
this.domStderr = this.dlg.querySelector('.stderr')
this.domDatetimeStarted = this.dlg.querySelector('.datetimeStarted')
this.domDatetimeFinished = this.dlg.querySelector('.datetimeFinished')
this.domExitCode = this.dlg.querySelector('.exitCode')
this.domStatus = this.dlg.querySelector('.status')
}
show () {
this.dlg.showModal()
}
renderResult (res) {
this.executionUuid = res.logEntry.executionUuid
if (res.logEntry.executionFinished) {
this.domStatus.innerText = 'Completed'
this.domDatetimeFinished.innerText = res.logEntry.datetimeFinished
if (res.logEntry.blocked) {
this.domStatus.innerText = 'Blocked'
}
if (res.logEntry.timedOut) {
this.domExitCode.innerText = 'Timed out'
this.domStatus.innerText = 'Timed out'
} else {
this.domExitCode.innerText = res.logEntry.exitCode
}
} else {
this.domDatetimeFinished.innerText = 'Still running...'
this.domExitCode.innerText = 'Still running...'
this.domStatus.innerText = 'Still running...'
}
this.domIcon.innerHTML = res.logEntry.actionIcon
this.domTitle.innerText = res.logEntry.actionTitle
this.domStdout.innerText = res.logEntry.stdout
if (res.logEntry.stderr === '') {
this.domStderr.parentElement.hidden = true
this.domStderr.innerText = res.logEntry.stderr
} else {
this.domStderr.parentElement.hidden = false
this.domStderr.innerText = res.logEntry.stderr
}
this.domDatetimeStarted.innerText = res.logEntry.datetimeStarted
}
renderError (err) {
this.dlg.querySelector('pre').innerText = JSON.stringify(err)
}
}