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: logs UI should fall back to archive. Fixes #2137 #2139

Merged
merged 1 commit into from
Feb 3, 2020
Merged
Show file tree
Hide file tree
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
13 changes: 1 addition & 12 deletions ui/src/app/shared/services/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import {apiUrl, uiUrl} from '../base';

const superagentPromise = require('superagent-promise');

enum ReadyState {
CONNECTING = 0,
OPEN = 1,
CLOSED = 2,
DONE = 4
}

const auth = (req: SuperAgentRequest) => {
return req.on('error', handle);
};
Expand Down Expand Up @@ -61,11 +54,7 @@ export default {
};
eventSource.onmessage = (msg: any) => observer.next(msg.data);
eventSource.onerror = (e: any) => {
if (e.eventPhase === ReadyState.CLOSED || eventSource.readyState === ReadyState.CONNECTING) {
observer.complete();
} else {
observer.error(e);
}
observer.error(e);
};
return () => {
eventSource.close();
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/shared/services/workflows-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class WorkflowsService {
requests
.get(this.getArtifactDownloadUrl(workflow, nodeId, container + '-logs', archived))
.then(resp => {
resp.text.split('\n').forEach(line => observer.next(line));
resp.text.split('\n').forEach(line => observer.next(JSON.stringify(line)));
})
.catch(err => observer.error(err));
// tslint:disable-next-line
Expand All @@ -79,8 +79,8 @@ export class WorkflowsService {

public getArtifactDownloadUrl(workflow: Workflow, nodeId: string, artifactName: string, archived: boolean) {
return archived
? `/artifacts-by-uid/${workflow.metadata.uid}/${nodeId}/${encodeURIComponent(artifactName)}?Authorization=${localStorage.getItem('token')}`
: `/artifacts/${workflow.metadata.namespace}/${workflow.metadata.name}/${nodeId}/${encodeURIComponent(artifactName)}?Authorization=${localStorage.getItem('token')}`;
? `artifacts-by-uid/${workflow.metadata.uid}/${nodeId}/${encodeURIComponent(artifactName)}?Authorization=${localStorage.getItem('token')}`
: `artifacts/${workflow.metadata.namespace}/${workflow.metadata.name}/${nodeId}/${encodeURIComponent(artifactName)}?Authorization=${localStorage.getItem('token')}`;
}

private queryParams(filter: {namespace?: string; name?: string; phases?: Array<string>}) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/workflows/components/workflow-artifacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const WorkflowArtifacts = (props: Props) => {
const items = nodeOutputs.artifacts || [];
return items.map(item =>
Object.assign({}, item, {
downloadUrl: services.workflows.getArtifactDownloadUrl(props.workflow, node.id, item.name, props.archived),
downloadUrl: '/' + services.workflows.getArtifactDownloadUrl(props.workflow, node.id, item.name, props.archived),
stepName: node.name,
dateCreated: node.finishedAt,
nodeName
Expand Down