mirror of
https://github.com/zitadel/zitadel.git
synced 2025-10-20 12:22:25 +00:00
fix(console): policy reset for custom, header org filter, idp add dialog (#865)
* remove reset button if not default, rem load * dirty focus fix * use idptype in dialog * remove logs * lint * revert idp add changes * log error * lint
This commit is contained in:
@@ -165,6 +165,8 @@ export class LoginPolicyComponent implements OnDestroy {
|
||||
setTimeout(() => {
|
||||
this.fetchData();
|
||||
}, 2000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -183,10 +185,20 @@ export class LoginPolicyComponent implements OnDestroy {
|
||||
public removeIdp(idp: AdminIdpProviderView.AsObject | MgmtIdpProviderView.AsObject): void {
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
(this.service as ManagementService).RemoveIdpProviderFromLoginPolicy(idp.idpConfigId);
|
||||
(this.service as ManagementService).RemoveIdpProviderFromLoginPolicy(idp.idpConfigId).then(() => {
|
||||
const index = this.idps.findIndex(temp => temp === idp);
|
||||
if (index > -1) {
|
||||
this.idps.splice(index, 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case PolicyComponentServiceType.ADMIN:
|
||||
(this.service as AdminService).RemoveIdpProviderFromDefaultLoginPolicy(idp.idpConfigId);
|
||||
(this.service as AdminService).RemoveIdpProviderFromDefaultLoginPolicy(idp.idpConfigId).then(() => {
|
||||
const index = this.idps.findIndex(temp => temp === idp);
|
||||
if (index > -1) {
|
||||
this.idps.splice(index, 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
<p class="default" *ngIf="isDefault"> {{'ORG.POLICY.DEFAULTLABEL' | translate}}</p>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['iam.policy.delete']">
|
||||
<button *ngIf="serviceType === PolicyComponentServiceType.MGMT" matTooltip="{{'ORG.POLICY.RESET' | translate}}"
|
||||
color="warn" (click)="removePolicy()" mat-stroked-button>
|
||||
<button *ngIf="serviceType === PolicyComponentServiceType.MGMT && !isDefault"
|
||||
matTooltip="{{'ORG.POLICY.RESET' | translate}}" color="warn" (click)="removePolicy()" mat-stroked-button>
|
||||
{{'ORG.POLICY.RESET' | translate}}
|
||||
</button>
|
||||
</ng-template>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<app-detail-layout [backRouterLink]="[ serviceType === PolicyComponentServiceType.ADMIN ? '/iam' : '/org']"
|
||||
[title]="'ORG.POLICY.PWD_AGE.TITLE' | translate" [description]="'ORG.POLICY.PWD_AGE.DESCRIPTION' | translate">
|
||||
<ng-template appHasRole [appHasRole]="['policy.delete']">
|
||||
<button *ngIf="serviceType === PolicyComponentServiceType.MGMT" matTooltip="{{'ORG.POLICY.RESET' | translate}}"
|
||||
color="warn" (click)="removePolicy()" mat-stroked-button>
|
||||
<button *ngIf="serviceType === PolicyComponentServiceType.MGMT && !isDefault"
|
||||
matTooltip="{{'ORG.POLICY.RESET' | translate}}" color="warn" (click)="removePolicy()" mat-stroked-button>
|
||||
{{'ORG.POLICY.RESET' | translate}}
|
||||
</button>
|
||||
</ng-template>
|
||||
|
@@ -112,7 +112,6 @@ export class PasswordAgePolicyComponent implements OnDestroy {
|
||||
this.ageData.expireWarnDays,
|
||||
).then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.SET', true);
|
||||
this.getData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -122,7 +121,6 @@ export class PasswordAgePolicyComponent implements OnDestroy {
|
||||
this.ageData.expireWarnDays,
|
||||
).then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.SET', true);
|
||||
this.getData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -134,12 +132,18 @@ export class PasswordAgePolicyComponent implements OnDestroy {
|
||||
this.ageData.expireWarnDays,
|
||||
).then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.SET', true);
|
||||
this.getData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public get isDefault(): boolean {
|
||||
if (this.ageData && this.serviceType === PolicyComponentServiceType.MGMT) {
|
||||
return (this.ageData as PasswordAgePolicyView.AsObject).pb_default;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,8 +4,8 @@
|
||||
<p class="default" *ngIf="isDefault"> {{'ORG.POLICY.DEFAULTLABEL' | translate}}</p>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['policy.delete']">
|
||||
<button *ngIf="serviceType === PolicyComponentServiceType.MGMT" matTooltip="{{'ORG.POLICY.RESET' | translate}}"
|
||||
color="warn" (click)="removePolicy()" mat-stroked-button>
|
||||
<button *ngIf="serviceType === PolicyComponentServiceType.MGMT && !isDefault"
|
||||
matTooltip="{{'ORG.POLICY.RESET' | translate}}" color="warn" (click)="removePolicy()" mat-stroked-button>
|
||||
{{'ORG.POLICY.RESET' | translate}}
|
||||
</button>
|
||||
</ng-template>
|
||||
|
@@ -45,11 +45,7 @@ export class PasswordLockoutPolicyComponent implements OnDestroy {
|
||||
|
||||
return this.route.params;
|
||||
})).subscribe(() => {
|
||||
this.getData().then(data => {
|
||||
if (data) {
|
||||
this.lockoutData = data.toObject() as PasswordLockoutPolicyView.AsObject;
|
||||
}
|
||||
});
|
||||
this.fetchData();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,6 +53,14 @@ export class PasswordLockoutPolicyComponent implements OnDestroy {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
private fetchData(): void {
|
||||
this.getData().then(data => {
|
||||
if (data) {
|
||||
this.lockoutData = data.toObject() as PasswordLockoutPolicyView.AsObject;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private getData(): Promise<PasswordLockoutPolicyView | DefaultPasswordLockoutPolicyView> {
|
||||
switch (this.serviceType) {
|
||||
case PolicyComponentServiceType.MGMT:
|
||||
@@ -70,9 +74,7 @@ export class PasswordLockoutPolicyComponent implements OnDestroy {
|
||||
if (this.service instanceof ManagementService) {
|
||||
this.service.RemovePasswordLockoutPolicy().then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.RESETSUCCESS', true);
|
||||
setTimeout(() => {
|
||||
this.getData();
|
||||
}, 1000);
|
||||
this.fetchData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -99,7 +101,6 @@ export class PasswordLockoutPolicyComponent implements OnDestroy {
|
||||
this.lockoutData.showLockoutFailure,
|
||||
).then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.SET', true);
|
||||
this.getData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -110,7 +111,6 @@ export class PasswordLockoutPolicyComponent implements OnDestroy {
|
||||
this.lockoutData.showLockoutFailure,
|
||||
).then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.SET', true);
|
||||
this.getData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
@@ -120,7 +120,6 @@ export class PasswordLockoutPolicyComponent implements OnDestroy {
|
||||
this.lockoutData.showLockoutFailure,
|
||||
).then(() => {
|
||||
this.toast.showInfo('ORG.POLICY.TOAST.SET', true);
|
||||
this.getData();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
Reference in New Issue
Block a user