bugfix: Unexpected message #283 (#284)

This commit is contained in:
James Read 2024-04-20 20:58:38 +01:00 committed by GitHub
parent 09e1de06ce
commit 6991724258
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 19 deletions

View File

@ -185,6 +185,9 @@ message GetReadyzResponse {
}
message EventConfigChanged {}
message EventExecutionFinished {
LogEntry log_entry = 1;
}
service OliveTinApiService {
rpc GetDashboardComponents(GetDashboardComponentsRequest) returns (GetDashboardComponentsResponse) {

View File

@ -62,24 +62,26 @@ func checkOriginPermissive(r *http.Request) bool {
}
func (WebsocketExecutionListener) OnExecutionFinished(logEntry *executor.InternalLogEntry) {
le := &pb.LogEntry{
ActionTitle: logEntry.ActionTitle,
ActionIcon: logEntry.ActionIcon,
ActionId: logEntry.ActionId,
DatetimeStarted: logEntry.DatetimeStarted.Format("2006-01-02 15:04:05"),
DatetimeFinished: logEntry.DatetimeFinished.Format("2006-01-02 15:04:05"),
Stdout: logEntry.Stdout,
Stderr: logEntry.Stderr,
TimedOut: logEntry.TimedOut,
Blocked: logEntry.Blocked,
ExitCode: logEntry.ExitCode,
Tags: logEntry.Tags,
ExecutionTrackingId: logEntry.ExecutionTrackingID,
ExecutionStarted: logEntry.ExecutionStarted,
ExecutionFinished: logEntry.ExecutionFinished,
evt := &pb.EventExecutionFinished{
LogEntry: &pb.LogEntry{
ActionTitle: logEntry.ActionTitle,
ActionIcon: logEntry.ActionIcon,
ActionId: logEntry.ActionId,
DatetimeStarted: logEntry.DatetimeStarted.Format("2006-01-02 15:04:05"),
DatetimeFinished: logEntry.DatetimeFinished.Format("2006-01-02 15:04:05"),
Stdout: logEntry.Stdout,
Stderr: logEntry.Stderr,
TimedOut: logEntry.TimedOut,
Blocked: logEntry.Blocked,
ExitCode: logEntry.ExitCode,
Tags: logEntry.Tags,
ExecutionTrackingId: logEntry.ExecutionTrackingID,
ExecutionStarted: logEntry.ExecutionStarted,
ExecutionFinished: logEntry.ExecutionFinished,
},
}
broadcast(le)
broadcast(evt)
}
func broadcast(pbmsg protoreflect.ProtoMessage) {

View File

@ -12,7 +12,7 @@ export function initMarshaller () {
window.logEntries = {}
window.addEventListener('ExecutionFinished', onExecutionFinished)
window.addEventListener('EventExecutionFinished', onExecutionFinished)
}
export function marshalDashboardComponentsJsonToHtml (json) {
@ -52,7 +52,7 @@ function marshalActionsJsonToHtml (json) {
}
function onExecutionFinished (evt) {
const logEntry = evt.payload
const logEntry = evt.payload.logEntry
const actionButton = window.actionButtons[logEntry.actionTitle]

View File

@ -41,7 +41,7 @@ function websocketOnMessage (msg) {
switch (j.type) {
case 'EventConfigChanged':
case 'ExecutionFinished':
case 'EventExecutionFinished':
window.dispatchEvent(e)
break
default: