Skip to content

Commit d55dc71

Browse files
authored
fix(ui): commit list during manual run + navigation into subnum (#5118)
1 parent 7cba277 commit d55dc71

File tree

3 files changed

+31
-33
lines changed

3 files changed

+31
-33
lines changed

ui/src/app/shared/commit/commit.list.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
1+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core';
22
import { Select } from '@ngxs/store';
33
import { Commit } from 'app/model/repositories.model';
44
import { WorkflowNodeRun } from 'app/model/workflow.run.model';
@@ -19,7 +19,7 @@ export class CommitListComponent implements OnInit {
1919
@Select(WorkflowState.getSelectedNodeRun()) nodeRun$: Observable<WorkflowNodeRun>;
2020
nodeRunSubs: Subscription;
2121

22-
commits: Array<Commit>;
22+
@Input() commits: Array<Commit>;
2323
columns: Column<Commit>[];
2424

2525
constructor(private _cd: ChangeDetectorRef) {
@@ -64,10 +64,15 @@ export class CommitListComponent implements OnInit {
6464
}
6565

6666
ngOnInit(): void {
67+
// if commits are provided by input, do not look at the noderun
68+
if (this.commits && this.commits.length) {
69+
return;
70+
}
6771
this.nodeRunSubs = this.nodeRun$.subscribe(nr => {
6872
if (!nr) {
6973
return;
7074
}
75+
7176
if (this.commits && nr.commits && this.commits.length === nr.commits.length) {
7277
return;
7378
}

ui/src/app/views/workflow/run/node/history/history.component.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,10 @@ export class WorkflowNodeRunHistoryComponent implements OnInit {
5757
}
5858
},
5959
<Column<WorkflowNodeRun>>{
60-
type: ColumnType.ROUTER_LINK,
60+
type: ColumnType.TEXT,
6161
name: 'common_version',
6262
selector: (nodeRun: WorkflowNodeRun) => {
63-
let node = Workflow.getNodeByID(nodeRun.workflow_node_id, this.run.workflow);
64-
let url = this._router.createUrlTree([
65-
'/project',
66-
this.project.key,
67-
'workflow',
68-
this.workflowName,
69-
'run',
70-
nodeRun.num,
71-
'node',
72-
nodeRun.id
73-
], { queryParams: { sub: nodeRun.subnumber, name: Workflow.getPipeline(this.run.workflow, node).name } });
74-
return {
75-
link: url.toString(),
76-
value: `${nodeRun.num}.${nodeRun.subnumber}`
77-
};
63+
return `${nodeRun.num}.${nodeRun.subnumber}`;
7864
}
7965
},
8066
<Column<WorkflowNodeRun>>{
@@ -118,7 +104,10 @@ export class WorkflowNodeRunHistoryComponent implements OnInit {
118104

119105
goToSubNumber(nodeRun: WorkflowNodeRun): void {
120106
let node = Workflow.getNodeByID(nodeRun.workflow_node_id, this.run.workflow);
121-
this._router.navigate(['/project', this.project.key, 'workflow', this.workflowName, 'run', nodeRun.num, 'node',
122-
nodeRun.id], { queryParams: { sub: nodeRun.subnumber, name: Workflow.getPipeline(this.run.workflow, node).name } });
107+
this._router.navigate([
108+
'/project', this.project.key,
109+
'workflow', this.workflowName,
110+
'run', nodeRun.num,
111+
'node', nodeRun.id], { queryParams: { sub: nodeRun.subnumber, name: node.name } });
123112
}
124113
}

ui/src/app/views/workflow/run/node/workflow.run.node.component.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export class WorkflowNodeRunComponent implements OnInit {
5353
nbVuln = 0;
5454
deltaVul = 0;
5555

56+
paramsSub: Subscription;
57+
5658
constructor(
5759
private _store: Store,
5860
private _activatedRoute: ActivatedRoute,
@@ -79,19 +81,21 @@ export class WorkflowNodeRunComponent implements OnInit {
7981
let params = this._routerService.getRouteSnapshotParams({}, this._router.routerState.snapshot.root);
8082
this.workflowName = params['workflowName'];
8183

82-
let number = params['number'];
83-
let nodeRunId = params['nodeId'];
84-
85-
this._store.dispatch(new GetWorkflowRun({ projectKey: this.project.key, workflowName: this.workflowName, num: number }))
86-
.subscribe(() => {
87-
this._store.dispatch(
88-
new GetWorkflowNodeRun({
89-
projectKey: this.project.key,
90-
workflowName: this.workflowName,
91-
num: number,
92-
nodeRunID: nodeRunId
93-
}));
94-
});
84+
this.paramsSub = this._activatedRoute.params.subscribe(p => {
85+
if (p['nodeId'] === this.currentNodeRunID && p['number'] === this.currentNodeRunNum) {
86+
return;
87+
}
88+
this._store.dispatch(new GetWorkflowRun({ projectKey: this.project.key, workflowName: this.workflowName, num: p['number'] }))
89+
.subscribe(() => {
90+
this._store.dispatch(
91+
new GetWorkflowNodeRun({
92+
projectKey: this.project.key,
93+
workflowName: this.workflowName,
94+
num: p['number'],
95+
nodeRunID: p['nodeId']
96+
}));
97+
});
98+
});
9599
}
96100

97101
ngOnInit(): void {

0 commit comments

Comments
 (0)