Skip to content

Commit

Permalink
fix(ui): properly get archive logs when no node was chosen (argoproj#…
Browse files Browse the repository at this point in the history
…12932)

Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
  • Loading branch information
agilgur5 committed Apr 19, 2024
1 parent bbc1c08 commit 04b51be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ export function WorkflowDetails({history, location, match}: RouteComponentProps<
<WorkflowLogsViewer
workflow={workflow}
initialPodName={podName}
nodeId={parsedSidePanel.nodeId}
initialNodeId={parsedSidePanel.nodeId}
container={parsedSidePanel.container}
archived={isArchivedWorkflow(workflow)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const timezones = Intl.supportedValuesOf('timeZone');

interface WorkflowLogsViewerProps {
workflow: models.Workflow;
nodeId?: string;
initialNodeId?: string;
initialPodName: string;
container: string;
archived: boolean;
Expand Down Expand Up @@ -74,7 +74,7 @@ function parseAndTransform(formattedString: string, timeZone: string) {
}
}

export function WorkflowLogsViewer({workflow, nodeId, initialPodName, container, archived}: WorkflowLogsViewerProps) {
export function WorkflowLogsViewer({workflow, initialNodeId, initialPodName, container, archived}: WorkflowLogsViewerProps) {
const storage = new ScopedLocalStorage('workflow-logs-viewer');
const storedJsonFields = storage.getItem('jsonFields', {
values: []
Expand Down Expand Up @@ -162,7 +162,6 @@ export function WorkflowLogsViewer({workflow, nodeId, initialPodName, container,

// 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')
Expand All @@ -175,6 +174,8 @@ export function WorkflowLogsViewer({workflow, nodeId, initialPodName, container,
})
);

// default to the node id of the pod
const nodeId = initialNodeId || podNamesToNodeIDs.get(podName);
const node = workflow.status.nodes[nodeId];
const templates = execSpec(workflow).templates.filter(t => !node || t.name === node.templateName);

Expand Down

0 comments on commit 04b51be

Please sign in to comment.