From 5a90f6b78b9eb1176fb068313a0c1ddb68dcdb38 Mon Sep 17 00:00:00 2001 From: Lukas Date: Tue, 9 Apr 2024 17:39:27 +0200 Subject: [PATCH] fix: requested pr changes Signed-off-by: Lukas --- ui/src/app/shared/services/workflows-service.ts | 2 +- .../workflow-logs-viewer/workflow-logs-viewer.tsx | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/src/app/shared/services/workflows-service.ts b/ui/src/app/shared/services/workflows-service.ts index 8970e16cbb90..b9c312586ed2 100644 --- a/ui/src/app/shared/services/workflows-service.ts +++ b/ui/src/app/shared/services/workflows-service.ts @@ -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)) ); diff --git a/ui/src/app/workflows/components/workflow-logs-viewer/workflow-logs-viewer.tsx b/ui/src/app/workflows/components/workflow-logs-viewer/workflow-logs-viewer.tsx index 5c782d09ede3..386315933397 100644 --- a/ui/src/app/workflows/components/workflow-logs-viewer/workflow-logs-viewer.tsx +++ b/ui/src/app/workflows/components/workflow-logs-viewer/workflow-logs-viewer.tsx @@ -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 => { @@ -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(''); @@ -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);