fix(console): show warn dialog when view switched to instance (#5935)

fix: show warn dialog when changed to instance
This commit is contained in:
Max Peintner
2023-05-26 14:27:56 +02:00
committed by GitHub
parent 9aed0319c5
commit 6c90f088d2
11 changed files with 70 additions and 14 deletions
@@ -2,7 +2,7 @@ import { SelectionModel } from '@angular/cdk/collections';
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
import { MatLegacyTableDataSource as MatTableDataSource } from '@angular/material/legacy-table';
import { RouterLink } from '@angular/router';
import { Router, RouterLink } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Duration } from 'google-protobuf/google/protobuf/duration_pb';
import { BehaviorSubject, Observable } from 'rxjs';
@@ -31,6 +31,8 @@ import { AdminService } from 'src/app/services/admin.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { OverlayWorkflowService } from 'src/app/services/overlay/overlay-workflow.service';
import { ContextChangedWorkflowOverlays } from 'src/app/services/overlay/workflows';
import { PageEvent, PaginatorComponent } from '../paginator/paginator.component';
import { PolicyComponentServiceType } from '../policies/policy-component-types.enum';
import { WarnDialogComponent } from '../warn-dialog/warn-dialog.component';
@@ -60,7 +62,13 @@ export class IdpTableComponent implements OnInit {
public IDPStylingType: any = IDPStylingType;
public loginPolicy!: LoginPolicy.AsObject;
constructor(public translate: TranslateService, private toast: ToastService, private dialog: MatDialog) {
constructor(
private workflowService: OverlayWorkflowService,
public translate: TranslateService,
private toast: ToastService,
private dialog: MatDialog,
private router: Router,
) {
this.selection.changed.subscribe(() => {
this.changedSelection.emit(this.selection.selected);
});
@@ -241,6 +249,16 @@ export class IdpTableComponent implements OnInit {
}
}
navigateToIDP(row: Provider.AsObject) {
this.router.navigate(this.routerLinkForRow(row)).then(() => {
if (this.serviceType === PolicyComponentServiceType.MGMT && row.owner === IDPOwnerType.IDP_OWNER_TYPE_SYSTEM) {
setTimeout(() => {
this.workflowService.startWorkflow(ContextChangedWorkflowOverlays, null);
}, 1000);
}
});
}
private async getIdps(): Promise<IDPLoginPolicyLink.AsObject[]> {
switch (this.serviceType) {
case PolicyComponentServiceType.MGMT: