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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 70 additions and 14 deletions

View File

@ -13,7 +13,7 @@
<th class="availability" mat-header-cell *matHeaderCellDef> <th class="availability" mat-header-cell *matHeaderCellDef>
<span>{{ 'IDP.AVAILABILITY' | translate }}</span> <span>{{ 'IDP.AVAILABILITY' | translate }}</span>
</th> </th>
<td class="availability" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer availability" mat-cell *matCellDef="let idp">
<i <i
matTooltip="{{ 'IDP.AVAILABLE' | translate }}" matTooltip="{{ 'IDP.AVAILABLE' | translate }}"
*ngIf="isEnabled(idp) && idp.state === IDPState.IDP_STATE_ACTIVE" *ngIf="isEnabled(idp) && idp.state === IDPState.IDP_STATE_ACTIVE"
@ -29,14 +29,14 @@
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>{{ 'IDP.NAME' | translate }}</th> <th mat-header-cell *matHeaderCellDef>{{ 'IDP.NAME' | translate }}</th>
<td class="pointer" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer" mat-cell *matCellDef="let idp">
<span>{{ idp?.name }}</span> <span>{{ idp?.name }}</span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="type"> <ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef>{{ 'IDP.TYPE' | translate }}</th> <th mat-header-cell *matHeaderCellDef>{{ 'IDP.TYPE' | translate }}</th>
<td class="pointer" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer" mat-cell *matCellDef="let idp">
<div [ngSwitch]="idp.type"> <div [ngSwitch]="idp.type">
<div class="idp-table-provider-type" *ngSwitchCase="ProviderType.PROVIDER_TYPE_AZURE_AD"> <div class="idp-table-provider-type" *ngSwitchCase="ProviderType.PROVIDER_TYPE_AZURE_AD">
<img class="idp-logo" src="./assets/images/idp/ms.svg" alt="azure ad" /> <img class="idp-logo" src="./assets/images/idp/ms.svg" alt="azure ad" />
@ -87,7 +87,7 @@
<ng-container matColumnDef="state"> <ng-container matColumnDef="state">
<th mat-header-cell *matHeaderCellDef>{{ 'IDP.STATE' | translate }}</th> <th mat-header-cell *matHeaderCellDef>{{ 'IDP.STATE' | translate }}</th>
<td class="pointer" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer" mat-cell *matCellDef="let idp">
<span <span
class="state" class="state"
[ngClass]="{ [ngClass]="{
@ -101,21 +101,21 @@
<ng-container matColumnDef="creationDate"> <ng-container matColumnDef="creationDate">
<th mat-header-cell *matHeaderCellDef>{{ 'IDP.CREATIONDATE' | translate }}</th> <th mat-header-cell *matHeaderCellDef>{{ 'IDP.CREATIONDATE' | translate }}</th>
<td class="pointer" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer" mat-cell *matCellDef="let idp">
<span>{{ idp.details.creationDate | timestampToDate | localizedDate : 'dd. MMM, HH:mm' }}</span> <span>{{ idp.details.creationDate | timestampToDate | localizedDate : 'dd. MMM, HH:mm' }}</span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="changeDate"> <ng-container matColumnDef="changeDate">
<th mat-header-cell *matHeaderCellDef>{{ 'IDP.CHANGEDATE' | translate }}</th> <th mat-header-cell *matHeaderCellDef>{{ 'IDP.CHANGEDATE' | translate }}</th>
<td class="pointer" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer" mat-cell *matCellDef="let idp">
<span>{{ idp.details.changeDate | timestampToDate | localizedDate : 'dd. MMM, HH:mm' }}</span> <span>{{ idp.details.changeDate | timestampToDate | localizedDate : 'dd. MMM, HH:mm' }}</span>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="owner"> <ng-container matColumnDef="owner">
<th mat-header-cell *matHeaderCellDef>{{ 'IDP.OWNER' | translate }}</th> <th mat-header-cell *matHeaderCellDef>{{ 'IDP.OWNER' | translate }}</th>
<td class="pointer" [routerLink]="routerLinkForRow(idp)" mat-cell *matCellDef="let idp"> <td class="pointer" mat-cell *matCellDef="let idp">
{{ 'IDP.OWNERTYPES.' + idp.owner | translate }} {{ 'IDP.OWNERTYPES.' + idp.owner | translate }}
</td> </td>
</ng-container> </ng-container>
@ -140,7 +140,7 @@
" "
mat-icon-button mat-icon-button
matTooltip="{{ 'IDP.SETAVAILABLE' | translate }}" matTooltip="{{ 'IDP.SETAVAILABLE' | translate }}"
(click)="addIdp(idp)" (click)="addIdp(idp); $event.stopPropagation()"
> >
<i class="las la-check-circle"></i> <i class="las la-check-circle"></i>
</button> </button>
@ -160,7 +160,7 @@
" "
mat-icon-button mat-icon-button
matTooltip="{{ 'IDP.SETUNAVAILABLE' | translate }}" matTooltip="{{ 'IDP.SETUNAVAILABLE' | translate }}"
(click)="removeIdp(idp)" (click)="removeIdp(idp); $event.stopPropagation()"
> >
<i class="las la-times-circle"></i> <i class="las la-times-circle"></i>
</button> </button>
@ -185,7 +185,7 @@
mat-icon-button mat-icon-button
color="warn" color="warn"
matTooltip="{{ 'ACTIONS.REMOVE' | translate }}" matTooltip="{{ 'ACTIONS.REMOVE' | translate }}"
(click)="deleteIdp(idp)" (click)="deleteIdp(idp); $event.stopPropagation()"
> >
<i class="las la-trash"></i> <i class="las la-trash"></i>
</button> </button>
@ -194,7 +194,7 @@
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns"></tr> <tr class="highlight" (click)="navigateToIDP(row)" mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table> </table>
</div> </div>

View File

@ -2,7 +2,7 @@ import { SelectionModel } from '@angular/cdk/collections';
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog'; import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
import { MatLegacyTableDataSource as MatTableDataSource } from '@angular/material/legacy-table'; 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 { TranslateService } from '@ngx-translate/core';
import { Duration } from 'google-protobuf/google/protobuf/duration_pb'; import { Duration } from 'google-protobuf/google/protobuf/duration_pb';
import { BehaviorSubject, Observable } from 'rxjs'; 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 { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.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 { PageEvent, PaginatorComponent } from '../paginator/paginator.component';
import { PolicyComponentServiceType } from '../policies/policy-component-types.enum'; import { PolicyComponentServiceType } from '../policies/policy-component-types.enum';
import { WarnDialogComponent } from '../warn-dialog/warn-dialog.component'; import { WarnDialogComponent } from '../warn-dialog/warn-dialog.component';
@ -60,7 +62,13 @@ export class IdpTableComponent implements OnInit {
public IDPStylingType: any = IDPStylingType; public IDPStylingType: any = IDPStylingType;
public loginPolicy!: LoginPolicy.AsObject; 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.selection.changed.subscribe(() => {
this.changedSelection.emit(this.selection.selected); 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[]> { private async getIdps(): Promise<IDPLoginPolicyLink.AsObject[]> {
switch (this.serviceType) { switch (this.serviceType) {
case PolicyComponentServiceType.MGMT: case PolicyComponentServiceType.MGMT:

View File

@ -66,3 +66,17 @@ export const OrgContextChangedWorkflowOverlays: CnslOverlay[] = [
}, },
}, },
]; ];
export const ContextChangedWorkflowOverlays: CnslOverlay[] = [
{
id: 'contextswitcher',
origin: 'orgbutton',
toHighlight: ['orgbutton'],
content: {
i18nText: 'OVERLAYS.SWITCHEDTOINSTANCE.TEXT',
},
requirements: {
permission: ['iam.read'],
},
},
];

View File

@ -204,6 +204,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "Achtung! Soeben wurde die Organisation gewechselt." "TEXT": "Achtung! Soeben wurde die Organisation gewechselt."
},
"SWITCHEDTOINSTANCE": {
"TEXT": "Soeben wurde die Ansicht auf Instanz gewechselt."
} }
}, },
"FILTER": { "FILTER": {

View File

@ -204,7 +204,10 @@
"TEXT": "This navigation changes based on your selected organization above or your instance" "TEXT": "This navigation changes based on your selected organization above or your instance"
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "Attention! The organization context has changed." "TEXT": "The organization context has changed."
},
"SWITCHEDTOINSTANCE": {
"TEXT": "The view just changed to instance!"
} }
}, },
"FILTER": { "FILTER": {

View File

@ -205,6 +205,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "¡Atención! El contexto de la organización ha cambiado." "TEXT": "¡Atención! El contexto de la organización ha cambiado."
},
"SWITCHEDTOINSTANCE": {
"TEXT": "¡La vista acaba de cambiar a instancia!"
} }
}, },
"FILTER": { "FILTER": {

View File

@ -204,6 +204,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "Attention ! Le contexte de l'organisation a changé." "TEXT": "Attention ! Le contexte de l'organisation a changé."
},
"SWITCHEDTOINSTANCE": {
"TEXT": "La vue vient de changer en instance !"
} }
}, },
"FILTER": { "FILTER": {

View File

@ -204,6 +204,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "Attenzione! L'organizzazione è appena stata cambiata." "TEXT": "Attenzione! L'organizzazione è appena stata cambiata."
},
"SWITCHEDTOINSTANCE": {
"TEXT": "La visualizzazione è appena stata modificata in istanza!"
} }
}, },
"FILTER": { "FILTER": {

View File

@ -205,6 +205,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "注意! 組織のコンテキストが変更されました。" "TEXT": "注意! 組織のコンテキストが変更されました。"
},
"SWITCHEDTOINSTANCE": {
"TEXT": "ビューがインスタンスに変更されました。"
} }
}, },
"FILTER": { "FILTER": {

View File

@ -204,6 +204,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "Uwaga! Kontekst organizacji uległ zmianie." "TEXT": "Uwaga! Kontekst organizacji uległ zmianie."
},
"SWITCHEDTOINSTANCE": {
"TEXT": "Widok właśnie zmienił się na instancję!"
} }
}, },
"FILTER": { "FILTER": {

View File

@ -204,6 +204,9 @@
}, },
"CONTEXTCHANGED": { "CONTEXTCHANGED": {
"TEXT": "注意!组织环境发生了变化。" "TEXT": "注意!组织环境发生了变化。"
},
"SWITCHEDTOINSTANCE": {
"TEXT": "视图刚刚更改为实例!"
} }
}, },
"FILTER": { "FILTER": {