From 58cc04298f02d902bf3946756c0eec7b9e625af5 Mon Sep 17 00:00:00 2001 From: jamesread Date: Fri, 23 Feb 2024 23:52:41 +0000 Subject: [PATCH] feature: Popup execution dialog from logs --- webui.dev/index.html | 2 +- webui.dev/js/ActionButton.js | 6 +++--- webui.dev/js/ExecutionButton.js | 4 ++-- webui.dev/js/ExecutionDialog.js | 6 +++--- webui.dev/js/marshaller.js | 10 +++++++++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/webui.dev/index.html b/webui.dev/index.html index 6f2527c..db6c90b 100644 --- a/webui.dev/index.html +++ b/webui.dev/index.html @@ -162,7 +162,7 @@ ? - ? + ?
stdout diff --git a/webui.dev/js/ActionButton.js b/webui.dev/js/ActionButton.js index 8071a45..393017c 100644 --- a/webui.dev/js/ActionButton.js +++ b/webui.dev/js/ActionButton.js @@ -103,7 +103,7 @@ class ActionButton extends ExecutionFeedbackButton { uniqueTrackingId: this.getUniqueId() } - this.onActionStarted(startActionArgs.uuid) + this.onActionStarted(startActionArgs.uniqueTrackingId) window.fetch(window.restBaseUrl + 'StartAction', { method: 'POST', @@ -125,10 +125,10 @@ class ActionButton extends ExecutionFeedbackButton { }) } - onActionStarted (executionUuid) { + onActionStarted (executionTrackingId) { if (this.popupOnStart === 'execution-button') { const btnExecution = document.createElement('execution-button') - btnExecution.constructFromJson(executionUuid) + btnExecution.constructFromJson(executionTrackingId) this.querySelector('.action-button-footer').prepend(btnExecution) return diff --git a/webui.dev/js/ExecutionButton.js b/webui.dev/js/ExecutionButton.js index 8acf40e..79a885d 100644 --- a/webui.dev/js/ExecutionButton.js +++ b/webui.dev/js/ExecutionButton.js @@ -2,7 +2,7 @@ import { ExecutionFeedbackButton } from './ExecutionFeedbackButton.js' class ExecutionButton extends ExecutionFeedbackButton { constructFromJson (json) { - this.executionUuid = json + this.executionTrackingId = json this.ellapsed = 0 this.appendChild(document.createElement('button')) @@ -22,7 +22,7 @@ class ExecutionButton extends ExecutionFeedbackButton { show () { window.executionDialog.reset() window.executionDialog.show() - window.executionDialog.fetchExecutionResult(this.executionUuid) + window.executionDialog.fetchExecutionResult(this.executionTrackingId) } onExecStatusChanged () { diff --git a/webui.dev/js/ExecutionDialog.js b/webui.dev/js/ExecutionDialog.js index c7fe560..81a7a55 100644 --- a/webui.dev/js/ExecutionDialog.js +++ b/webui.dev/js/ExecutionDialog.js @@ -90,10 +90,10 @@ export class ExecutionDialog { } fetchExecutionResult (uuid) { - this.executionUuid = uuid + this.executionTrackingId = uuid const executionStatusArgs = { - executionUuid: this.executionUuid + executionTrackingId: this.executionTrackingId } window.fetch(window.restBaseUrl + 'ExecutionStatus', { @@ -127,7 +127,7 @@ export class ExecutionDialog { this.domStdout.parentElement.open = true } - this.executionUuid = res.logEntry.executionUuid + this.executionTrackingId = res.logEntry.executionTrackingId if (res.logEntry.executionFinished) { this.domStatus.innerText = 'Completed' diff --git a/webui.dev/js/marshaller.js b/webui.dev/js/marshaller.js index e91ed67..ebd8d5f 100644 --- a/webui.dev/js/marshaller.js +++ b/webui.dev/js/marshaller.js @@ -56,7 +56,7 @@ function onExecutionFinished (evt) { switch (actionButton.popupOnStart) { case 'execution-button': - document.querySelector('execution-button#execution-' + logEntry.uuid).onExecutionFinished(logEntry) + document.querySelector('execution-button#execution-' + logEntry.executionTrackingId).onExecutionFinished(logEntry) break case 'execution-dialog-stdout-only': case 'execution-dialog': @@ -414,6 +414,14 @@ export function marshalLogsJsonToHtml (json) { row.querySelector('.exit-code').innerText = logTableExitCode row.setAttribute('title', logEntry.actionTitle) + row.querySelector('.content').onclick = () => { + window.executionDialog.reset() + window.executionDialog.show() + window.executionDialog.renderExecutionResult({ + logEntry: window.logEntries[logEntry.executionTrackingId] + }) + } + for (const tag of logEntry.tags) { const domTag = document.createElement('span') domTag.classList.add('tag')