Skip to content

Commit

Permalink
fix: link to "get artifacts from logs" was assuming Node ID was equal…
Browse files Browse the repository at this point in the history
… to Pod Name (#9464)

* fix: with POD_NAMES v2 we can't pass podName as nodeId

Signed-off-by: Julie Vogelman <[email protected]>

* fix: with POD_NAMES v2 we can't pass podName as nodeId

Signed-off-by: Julie Vogelman <[email protected]>

* fix: with POD_NAMES v2 we can't pass podName as nodeId

Signed-off-by: Julie Vogelman <[email protected]>

* fix: with POD_NAMES v2 we can't pass podName as nodeId

Signed-off-by: Julie Vogelman <[email protected]>

* fix: empty commit

Signed-off-by: Julie Vogelman <[email protected]>

Signed-off-by: Julie Vogelman <[email protected]>
  • Loading branch information
juliev0 authored Aug 30, 2022
1 parent 9cce91e commit 26ab0ae
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container,
}
const podNameVersion = annotations[ANNOTATION_KEY_POD_NAME_VERSION];

// map pod names to corresponding node IDs
const podNamesToNodeIDs = new Map<string, string>();

const podNames = [{value: '', label: 'All'}].concat(
Object.values(workflow.status.nodes || {})
.filter(x => x.type === 'Pod')
.map(targetNode => {
const {name, id, displayName} = targetNode;
const templateName = getTemplateNameFromNode(targetNode);
const targetPodName = getPodName(workflow.metadata.name, name, templateName, id, podNameVersion);
podNamesToNodeIDs.set(targetPodName, id);
return {value: targetPodName, label: (displayName || name) + ' (' + targetPodName + ')'};
})
);
Expand Down Expand Up @@ -106,8 +110,14 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container,
)}
<div style={{marginBottom: 10}}>
<i className='fa fa-box' />{' '}
<Autocomplete items={podNames} value={(podNames.find(x => x.value === podName) || {label: ''}).label} onSelect={(_, item) => setPodName(item.value)} /> /{' '}
<Autocomplete items={containers} value={selectedContainer} onSelect={setContainer} />
<Autocomplete
items={podNames}
value={(podNames.find(x => x.value[0] === podName) || {label: ''}).label}
onSelect={(_, item) => {
setPodName(item.value);
}}
/>{' '}
/ <Autocomplete items={containers} value={selectedContainer} onSelect={setContainer} />
<span className='fa-pull-right'>
<i className='fa fa-filter' /> <input type='search' defaultValue={logFilter} onChange={v => setLogFilter(v.target.value)} placeholder='Filter (regexp)...' />
</span>
Expand Down Expand Up @@ -138,10 +148,10 @@ export const WorkflowLogsViewer = ({workflow, nodeId, initialPodName, container,
<InfoIcon /> Wait containers logs are useful when debugging output artifact problems.
</>
)}
{podName && (
{podName && podNamesToNodeIDs.get(podName) && (
<>
Still waiting for data or an error? Try getting{' '}
<a href={services.workflows.getArtifactLogsPath(workflow, podName, selectedContainer, archived)}>logs from the artifacts</a>.
<a href={services.workflows.getArtifactLogsPath(workflow, podNamesToNodeIDs.get(podName), selectedContainer, archived)}>logs from the artifacts</a>.
</>
)}
{execSpec(workflow).podGC && (
Expand Down

0 comments on commit 26ab0ae

Please sign in to comment.