Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: link to "get artifacts from logs" was assuming Node ID was equal to Pod Name #9464

Merged
merged 5 commits into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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