Skip to content

Commit

Permalink
(ui) Fix status parser bug (#441)
Browse files Browse the repository at this point in the history
* fix runtime execution graph status parser bug

* remove logging

* Fix error when condition status is missing
  • Loading branch information
drewbutlerbb4 authored Jan 29, 2021
1 parent 7286c83 commit 43c895d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions frontend/src/lib/WorkflowParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class WorkflowParser {
for (const task of tasks) {
if (!statusMap.get(task['name'])) {
for (const condition of task['when'] || []) {
const param = this.decodeParam(condition['Input']);
const param = this.decodeParam(condition['input']);
if (param && param.task) {
if (statusMap.get(param.task)) {
conditionTasks.push(task['name']);
Expand Down Expand Up @@ -117,10 +117,10 @@ export default class WorkflowParser {

// Add all of this Task's conditional dependencies as Task dependencies
for (const condition of task['when'] || []) {
const param = this.decodeParam(condition['Input']);
const param = this.decodeParam(condition['input']);
if (param && param.task) {
if (statusMap.get(param.task)) {
const parentId = statusMap.get(param.task)!['status']['podName'];
const parentId = statusMap.get(param.task)!['status']['podName'] || statusMap.get(param.task)!['pipelineTaskName'];
edges.push({ parent: parentId, child: taskId });
}
}
Expand Down Expand Up @@ -208,7 +208,8 @@ export default class WorkflowParser {
const paramName = splitParam.param;
if (
statusMap.get(parentTask) &&
statusMap.get(parentTask)!['status']['conditions'][0]['type'] === 'Succeeded'
statusMap.get(parentTask)['status']['conditions'] &&
statusMap.get(parentTask)['status']['conditions'][0]['type'] === 'Succeeded'
) {
const parentId = statusMap.get(parentTask)!['status']['podName'];
edges.push({ parent: parentId, child: ownerTask === '' ? componentId : ownerTask });
Expand Down Expand Up @@ -259,7 +260,10 @@ export default class WorkflowParser {
}

public static getStatus(execStatus: any): NodePhase {
return execStatus!.status.conditions[0].reason;
if (execStatus && execStatus.status && execStatus.status.conditions) {
return execStatus!.status!.conditions![0].reason;
}
return NodePhase.PENDING
}

public static getParameters(workflow?: any): Parameter[] {
Expand Down

0 comments on commit 43c895d

Please sign in to comment.