Skip to content

Commit

Permalink
fix(ui): Allow render of templates without entrypoint. Fixes argoproj…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Jun 23, 2020
1 parent f30c05c commit e1ce7f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {ClusterWorkflowTemplateSummaryPanel} from '../cluster-workflow-template-
require('../../../workflows/components/workflow-details/workflow-details.scss');

interface State {
namespace?: string;
template?: models.ClusterWorkflowTemplate;
error?: Error;
}
Expand All @@ -37,11 +38,13 @@ export class ClusterWorkflowTemplateDetails extends BasePage<RouteComponentProps
}

public componentDidMount(): void {
services.info
.getInfo()
.then(info => this.setState({namespace: info.managedNamespace || 'default'}))
.catch(error => this.setState(error));
services.clusterWorkflowTemplate
.get(this.name)
.then(template => {
this.setState({template});
})
.then(template => this.setState({template}))
.catch(error => this.setState({error}));
}

Expand Down Expand Up @@ -127,10 +130,10 @@ export class ClusterWorkflowTemplateDetails extends BasePage<RouteComponentProps
return {
metadata: {
generateName: template.metadata.name + '-',
namespace: '<enter the namespace>'
namespace: this.state.namespace
},
spec: {
entrypoint: template.spec.templates[0].name,
entrypoint: !!template.spec.templates ? template.spec.templates[0].name : '',
workflowTemplateRef: {
name: template.metadata.name,
clusterScope: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ export class WorkflowTemplateDetails extends BasePage<RouteComponentProps<any>,
public componentDidMount(): void {
services.workflowTemplate
.get(this.name, this.namespace)
.then(template => {
this.setState({template});
})
.then(template => this.setState({template}))
.catch(error => this.setState({error}));
}

Expand Down Expand Up @@ -134,7 +132,7 @@ export class WorkflowTemplateDetails extends BasePage<RouteComponentProps<any>,
namespace: template.metadata.namespace
},
spec: {
entrypoint: template.spec.templates[0].name,
entrypoint: !!template.spec.templates ? template.spec.templates[0].name : '',
workflowTemplateRef: {
name: template.metadata.name
}
Expand Down

0 comments on commit e1ce7f9

Please sign in to comment.