|
@@ -54,12 +54,13 @@ export function initMarshaller () {
|
|
|
|
|
|
|
|
window.executionDialog = new ExecutionDialog()
|
|
window.executionDialog = new ExecutionDialog()
|
|
|
|
|
|
|
|
- window.logEntries = {}
|
|
|
|
|
|
|
+ window.logEntries = new Map()
|
|
|
window.registeredPaths = new Map()
|
|
window.registeredPaths = new Map()
|
|
|
window.breadcrumbNavigation = []
|
|
window.breadcrumbNavigation = []
|
|
|
|
|
|
|
|
window.currentPath = ''
|
|
window.currentPath = ''
|
|
|
|
|
|
|
|
|
|
+ window.addEventListener('EventExecutionStarted', onExecutionStarted)
|
|
|
window.addEventListener('EventExecutionFinished', onExecutionFinished)
|
|
window.addEventListener('EventExecutionFinished', onExecutionFinished)
|
|
|
window.addEventListener('EventOutputChunk', onOutputChunk)
|
|
window.addEventListener('EventOutputChunk', onOutputChunk)
|
|
|
}
|
|
}
|
|
@@ -125,6 +126,14 @@ function onOutputChunk (evt) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function onExecutionStarted (evt) {
|
|
|
|
|
+ const logEntry = evt.payload.logEntry
|
|
|
|
|
+
|
|
|
|
|
+ marshalLogsJsonToHtml({
|
|
|
|
|
+ logs: [logEntry]
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function onExecutionFinished (evt) {
|
|
function onExecutionFinished (evt) {
|
|
|
const logEntry = evt.payload.logEntry
|
|
const logEntry = evt.payload.logEntry
|
|
|
|
|
|
|
@@ -136,7 +145,9 @@ function onExecutionFinished (evt) {
|
|
|
|
|
|
|
|
switch (actionButton.popupOnStart) {
|
|
switch (actionButton.popupOnStart) {
|
|
|
case 'execution-button':
|
|
case 'execution-button':
|
|
|
- document.querySelector('execution-button#execution-' + logEntry.executionTrackingId).onExecutionFinished(logEntry)
|
|
|
|
|
|
|
+ if (document.querySelector('execution-button#execution-' + logEntry.executionTrackingId) !== null) { // If the button was created in our instance
|
|
|
|
|
+ document.querySelector('execution-button#execution-' + logEntry.executionTrackingId).onExecutionFinished(logEntry)
|
|
|
|
|
+ }
|
|
|
break
|
|
break
|
|
|
case 'execution-dialog-stdout-only':
|
|
case 'execution-dialog-stdout-only':
|
|
|
case 'execution-dialog':
|
|
case 'execution-dialog':
|
|
@@ -617,41 +628,46 @@ function marshalDirectory (item, section) {
|
|
|
|
|
|
|
|
export function marshalLogsJsonToHtml (json) {
|
|
export function marshalLogsJsonToHtml (json) {
|
|
|
for (const logEntry of json.logs) {
|
|
for (const logEntry of json.logs) {
|
|
|
- const existing = window.logEntries[logEntry.executionTrackingId]
|
|
|
|
|
|
|
+ let row
|
|
|
|
|
|
|
|
- if (existing !== undefined) {
|
|
|
|
|
- continue
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (window.logEntries.has(logEntry.executionTrackingId)) {
|
|
|
|
|
+ row = window.logEntries.get(logEntry.executionTrackingId).dom
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const tpl = document.getElementById('tplLogRow')
|
|
|
|
|
+ row = tpl.content.querySelector('tr').cloneNode(true)
|
|
|
|
|
+
|
|
|
|
|
+ row.querySelector('.content').onclick = () => {
|
|
|
|
|
+ window.executionDialog.reset()
|
|
|
|
|
+ window.executionDialog.show()
|
|
|
|
|
+ window.executionDialog.renderExecutionResult({
|
|
|
|
|
+ logEntry: window.logEntries.get(logEntry.executionTrackingId)
|
|
|
|
|
+ })
|
|
|
|
|
+ pushNewNavigationPath('/logs/' + logEntry.executionTrackingId)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- window.logEntries[logEntry.executionTrackingId] = logEntry
|
|
|
|
|
|
|
+ row.exitCodeDisplay = new ActionStatusDisplay(row.querySelector('.exit-code'))
|
|
|
|
|
|
|
|
- const tpl = document.getElementById('tplLogRow')
|
|
|
|
|
- const row = tpl.content.querySelector('tr').cloneNode(true)
|
|
|
|
|
|
|
+ logEntry.dom = row
|
|
|
|
|
+
|
|
|
|
|
+ window.logEntries.set(logEntry.executionTrackingId, logEntry)
|
|
|
|
|
+
|
|
|
|
|
+ document.querySelector('#logTableBody').prepend(row)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
row.querySelector('.timestamp').innerText = logEntry.datetimeStarted
|
|
row.querySelector('.timestamp').innerText = logEntry.datetimeStarted
|
|
|
row.querySelector('.content').innerText = logEntry.actionTitle
|
|
row.querySelector('.content').innerText = logEntry.actionTitle
|
|
|
row.querySelector('.icon').innerHTML = logEntry.actionIcon
|
|
row.querySelector('.icon').innerHTML = logEntry.actionIcon
|
|
|
row.setAttribute('title', logEntry.actionTitle)
|
|
row.setAttribute('title', logEntry.actionTitle)
|
|
|
|
|
|
|
|
- const exitCodeDisplay = new ActionStatusDisplay(row.querySelector('.exit-code'))
|
|
|
|
|
- exitCodeDisplay.update(logEntry)
|
|
|
|
|
|
|
+ row.exitCodeDisplay.update(logEntry)
|
|
|
|
|
|
|
|
- row.querySelector('.content').onclick = () => {
|
|
|
|
|
- window.executionDialog.reset()
|
|
|
|
|
- window.executionDialog.show()
|
|
|
|
|
- window.executionDialog.renderExecutionResult({
|
|
|
|
|
- logEntry: window.logEntries[logEntry.executionTrackingId]
|
|
|
|
|
- })
|
|
|
|
|
- pushNewNavigationPath('/logs/' + logEntry.executionTrackingId)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ row.querySelector('.tags').innerHTML = ''
|
|
|
|
|
|
|
|
for (const tag of logEntry.tags) {
|
|
for (const tag of logEntry.tags) {
|
|
|
row.querySelector('.tags').append(createTag(tag))
|
|
row.querySelector('.tags').append(createTag(tag))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
row.querySelector('.tags').append(createAnnotation('user', logEntry.user))
|
|
row.querySelector('.tags').append(createAnnotation('user', logEntry.user))
|
|
|
-
|
|
|
|
|
- document.querySelector('#logTableBody').prepend(row)
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|