Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7f6df3

Browse files
bnjjjyesnault
authored andcommitted
feat(ui): add link to go to workflow for an outgoing hook workflow (#3757)
Signed-off-by: Benjamin Coenen <[email protected]>
1 parent feb6221 commit b7f6df3

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

ui/src/app/shared/workflow/sidebar/run-node/workflow.sidebar.run.node.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ <h3 class="ui header ml5">
3636
*ngIf="currentWorkflowNodeRun && (currentWorkflowNodeRun?.status === pipelineStatusEnum.BUILDING || currentWorkflowNodeRun?.status === pipelineStatusEnum.WAITING)">
3737
<i class="stop icon"></i>
3838
</button>
39-
<ng-container *ngIf="node.context && node.context.pipeline_id" >
39+
<ng-container *ngIf="(node.context && node.context.pipeline_id)
40+
|| (node.type === wNodeType.OUTGOINGHOOK && currentWorkflowNodeRun?.status === pipelineStatusEnum.SUCCESS && node.outgoing_hook && node.outgoing_hook.config['target_workflow'])">
4041
<button class="ui icon blue button" [class.disabled]="!currentWorkflowNodeRun" [title]="'btn_logs' | translate" (click)="displayLogs()">
4142
<i class="file text icon"></i>
4243
</button>
4344
</ng-container>
44-
4545
</div>
4646
</div>
4747
<ng-container *ngIf="currentWorkflowNodeRun && currentWorkflowRun">

ui/src/app/shared/workflow/sidebar/run-node/workflow.sidebar.run.node.component.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export class WorkflowSidebarRunNodeComponent implements OnDestroy, OnInit {
3636

3737
node: WNode;
3838
subNode: Subscription;
39+
wNodeType = WNodeType;
3940

4041
// Modal
4142
@ViewChild('workflowRunNode')
@@ -131,11 +132,25 @@ export class WorkflowSidebarRunNodeComponent implements OnDestroy, OnInit {
131132
}
132133

133134
displayLogs() {
134-
this._router.navigate([
135-
'/project', this.project.key,
136-
'workflow', this.workflow.name,
137-
'run', this.currentWorkflowRun.num,
138-
'node', this.currentWorkflowNodeRun.id], { queryParams: { name: this.node.name}});
135+
switch (this.node.type) {
136+
case WNodeType.OUTGOINGHOOK:
137+
if (this.currentWorkflowNodeRun && this.node && this.node.outgoing_hook
138+
&& this.node.outgoing_hook.config['target_workflow']) {
139+
this._router.navigate([
140+
'/project', this.project.key,
141+
'workflow', this.node.outgoing_hook.config['target_workflow'].value,
142+
'run', this.currentWorkflowNodeRun.callback.workflow_run_number
143+
], { queryParams: {} });
144+
}
145+
break;
146+
default:
147+
this._router.navigate([
148+
'/project', this.project.key,
149+
'workflow', this.workflow.name,
150+
'run', this.currentWorkflowRun.num,
151+
'node', this.currentWorkflowNodeRun.id], { queryParams: { name: this.node.name } });
152+
}
153+
139154
}
140155

141156
getDuration() {

ui/src/app/shared/workflow/wnode/wnode.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,20 @@ export class WorkflowWNodeComponent implements OnInit {
111111
'/project', this.project.key,
112112
'pipeline', Workflow.getPipeline(this.workflow, this.node).name
113113
], {queryParams: {workflow: this.workflow.name, node_id: this.node.id, node_ref: this.node.ref}});
114-
break;
115114
}
115+
break;
116+
case WNodeType.OUTGOINGHOOK:
117+
if (this._workflowEventStore.isRunSelected()
118+
&& this.currentNodeRun
119+
&& this.node.outgoing_hook.config['target_workflow']
120+
&& this.currentNodeRun.callback) {
121+
this._router.navigate([
122+
'/project', this.project.key,
123+
'workflow', this.node.outgoing_hook.config['target_workflow'].value,
124+
'run', this.currentNodeRun.callback.workflow_run_number
125+
], { queryParams: {} });
126+
}
127+
break;
116128
}
117129
}
118130

0 commit comments

Comments
 (0)