diff --git a/ui/src/app/shared/commit/commit.list.component.ts b/ui/src/app/shared/commit/commit.list.component.ts index 75cc551622..bde66a391e 100644 --- a/ui/src/app/shared/commit/commit.list.component.ts +++ b/ui/src/app/shared/commit/commit.list.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit } from '@angular/core'; import { Select } from '@ngxs/store'; import { Commit } from 'app/model/repositories.model'; import { WorkflowNodeRun } from 'app/model/workflow.run.model'; @@ -19,7 +19,7 @@ export class CommitListComponent implements OnInit { @Select(WorkflowState.getSelectedNodeRun()) nodeRun$: Observable; nodeRunSubs: Subscription; - commits: Array; + @Input() commits: Array; columns: Column[]; constructor(private _cd: ChangeDetectorRef) { @@ -64,10 +64,15 @@ export class CommitListComponent implements OnInit { } ngOnInit(): void { + // if commits are provided by input, do not look at the noderun + if (this.commits && this.commits.length) { + return; + } this.nodeRunSubs = this.nodeRun$.subscribe(nr => { if (!nr) { return; } + if (this.commits && nr.commits && this.commits.length === nr.commits.length) { return; } diff --git a/ui/src/app/views/workflow/run/node/history/history.component.ts b/ui/src/app/views/workflow/run/node/history/history.component.ts index 4a4d098b7d..e89a9d1630 100644 --- a/ui/src/app/views/workflow/run/node/history/history.component.ts +++ b/ui/src/app/views/workflow/run/node/history/history.component.ts @@ -57,24 +57,10 @@ export class WorkflowNodeRunHistoryComponent implements OnInit { } }, >{ - type: ColumnType.ROUTER_LINK, + type: ColumnType.TEXT, name: 'common_version', selector: (nodeRun: WorkflowNodeRun) => { - let node = Workflow.getNodeByID(nodeRun.workflow_node_id, this.run.workflow); - let url = this._router.createUrlTree([ - '/project', - this.project.key, - 'workflow', - this.workflowName, - 'run', - nodeRun.num, - 'node', - nodeRun.id - ], { queryParams: { sub: nodeRun.subnumber, name: Workflow.getPipeline(this.run.workflow, node).name } }); - return { - link: url.toString(), - value: `${nodeRun.num}.${nodeRun.subnumber}` - }; + return `${nodeRun.num}.${nodeRun.subnumber}`; } }, >{ @@ -118,7 +104,10 @@ export class WorkflowNodeRunHistoryComponent implements OnInit { goToSubNumber(nodeRun: WorkflowNodeRun): void { let node = Workflow.getNodeByID(nodeRun.workflow_node_id, this.run.workflow); - this._router.navigate(['/project', this.project.key, 'workflow', this.workflowName, 'run', nodeRun.num, 'node', - nodeRun.id], { queryParams: { sub: nodeRun.subnumber, name: Workflow.getPipeline(this.run.workflow, node).name } }); + this._router.navigate([ + '/project', this.project.key, + 'workflow', this.workflowName, + 'run', nodeRun.num, + 'node', nodeRun.id], { queryParams: { sub: nodeRun.subnumber, name: node.name } }); } } diff --git a/ui/src/app/views/workflow/run/node/workflow.run.node.component.ts b/ui/src/app/views/workflow/run/node/workflow.run.node.component.ts index a032f513a7..f27871210a 100644 --- a/ui/src/app/views/workflow/run/node/workflow.run.node.component.ts +++ b/ui/src/app/views/workflow/run/node/workflow.run.node.component.ts @@ -53,6 +53,8 @@ export class WorkflowNodeRunComponent implements OnInit { nbVuln = 0; deltaVul = 0; + paramsSub: Subscription; + constructor( private _store: Store, private _activatedRoute: ActivatedRoute, @@ -79,19 +81,21 @@ export class WorkflowNodeRunComponent implements OnInit { let params = this._routerService.getRouteSnapshotParams({}, this._router.routerState.snapshot.root); this.workflowName = params['workflowName']; - let number = params['number']; - let nodeRunId = params['nodeId']; - - this._store.dispatch(new GetWorkflowRun({ projectKey: this.project.key, workflowName: this.workflowName, num: number })) - .subscribe(() => { - this._store.dispatch( - new GetWorkflowNodeRun({ - projectKey: this.project.key, - workflowName: this.workflowName, - num: number, - nodeRunID: nodeRunId - })); - }); + this.paramsSub = this._activatedRoute.params.subscribe(p => { + if (p['nodeId'] === this.currentNodeRunID && p['number'] === this.currentNodeRunNum) { + return; + } + this._store.dispatch(new GetWorkflowRun({ projectKey: this.project.key, workflowName: this.workflowName, num: p['number'] })) + .subscribe(() => { + this._store.dispatch( + new GetWorkflowNodeRun({ + projectKey: this.project.key, + workflowName: this.workflowName, + num: p['number'], + nodeRunID: p['nodeId'] + })); + }); + }); } ngOnInit(): void {