Skip to content

Commit

Permalink
feat(ui): add link to go to workflow for an outgoing hook workflow (#…
Browse files Browse the repository at this point in the history
…3757)

Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and yesnault committed Dec 21, 2018
1 parent feb6221 commit b7f6df3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ <h3 class="ui header ml5">
*ngIf="currentWorkflowNodeRun && (currentWorkflowNodeRun?.status === pipelineStatusEnum.BUILDING || currentWorkflowNodeRun?.status === pipelineStatusEnum.WAITING)">
<i class="stop icon"></i>
</button>
<ng-container *ngIf="node.context && node.context.pipeline_id" >
<ng-container *ngIf="(node.context && node.context.pipeline_id)
|| (node.type === wNodeType.OUTGOINGHOOK && currentWorkflowNodeRun?.status === pipelineStatusEnum.SUCCESS && node.outgoing_hook && node.outgoing_hook.config['target_workflow'])">
<button class="ui icon blue button" [class.disabled]="!currentWorkflowNodeRun" [title]="'btn_logs' | translate" (click)="displayLogs()">
<i class="file text icon"></i>
</button>
</ng-container>

</div>
</div>
<ng-container *ngIf="currentWorkflowNodeRun && currentWorkflowRun">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class WorkflowSidebarRunNodeComponent implements OnDestroy, OnInit {

node: WNode;
subNode: Subscription;
wNodeType = WNodeType;

// Modal
@ViewChild('workflowRunNode')
Expand Down Expand Up @@ -131,11 +132,25 @@ export class WorkflowSidebarRunNodeComponent implements OnDestroy, OnInit {
}

displayLogs() {
this._router.navigate([
'/project', this.project.key,
'workflow', this.workflow.name,
'run', this.currentWorkflowRun.num,
'node', this.currentWorkflowNodeRun.id], { queryParams: { name: this.node.name}});
switch (this.node.type) {
case WNodeType.OUTGOINGHOOK:
if (this.currentWorkflowNodeRun && this.node && this.node.outgoing_hook
&& this.node.outgoing_hook.config['target_workflow']) {
this._router.navigate([
'/project', this.project.key,
'workflow', this.node.outgoing_hook.config['target_workflow'].value,
'run', this.currentWorkflowNodeRun.callback.workflow_run_number
], { queryParams: {} });
}
break;
default:
this._router.navigate([
'/project', this.project.key,
'workflow', this.workflow.name,
'run', this.currentWorkflowRun.num,
'node', this.currentWorkflowNodeRun.id], { queryParams: { name: this.node.name } });
}

}

getDuration() {
Expand Down
14 changes: 13 additions & 1 deletion ui/src/app/shared/workflow/wnode/wnode.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,20 @@ export class WorkflowWNodeComponent implements OnInit {
'/project', this.project.key,
'pipeline', Workflow.getPipeline(this.workflow, this.node).name
], {queryParams: {workflow: this.workflow.name, node_id: this.node.id, node_ref: this.node.ref}});
break;
}
break;
case WNodeType.OUTGOINGHOOK:
if (this._workflowEventStore.isRunSelected()
&& this.currentNodeRun
&& this.node.outgoing_hook.config['target_workflow']
&& this.currentNodeRun.callback) {
this._router.navigate([
'/project', this.project.key,
'workflow', this.node.outgoing_hook.config['target_workflow'].value,
'run', this.currentNodeRun.callback.workflow_run_number
], { queryParams: {} });
}
break;
}
}

Expand Down

0 comments on commit b7f6df3

Please sign in to comment.