Skip to content

Commit

Permalink
refactor(ui): simplify hasArtifactLogs with optional chaining (#12933)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Gilgur <[email protected]>
  • Loading branch information
agilgur5 authored Apr 16, 2024
1 parent ea5410a commit 4319608
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions ui/src/app/shared/services/workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ function isNodePendingOrRunning(node: NodeStatus) {

function hasArtifactLogs(workflow: Workflow, nodeId: string, container: string) {
const node = workflow.status.nodes[nodeId];

if (!node || !node.outputs || !node.outputs.artifacts) {
return false;
}

return node.outputs.artifacts.findIndex(a => a.name === `${container}-logs`) !== -1;
return node?.outputs?.artifacts?.some(a => a.name === `${container}-logs`);
}

export const WorkflowsService = {
Expand Down

0 comments on commit 4319608

Please sign in to comment.