Skip to content

Commit

Permalink
fix(ui): Fix link for archived logs (argoproj#6019)
Browse files Browse the repository at this point in the history
Signed-off-by: Peixuan Ding <[email protected]>
  • Loading branch information
dinever committed May 26, 2021
1 parent 2d077e4 commit bad6155
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
43 changes: 43 additions & 0 deletions ui/src/app/shared/services/workflow-service.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @jest-environment jsdom
*/
import {Workflow} from '../../../models';
import {WorkflowsService} from './workflows-service';

const workflow = (name: string, namespace: string, uid: string): Workflow => {
return {
metadata: {
name,
namespace,
uid
},
spec: {}
};
};

describe('workflow service', () => {
const service = new WorkflowsService();
test('getArtifactLogsUrl', () => {
expect(service.getArtifactLogsUrl(workflow('hello-world', 'argo', 'test-uid'), 'test-node', 'test-container', false)).toBe(
'artifacts/argo/hello-world/test-node/test-container-logs'
);
expect(service.getArtifactLogsUrl(workflow('hello-world', 'argo', 'test-uid'), 'test-node', 'test-container', true)).toBe(
'artifacts-by-uid/test-uid/test-node/test-container-logs'
);
});

test('getArtifactDownloadUrl', () => {
expect(service.getArtifactDownloadUrl(workflow('hello-world', 'argo', 'test-uid'), 'test-node', 'test-artifact', false, false)).toBe(
'artifacts/argo/hello-world/test-node/test-artifact'
);
expect(service.getArtifactDownloadUrl(workflow('hello-world', 'argo', 'test-uid'), 'test-node', 'test-artifact', true, false)).toBe(
'artifacts-by-uid/test-uid/test-node/test-artifact'
);
expect(service.getArtifactDownloadUrl(workflow('hello-world', 'argo', 'test-uid'), 'test-node', 'test-artifact', false, true)).toBe(
'input-artifacts/argo/hello-world/test-node/test-artifact'
);
expect(service.getArtifactDownloadUrl(workflow('hello-world', 'argo', 'test-uid'), 'test-node', 'test-artifact', true, true)).toBe(
'input-artifacts-by-uid/test-uid/test-node/test-artifact'
);
});
});
2 changes: 1 addition & 1 deletion ui/src/app/shared/services/workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class WorkflowsService {
}

public getArtifactLogsUrl(workflow: Workflow, nodeId: string, container: string, archived: boolean) {
return this.getArtifactDownloadUrl(workflow, nodeId, container + '-logs', archived, true);
return this.getArtifactDownloadUrl(workflow, nodeId, container + '-logs', archived, false);
}

public getArtifactDownloadUrl(workflow: Workflow, nodeId: string, artifactName: string, archived: boolean, isInput: boolean) {
Expand Down

0 comments on commit bad6155

Please sign in to comment.