|
@@ -2,21 +2,51 @@
|
|
|
// the <dialog /> element out of index.html and just re-uses that - as only
|
|
// the <dialog /> element out of index.html and just re-uses that - as only
|
|
|
// one dialog can be shown at a time.
|
|
// one dialog can be shown at a time.
|
|
|
export class ExecutionDialog {
|
|
export class ExecutionDialog {
|
|
|
- show (json) {
|
|
|
|
|
- this.executionUuid = json
|
|
|
|
|
-
|
|
|
|
|
|
|
+ constructor () {
|
|
|
this.dlg = document.querySelector('dialog#execution-results-popup')
|
|
this.dlg = document.querySelector('dialog#execution-results-popup')
|
|
|
|
|
|
|
|
this.domIcon = document.getElementById('execution-dialog-icon')
|
|
this.domIcon = document.getElementById('execution-dialog-icon')
|
|
|
this.domTitle = document.getElementById('execution-dialog-title')
|
|
this.domTitle = document.getElementById('execution-dialog-title')
|
|
|
this.domStdout = document.getElementById('execution-dialog-stdout')
|
|
this.domStdout = document.getElementById('execution-dialog-stdout')
|
|
|
this.domStderr = document.getElementById('execution-dialog-stderr')
|
|
this.domStderr = document.getElementById('execution-dialog-stderr')
|
|
|
|
|
+ this.domStdoutToggleBig = document.getElementById('execution-dialog-toggle-size')
|
|
|
|
|
+ this.domStdoutToggleBig.onclick = () => {
|
|
|
|
|
+ this.toggleSize()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.domDatetimeStarted = document.getElementById('execution-dialog-datetime-started')
|
|
this.domDatetimeStarted = document.getElementById('execution-dialog-datetime-started')
|
|
|
this.domDatetimeFinished = document.getElementById('execution-dialog-datetime-finished')
|
|
this.domDatetimeFinished = document.getElementById('execution-dialog-datetime-finished')
|
|
|
this.domExitCode = document.getElementById('execution-dialog-exit-code')
|
|
this.domExitCode = document.getElementById('execution-dialog-exit-code')
|
|
|
this.domStatus = document.getElementById('execution-dialog-status')
|
|
this.domStatus = document.getElementById('execution-dialog-status')
|
|
|
|
|
|
|
|
- this.domTitle.innerText = 'Loading...'
|
|
|
|
|
|
|
+ this.domExecutionBasics = document.getElementById('execution-dialog-basics')
|
|
|
|
|
+ this.domExecutionDetails = document.getElementById('execution-dialog-details')
|
|
|
|
|
+ this.domExecutionOutput = document.getElementById('execution-dialog-output')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ toggleSize () {
|
|
|
|
|
+ if (this.dlg.classList.contains('big')) {
|
|
|
|
|
+ this.dlg.classList.remove('big')
|
|
|
|
|
+ this.domStdout.parentElement.open = false
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.dlg.classList.add('big')
|
|
|
|
|
+ this.domStdout.parentElement.open = true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ reset () {
|
|
|
|
|
+ this.executionSeconds = 0
|
|
|
|
|
+
|
|
|
|
|
+ this.dlg.classList.remove('big')
|
|
|
|
|
+ this.dlg.style.maxWidth = 'calc(100vw - 2em)'
|
|
|
|
|
+ this.dlg.style.width = ''
|
|
|
|
|
+ this.dlg.style.height = ''
|
|
|
|
|
+ this.dlg.style.border = ''
|
|
|
|
|
+
|
|
|
|
|
+ this.domStdoutToggleBig.hidden = false
|
|
|
|
|
+
|
|
|
|
|
+ this.domIcon.innerText = ''
|
|
|
|
|
+ this.domTitle.innerText = 'Waiting for result... '
|
|
|
this.domExitCode.innerText = '?'
|
|
this.domExitCode.innerText = '?'
|
|
|
this.domStatus.className = ''
|
|
this.domStatus.className = ''
|
|
|
this.domDatetimeStarted.innerText = ''
|
|
this.domDatetimeStarted.innerText = ''
|
|
@@ -24,12 +54,44 @@ export class ExecutionDialog {
|
|
|
this.domStdout.innerText = ''
|
|
this.domStdout.innerText = ''
|
|
|
this.domStderr.innerText = ''
|
|
this.domStderr.innerText = ''
|
|
|
|
|
|
|
|
|
|
+ this.hideDetailsOnResult = false
|
|
|
|
|
+ this.domExecutionBasics.hidden = false
|
|
|
|
|
+
|
|
|
|
|
+ this.domExecutionDetails.hidden = true
|
|
|
|
|
+ this.domStdout.parentElement.open = false
|
|
|
|
|
+
|
|
|
|
|
+ this.domExecutionOutput.hidden = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ show (actionButton) {
|
|
|
|
|
+ if (typeof actionButton !== 'undefined' && actionButton != null) {
|
|
|
|
|
+ this.domIcon.innerText = actionButton.domIcon.innerText
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ clearInterval(window.executionDialogTicker)
|
|
|
|
|
+ this.executionSeconds = 0
|
|
|
|
|
+ this.executionTick()
|
|
|
|
|
+ window.executionDialogTicker = setInterval(() => {
|
|
|
|
|
+ this.executionTick()
|
|
|
|
|
+ }, 1000)
|
|
|
|
|
+
|
|
|
this.dlg.showModal()
|
|
this.dlg.showModal()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ executionTick () {
|
|
|
|
|
+ this.executionSeconds++
|
|
|
|
|
+
|
|
|
|
|
+ this.domDatetimeStarted.innerText = this.executionSeconds + ' seconds ago'
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this.fetchExecutionResult()
|
|
|
|
|
|
|
+ hideEverythingApartFromOutput () {
|
|
|
|
|
+ this.hideDetailsOnResult = true
|
|
|
|
|
+ this.domExecutionBasics.hidden = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- fetchExecutionResult () {
|
|
|
|
|
|
|
+ fetchExecutionResult (uuid) {
|
|
|
|
|
+ this.executionUuid = uuid
|
|
|
|
|
+
|
|
|
const executionStatusArgs = {
|
|
const executionStatusArgs = {
|
|
|
executionUuid: this.executionUuid
|
|
executionUuid: this.executionUuid
|
|
|
}
|
|
}
|
|
@@ -48,13 +110,23 @@ export class ExecutionDialog {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
).then((json) => {
|
|
).then((json) => {
|
|
|
- this.renderResult(json)
|
|
|
|
|
|
|
+ this.renderExecutionResult(json)
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
this.renderError(err)
|
|
this.renderError(err)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- renderResult (res) {
|
|
|
|
|
|
|
+ renderExecutionResult (res) {
|
|
|
|
|
+ clearInterval(window.executionDialogTicker)
|
|
|
|
|
+
|
|
|
|
|
+ this.domExecutionOutput.hidden = false
|
|
|
|
|
+
|
|
|
|
|
+ if (!this.hideDetailsOnResult) {
|
|
|
|
|
+ this.domExecutionDetails.hidden = false
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.domStdout.parentElement.open = true
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.executionUuid = res.logEntry.executionUuid
|
|
this.executionUuid = res.logEntry.executionUuid
|
|
|
|
|
|
|
|
if (res.logEntry.executionFinished) {
|
|
if (res.logEntry.executionFinished) {
|
|
@@ -86,7 +158,7 @@ export class ExecutionDialog {
|
|
|
this.domStdout.innerText = res.logEntry.stdout
|
|
this.domStdout.innerText = res.logEntry.stdout
|
|
|
this.domStdout.innerText = res.logEntry.stdout
|
|
this.domStdout.innerText = res.logEntry.stdout
|
|
|
|
|
|
|
|
- if (res.logEntry.stderr === '') {
|
|
|
|
|
|
|
+ if (res.logEntry.stderr === '(empty)') {
|
|
|
this.domStderr.parentElement.style.display = 'none'
|
|
this.domStderr.parentElement.style.display = 'none'
|
|
|
this.domStderr.innerText = res.logEntry.stderr
|
|
this.domStderr.innerText = res.logEntry.stderr
|
|
|
} else {
|
|
} else {
|