Skip to content

Commit

Permalink
fix(ui): sidebar on node not refreshed in specific cases (#3213)
Browse files Browse the repository at this point in the history
close #3190
Signed-off-by: Benjamin Coenen <[email protected]>
  • Loading branch information
bnjjj authored and yesnault committed Aug 16, 2018
1 parent c8564fc commit 0f86337
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ export class WorkflowNodeAddWizardComponent implements OnInit {

getPlatforms() {
this.loadingPlatforms = true;
if (!this.node.context.application_id) {
return;
}
let app = this.project.application_names.find((a) => a.id === this.node.context.application_id);
if (!app) {
return;
}
this._appStore.getDeploymentStrategies(this.project.key, app.name).pipe(
first(),
finalize(() => this.loadingPlatforms = false)
Expand Down
22 changes: 14 additions & 8 deletions ui/src/app/shared/workflow/node/workflow.node.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,20 @@ export class WorkflowNodeComponent implements OnInit {
subSelect: Subscription;

selectedNodeID: number;
ready = false;

constructor(
private elementRef: ElementRef,
private _workflowEventStore: WorkflowEventStore,
private _router: Router,
private _activatedRoute: ActivatedRoute,
private _location: Location
) {
this._activatedRoute.queryParams.subscribe(params => {
if (params['node_id']) {
this.selectedNodeID = parseInt(params['node_id'], 10);
}
});
}
) { }

ngOnInit(): void {
if (this._activatedRoute.snapshot.queryParams['node_id']) {
this.selectedNodeID = parseInt(this._activatedRoute.snapshot.queryParams['node_id'], 10);
}
this.isSelected = this.selectedNodeID === this.node.id;
this.subSelect = this._workflowEventStore.selectedNode().subscribe(n => {
if (n && this.node) {
Expand Down Expand Up @@ -104,13 +102,21 @@ export class WorkflowNodeComponent implements OnInit {
} else {
this.workflowRun = null;
}
if (this.node && this.selectedNodeID && this.node.id === this.selectedNodeID) {

if (this._activatedRoute.snapshot.queryParams['node_id']) {
this.selectedNodeID = parseInt(this._activatedRoute.snapshot.queryParams['node_id'], 10);
}

if (!this.ready && this.node && this.selectedNodeID && this.node.id === this.selectedNodeID) {
this._workflowEventStore.setSelectedNode(this.node, false);
this._workflowEventStore.setSelectedNodeRun(this.currentNodeRun, false);
}


if (this.currentNodeRun && this.currentNodeRun.status === PipelineStatus.SUCCESS) {
this.computeWarnings();
}
this.ready = true;
});

if (!this.workflowRun) {
Expand Down
4 changes: 3 additions & 1 deletion ui/src/app/views/workflow/workflow.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export class WorkflowComponent implements OnInit {
initSidebar(): void {
// Mode of sidebar
this.sideBarModeSubscription = this._sidebarStore.sidebarMode()
.subscribe(m => this.sidebarMode = m);
.subscribe(m => {
setTimeout(() => this.sidebarMode = m, 0);
});
}

ngOnInit() {
Expand Down

0 comments on commit 0f86337

Please sign in to comment.