8000 fix(ui): refresh workflow view when launching new workflow run (#4830) · ovh/cds@ac5272e · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit ac5272e

Browse files
bnjjjfsamin
authored andcommitted
fix(ui): refresh workflow view when launching new workflow run (#4830)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
1 parent cf4ee90 commit ac5272e

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

ui/src/app/views/workflow/graph/workflow.graph.component.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
import {
2-
AfterViewInit,
3-
ChangeDetectionStrategy,
4-
ChangeDetectorRef,
5-
Component,
6-
ComponentFactoryResolver,
7-
ComponentRef,
8-
EventEmitter,
9-
HostListener,
10-
Input,
11-
Output,
12-
ViewChild,
13-
ViewContainerRef
14-
} from '@angular/core';
1+
// tslint:disable-next-line: max-line-length
2+
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ComponentFactoryResolver, ComponentRef, EventEmitter, HostListener, Input, Output, ViewChild, ViewContainerRef } from '@angular/core';
153
import * as d3 from 'd3';
164
import * as dagreD3 from 'dagre-d3';
175
import { Project } from '../../../model/project.model';
@@ -100,7 +88,6 @@ export class WorkflowGraphComponent implements AfterViewInit {
10088
initWorkflow() {
10189
// https://github.com/cpettitt/dagre/wiki#configuring-the-layout
10290
this.g = new dagreD3.graphlib.Graph().setGraph({ rankdir: this.direction, nodesep: 10, ranksep: 15, edgesep: 5 });
103-
10491
// Create all nodes
10592
if (this.workflow.workflow_data && this.workflow.workflow_data.node) {
10693
this.createNode(this.workflow.workflow_data.node);
@@ -125,7 +112,10 @@ export class WorkflowGraphComponent implements AfterViewInit {
125112
WorkflowGraphComponent.minScale,
126113
WorkflowGraphComponent.maxScale
127114
]).on('zoom', () => {
128-
g.attr('transform', d3.event.transform);
115+
if (d3.event.transform && d3.event.transform.x && d3.event.transform.x !== Number.POSITIVE_INFINITY
116+
&& d3.event.transform.y && d3.event.transform.y !== Number.POSITIVE_INFINITY) {
117+
g.attr('transform', d3.event.transform);
118+
}
129119
});
130120

131121
this.svg.call(this.zoom);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class WorkflowRunComponent implements OnInit {
9999
if (!this.workflowRunData) {
100100
this.workflowRunData = {};
101101
}
102-
if (!this.workflowRunData['workflow']) {
102+
if (!this.workflowRunData['workflow'] || !this.workflowRunData['workflow'].workflow_data) {
103103
this.workflowRunData['workflow'] = s.workflowRun.workflow;
104104
this.workflowName = s.workflowRun.workflow.name;
105105
}

ui/src/app/views/workflow/run/workflow.run.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<app-workflow-run-summary [(direction)]="direction" [project]="project" [workflowName]="workflowName"
33
[class.above]="workflowRunData['status'] === pipelineStatusEnum.PENDING">
44
</app-workflow-run-summary>
5-
<ng-container *ngIf="workflowRunData['id'] !== pipelineStatusEnum.PENDING; else pendingBlock">
5+
<ng-container *ngIf="workflowRunData['status'] !== pipelineStatusEnum.PENDING; else pendingBlock">
66
<ng-container *ngIf="workflowRunData['workflow'] && workflowRunData['workflow'].workflow_data && !displayError">
77
<app-workflow-graph class="graph" [direction]="direction" [project]="project"
88
[workflowData]="workflowRunData['workflow']">

0 commit comments

Comments
 (0)
0