8000 fix(ui): sidebar on node not refreshed in specific cases (#3213) · ovh/cds@0f86337 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 0f86337

Browse files
bnjjjyesnault
authored andcommitted
fix(ui): sidebar on node not refreshed in specific cases (#3213)
close #3190 Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
1 parent c8564fc commit 0f86337

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

ui/src/app/shared/workflow/node/wizard/node.wizard.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,13 @@ export class WorkflowNodeAddWizardComponent implements OnInit {
215215

216216
getPlatforms() {
217217
this.loadingPlatforms = true;
218+
if (!this.node.context.application_id) {
219+
return;
220+
}
218221
let app = this.project.application_names.find((a) => a.id === this.node.context.application_id);
222+
if (!app) {
223+
return;
224+
}
219225
this._appStore.getDeploymentStrategies(this.project.key, app.name).pipe(
220226
first(),
221227
finalize(() => this.loadingPlatforms = false)

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,20 @@ export class WorkflowNodeComponent implements OnInit {
5353
subSelect: Subscription;
5454

5555
selectedNodeID: number;
56+
ready = false;
5657

5758
constructor(
5859
private elementRef: ElementRef,
5960
private _workflowEventStore: WorkflowEventStore,
6061
private _router: Router,
6162
private _activatedRoute: ActivatedRoute,
6263
private _location: Location
63-
) {
64-
this._activatedRoute.queryParams.subscribe(params => {
65-
if (params['node_id']) {
66-
this.selectedNodeID = parseInt(params['node_id'], 10);
67-
}
68-
});
69-
}
64+
) { }
7065

7166
ngOnInit(): void {
67+
if (this._activatedRoute.snapshot.queryParams['node_id']) {
68+
this.selectedNodeID = parseInt(this._activatedRoute.snapshot.queryParams['node_id'], 10);
69+
}
7270
this.isSelected = this.selectedNodeID === this.node.id;
7371
this.subSelect = this._workflowEventStore.selectedNode().subscribe(n => {
7472
if (n && this.node) {
@@ -104,13 +102,21 @@ export class WorkflowNodeComponent implements OnInit {
104102
} else {
105103
this.workflowRun = null;
106104
}
107-
if (this.node && this.selectedNodeID && this.node.id === this.selectedNodeID) {
105+
106+
if (this._activatedRoute.snapshot.queryParams['node_id']) {
107+
this.selectedNodeID = parseInt(this._activatedRoute.snapshot.queryParams['node_id'], 10);
108+
}
109+
110+
if (!this.ready && this.node && this.selectedNodeID && this.node.id === this.selectedNodeID) {
108111
this._workflowEventStore.setSelectedNode(this.node, false);
109112
this._workflowEventStore.setSelectedNodeRun(this.currentNodeRun, false);
110113
}
114+
115+
111116
if (this.currentNodeRun && this.currentNodeRun.status === PipelineStatus.SUCCESS) {
112117
this.computeWarnings();
113118
}
119+
this.ready = true;
114120
});
115121

116122
if (!this.workflowRun) {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ export class WorkflowComponent implements OnInit {
137137
initSidebar(): void {
138138
// Mode of sidebar
139139
this.sideBarModeSubscription = this._sidebarStore.sidebarMode()
140-
.subscribe(m => this.sidebarMode = m);
140+
.subscribe(m => {
141+
setTimeout(() => this.sidebarMode = m, 0);
142+
});
141143
}
142144

143145
ngOnInit() {

0 commit comments

Comments
 (0)
0