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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ui/src/app/shared/commit/commit.list.component.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -19,7 +19,7 @@ export class CommitListComponent implements OnInit {
@Select(WorkflowState.getSelectedNodeRun()) nodeRun$: Observable<WorkflowNodeRun>;
nodeRunSubs: Subscription;

commits: Array<Commit>;
@Input() commits: Array<Commit>;
columns: Column<Commit>[];

constructor(private _cd: ChangeDetectorRef) {
Expand Down Expand Up @@ -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;
}
Expand Down
25 changes: 7 additions & 18 deletions ui/src/app/views/workflow/run/node/history/history.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,10 @@ export class WorkflowNodeRunHistoryComponent implements OnInit {
}
},
<Column<WorkflowNodeRun>>{
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}`;
}
},
<Column<WorkflowNodeRun>>{
Expand Down Expand Up @@ -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 } });
}
}
30 changes: 17 additions & 13 deletions ui/src/app/views/workflow/run/node/workflow.run.node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export class WorkflowNodeRunComponent implements OnInit {
nbVuln = 0;
deltaVul = 0;

paramsSub: Subscription;

constructor(
private _store: Store,
private _activatedRoute: ActivatedRoute,
Expand All @@ -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 {
Expand Down