From a580f177f2857bae96b581d28abe28b97f7661f7 Mon Sep 17 00:00:00 2001 From: Julie Vogelman Date: Mon, 29 Aug 2022 16:36:05 -0700 Subject: [PATCH 1/5] fix: with POD_NAMES v2 we can't pass podName as nodeId Signed-off-by: Julie Vogelman --- .../workflow-logs-viewer/workflow-logs-viewer.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 74308ad7f5cf..69afd42c79a7 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 @@ -26,8 +26,9 @@ function identity(value: T) { return () => value; } -export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, archived}: WorkflowLogsViewerProps) => { +export const WorkflowLogsViewer = ({workflow, nodeId: initialNodeId, initialPodName, container, archived}: WorkflowLogsViewerProps) => { const [podName, setPodName] = useState(initialPodName || ''); + const [nodeId, setNodeId] = useState(initialNodeId || '') const [selectedContainer, setContainer] = useState(container); const [grep, setGrep] = useState(''); const [error, setError] = useState(); @@ -37,7 +38,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, useEffect(() => { setError(null); setLoaded(false); - const source = services.workflows.getContainerLogs(workflow, podName, nodeId, selectedContainer, grep, archived).pipe( + const source = services.workflows.getContainerLogs(workflow, podName, initialNodeId, selectedContainer, grep, archived).pipe( map(e => (!podName ? e.podName + ': ' : '') + e.content + '\n'), // this next line highlights the search term in bold with a yellow background, white text map(x => { @@ -71,6 +72,8 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, } const podNameVersion = annotations[ANNOTATION_KEY_POD_NAME_VERSION]; + const podNamesToNodeNames = new Map(); + const podNames = [{value: '', label: 'All'}].concat( Object.values(workflow.status.nodes || {}) .filter(x => x.type === 'Pod') @@ -78,11 +81,13 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, const {name, id, displayName} = targetNode; const templateName = getTemplateNameFromNode(targetNode); const targetPodName = getPodName(workflow.metadata.name, name, templateName, id, podNameVersion); + podNamesToNodeNames.set(targetPodName,id); return {value: targetPodName, label: (displayName || name) + ' (' + targetPodName + ')'}; }) ); - const node = workflow.status.nodes[nodeId]; + + const node = workflow.status.nodes[initialNodeId]; const templates = execSpec(workflow).templates.filter(t => !node || t.name === node.templateName); const containers = [ @@ -106,7 +111,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, )}
{' '} - x.value === podName) || {label: ''}).label} onSelect={(_, item) => setPodName(item.value)} /> /{' '} + x.value[0] === podName) || {label: ''}).label} onSelect={(_, item) => {setPodName(item.value)}} /> /{' '} setLogFilter(v.target.value)} placeholder='Filter (regexp)...' /> @@ -141,7 +146,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, {podName && ( <> Still waiting for data or an error? Try getting{' '} - logs from the artifacts. + logs from the artifacts. )} {execSpec(workflow).podGC && ( From 70889940ad4766df8c21abf8d0a79a9d3a4bfee5 Mon Sep 17 00:00:00 2001 From: Julie Vogelman Date: Mon, 29 Aug 2022 16:44:20 -0700 Subject: [PATCH 2/5] fix: with POD_NAMES v2 we can't pass podName as nodeId Signed-off-by: Julie Vogelman --- .../workflow-logs-viewer/workflow-logs-viewer.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 69afd42c79a7..20bd13779c8b 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 @@ -26,9 +26,8 @@ function identity(value: T) { return () => value; } -export const WorkflowLogsViewer = ({workflow, nodeId: initialNodeId, initialPodName, container, archived}: WorkflowLogsViewerProps) => { +export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, archived}: WorkflowLogsViewerProps) => { const [podName, setPodName] = useState(initialPodName || ''); - const [nodeId, setNodeId] = useState(initialNodeId || '') const [selectedContainer, setContainer] = useState(container); const [grep, setGrep] = useState(''); const [error, setError] = useState(); @@ -38,7 +37,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId: initialNodeId, initialPodN useEffect(() => { setError(null); setLoaded(false); - const source = services.workflows.getContainerLogs(workflow, podName, initialNodeId, selectedContainer, grep, archived).pipe( + const source = services.workflows.getContainerLogs(workflow, podName, nodeId, selectedContainer, grep, archived).pipe( map(e => (!podName ? e.podName + ': ' : '') + e.content + '\n'), // this next line highlights the search term in bold with a yellow background, white text map(x => { @@ -87,7 +86,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId: initialNodeId, initialPodN ); - const node = workflow.status.nodes[initialNodeId]; + const node = workflow.status.nodes[nodeId]; const templates = execSpec(workflow).templates.filter(t => !node || t.name === node.templateName); const containers = [ From 94b4d33fa3117141ca5f3be12cd144549a08c22d Mon Sep 17 00:00:00 2001 From: Julie Vogelman Date: Mon, 29 Aug 2022 19:26:11 -0700 Subject: [PATCH 3/5] fix: with POD_NAMES v2 we can't pass podName as nodeId Signed-off-by: Julie Vogelman --- .../workflow-logs-viewer.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 20bd13779c8b..cd509ba4dd27 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 @@ -71,7 +71,8 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, } const podNameVersion = annotations[ANNOTATION_KEY_POD_NAME_VERSION]; - const podNamesToNodeNames = new Map(); + // map pod names to corresponding node IDs + const podNamesToNodeIDs = new Map(); const podNames = [{value: '', label: 'All'}].concat( Object.values(workflow.status.nodes || {}) @@ -80,12 +81,11 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, const {name, id, displayName} = targetNode; const templateName = getTemplateNameFromNode(targetNode); const targetPodName = getPodName(workflow.metadata.name, name, templateName, id, podNameVersion); - podNamesToNodeNames.set(targetPodName,id); + podNamesToNodeIDs.set(targetPodName, id); return {value: targetPodName, label: (displayName || name) + ' (' + targetPodName + ')'}; }) ); - const node = workflow.status.nodes[nodeId]; const templates = execSpec(workflow).templates.filter(t => !node || t.name === node.templateName); @@ -110,8 +110,14 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, )}
{' '} - x.value[0] === podName) || {label: ''}).label} onSelect={(_, item) => {setPodName(item.value)}} /> /{' '} - + x.value[0] === podName) || {label: ''}).label} + onSelect={(_, item) => { + setPodName(item.value); + }} + />{' '} + / setLogFilter(v.target.value)} placeholder='Filter (regexp)...' /> @@ -145,7 +151,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, {podName && ( <> Still waiting for data or an error? Try getting{' '} - logs from the artifacts. + logs from the artifacts. )} {execSpec(workflow).podGC && ( From 1ba1591ef4498178f137981960537ae97a919730 Mon Sep 17 00:00:00 2001 From: Julie Vogelman Date: Mon, 29 Aug 2022 19:32:12 -0700 Subject: [PATCH 4/5] fix: with POD_NAMES v2 we can't pass podName as nodeId Signed-off-by: Julie Vogelman --- .../components/workflow-logs-viewer/workflow-logs-viewer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 cd509ba4dd27..4da0afa86bff 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 @@ -148,7 +148,7 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container, Wait containers logs are useful when debugging output artifact problems. )} - {podName && ( + {podName && podNamesToNodeIDs.get(podName) && ( <> Still waiting for data or an error? Try getting{' '} logs from the artifacts. From 5dee96ddc65b135a4a65672fa22698a96ddf1841 Mon Sep 17 00:00:00 2001 From: Julie Vogelman Date: Mon, 29 Aug 2022 20:01:50 -0700 Subject: [PATCH 5/5] fix: empty commit Signed-off-by: Julie Vogelman