Kaynağa Gözat

feature: Link to log outputs (#415)

James Read 1 yıl önce
ebeveyn
işleme
c0a18f82a5

+ 4 - 1
webui.dev/js/ExecutionDialog.js

@@ -140,6 +140,8 @@ export class ExecutionDialog {
     }).then((res) => {
       if (res.ok) {
         return res.json()
+      } else if (res.status === 404) {
+        throw new Error('Execution not found: ' + executionTrackingId)
       } else {
         throw new Error(res.statusText)
       }
@@ -147,6 +149,7 @@ export class ExecutionDialog {
     ).then((json) => {
       this.renderExecutionResult(json)
     }).catch(err => {
+      console.log(err)
       this.renderError(err)
     })
   }
@@ -205,6 +208,6 @@ export class ExecutionDialog {
   }
 
   renderError (err) {
-    this.dlg.querySelector('pre').innerText = JSON.stringify(err)
+    window.showBigError('execution-dlg-err', 'in the execution dialog', 'Failed to fetch execution result. ' + err, false)
   }
 }

+ 13 - 0
webui.dev/js/marshaller.js

@@ -124,7 +124,19 @@ function convertPathToBreadcrumb (path) {
   return result
 }
 
+function showExecutionResult (pathName) {
+  const executionTrackingId = pathName.split('/')[2]
+  window.executionDialog.fetchExecutionResult(executionTrackingId)
+  window.executionDialog.show()
+}
+
 function showSection (pathName) {
+  if (pathName.startsWith('/logs/')) {
+    showExecutionResult(pathName)
+    pushNewNavigationPath(pathName)
+    return
+  }
+
   const path = window.registeredPaths.get(pathName)
 
   if (path === undefined) {
@@ -557,6 +569,7 @@ export function marshalLogsJsonToHtml (json) {
       window.executionDialog.renderExecutionResult({
         logEntry: window.logEntries[logEntry.executionTrackingId]
       })
+      pushNewNavigationPath('/logs/' + logEntry.executionTrackingId)
     }
 
     for (const tag of logEntry.tags) {

+ 4 - 0
webui.dev/style.css

@@ -143,6 +143,10 @@ h1 {
   flex-grow: 1;
 }
 
+dialog h1 {
+  padding-left: 0;
+}
+
 nav ul {
   margin: 0;
   padding: 0;