Skip to content

Commit

Permalink
fix: requested pr changes
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas <[email protected]>
  • Loading branch information
LukasLJL committed Apr 9, 2024
1 parent 143b199 commit 5a90f6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/shared/services/workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const WorkflowsService = {
return from(requests.get(this.getArtifactLogsPath(workflow, nodeId, container, archived)));
}),
mergeMap(r => r.text.split('\n')),
filter(x => !!x), //check for empty content
filter(x => !!x), // check for empty content
map(content => ({content, podName: workflow.status.nodes[nodeId].displayName}) as LogEntry),
filter(x => !!x.content.match(grep))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export function WorkflowLogsViewer({workflow, nodeId, initialPodName, container,
setError(null);
setLoaded(false);

// if no node id is set (for example, when no node is selected), then use the node id of of the pod.
if (archived && !selectedNodeId && podNamesToNodeIDs.get(podName)) {
setNodeId(podNamesToNodeIDs.get(podName));
}

const source = services.workflows.getContainerLogs(workflow, podName, selectedNodeId, selectedContainer, grep, archived).pipe(
// extract message from LogEntry
map(e => {
Expand Down Expand Up @@ -150,7 +155,7 @@ export function WorkflowLogsViewer({workflow, nodeId, initialPodName, container,
);
setLogsObservable(source);
return () => subscription.unsubscribe();
}, [workflow.metadata.namespace, workflow.metadata.name, podName, selectedContainer, grep, archived, selectedJsonFields, timezone]);
}, [workflow.metadata.namespace, workflow.metadata.name, podName, selectedNodeId, selectedContainer, grep, archived, selectedJsonFields, timezone]);

// filter allows us to introduce a short delay, before we actually change grep
const [logFilter, setLogFilter] = useState('');
Expand All @@ -177,11 +182,6 @@ export function WorkflowLogsViewer({workflow, nodeId, initialPodName, container,
})
);

// if no node id is set (for example, when no node is selected), then use the node id of of the pod.
if (archived && !selectedNodeId && podNamesToNodeIDs.get(podName)) {
setNodeId(podNamesToNodeIDs.get(podName));
}

const node = workflow.status.nodes[selectedNodeId];
const templates = execSpec(workflow).templates.filter(t => !node || t.name === node.templateName);

Expand Down

0 comments on commit 5a90f6b

Please sign in to comment.