mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-19 11:45:12 +00:00
feat(console): email label policy, cleanup policy grid module (#890)
* add primitive label policy component, routing * label policy, i18n * refactor policy grid * i18n * lint * cleanup i19n policy * rm failed events styling * fix detail layout padding, de i18n * remove unused translations
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
</ng-container>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['policy.read']">
|
||||
<app-policy-grid></app-policy-grid>
|
||||
<app-policy-grid [type]="PolicyGridType.ORG"></app-policy-grid>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
||||
import { ChangeType } from 'src/app/modules/changes/changes.component';
|
||||
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
|
||||
import { PolicyGridType } from 'src/app/modules/policy-grid/policy-grid.component';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
import {
|
||||
Org,
|
||||
@@ -54,6 +55,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
public totalMemberResult: number = 0;
|
||||
public membersSubject: BehaviorSubject<OrgMemberView.AsObject[]>
|
||||
= new BehaviorSubject<OrgMemberView.AsObject[]>([]);
|
||||
public PolicyGridType: any = PolicyGridType;
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
|
||||
@@ -17,6 +17,7 @@ import { MemberCreateDialogModule } from 'src/app/modules/add-member-dialog/memb
|
||||
import { CardModule } from 'src/app/modules/card/card.module';
|
||||
import { ContributorsModule } from 'src/app/modules/contributors/contributors.module';
|
||||
import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module';
|
||||
import { PolicyGridModule } from 'src/app/modules/policy-grid/policy-grid.module';
|
||||
import { SharedModule } from 'src/app/modules/shared/shared.module';
|
||||
import { WarnDialogModule } from 'src/app/modules/warn-dialog/warn-dialog.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
@@ -26,10 +27,9 @@ import { AddDomainDialogModule } from './org-detail/add-domain-dialog/add-domain
|
||||
import { DomainVerificationComponent } from './org-detail/domain-verification/domain-verification.component';
|
||||
import { OrgDetailComponent } from './org-detail/org-detail.component';
|
||||
import { OrgsRoutingModule } from './orgs-routing.module';
|
||||
import { PolicyGridComponent } from './policy-grid/policy-grid.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [OrgDetailComponent, PolicyGridComponent, DomainVerificationComponent],
|
||||
declarations: [OrgDetailComponent, DomainVerificationComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
HasRolePipeModule,
|
||||
@@ -56,6 +56,7 @@ import { PolicyGridComponent } from './policy-grid/policy-grid.component';
|
||||
SharedModule,
|
||||
ContributorsModule,
|
||||
CopyToClipboardModule,
|
||||
PolicyGridModule,
|
||||
],
|
||||
})
|
||||
export class OrgsModule { }
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<h1>{{'ORG.POLICY.TITLE' | translate}}</h1>
|
||||
|
||||
<p class="top-desc">{{'ORG.POLICY.DESCRIPTION' | translate}}</p>
|
||||
|
||||
<div class="row-lyt">
|
||||
<ng-template appHasRole [appHasRole]="['iam.policy.read']">
|
||||
<div class="p-item card">
|
||||
<div class="avatar">
|
||||
<mat-icon class="icon" svgIcon="mdi_textbox_password"></mat-icon>
|
||||
</div>
|
||||
<div class="title">
|
||||
<span>{{'ORG.POLICY.PWD_COMPLEXITY.TITLE' | translate}}</span>
|
||||
<button mat-icon-button disabled>
|
||||
<i *ngIf="complexityPolicy" class="icon las la-check-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="desc">
|
||||
{{'ORG.POLICY.PWD_COMPLEXITY.DESCRIPTION' | translate}}</p>
|
||||
|
||||
<span class="fill-space"></span>
|
||||
<div class="btn-wrapper">
|
||||
<button [disabled]="!complexityPolicy" [routerLink]="[ 'policy', PolicyComponentType.COMPLEXITY ]"
|
||||
mat-stroked-button>{{'ORG.POLICY.BTN_EDIT' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['iam.policy.read']">
|
||||
<div class="p-item card">
|
||||
<div class="avatar">
|
||||
<i class="icon las la-gem"></i>
|
||||
</div>
|
||||
<div class="title">
|
||||
<span>{{'ORG.POLICY.IAM_POLICY.TITLE' | translate}}</span>
|
||||
<button mat-icon-button disabled>
|
||||
<i *ngIf="iamPolicy" class="icon las la-check-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="desc">
|
||||
{{'ORG.POLICY.IAM_POLICY.DESCRIPTION' | translate}}</p>
|
||||
|
||||
<span class="fill-space"></span>
|
||||
<div class="btn-wrapper">
|
||||
<ng-template appHasRole [appHasRole]="['iam.policy.write']">
|
||||
<button [disabled]="!iamPolicy" [routerLink]="[ 'policy', PolicyComponentType.IAM ]"
|
||||
mat-stroked-button>{{'ORG.POLICY.BTN_EDIT' | translate}}</button>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['policy.read']">
|
||||
<div class="p-item card">
|
||||
<div class="avatar">
|
||||
<i class="icon las la-gem"></i>
|
||||
</div>
|
||||
<div class="title">
|
||||
<span>{{'ORG.POLICY.LOGIN_POLICY.TITLE' | translate}}</span>
|
||||
<button mat-icon-button disabled>
|
||||
<i *ngIf="loginPolicy" class="icon las la-check-circle"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<ng-template #showDescIAM>
|
||||
<p class="desc">
|
||||
{{'ORG.POLICY.LOGIN_POLICY.DESCRIPTION' | translate}}</p>
|
||||
</ng-template>
|
||||
|
||||
<span class="fill-space"></span>
|
||||
<div class="btn-wrapper">
|
||||
<ng-template appHasRole [appHasRole]="['policy.write']">
|
||||
<button [disabled]="!loginPolicy" [routerLink]="[ 'policy', PolicyComponentType.LOGIN ]"
|
||||
mat-stroked-button>{{'ORG.POLICY.BTN_EDIT' | translate}}</button>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
@@ -1,75 +0,0 @@
|
||||
h1 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.top-desc {
|
||||
color: var(--grey);
|
||||
}
|
||||
|
||||
.row-lyt {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -1rem;
|
||||
|
||||
.p-item {
|
||||
flex-basis: 300px;
|
||||
margin: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 200px;
|
||||
padding: 1rem;
|
||||
|
||||
@media only screen and (max-width: 450px) {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(40deg, rgb(129, 85, 185) 30%, #8983f7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: .5rem;
|
||||
|
||||
.icon,
|
||||
i {
|
||||
font-size: 2.5rem;
|
||||
height: 2.5rem;
|
||||
line-height: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
span {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-left: 1rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: .9rem;
|
||||
color: var(--grey);
|
||||
}
|
||||
|
||||
.fill-space {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.btn-wrapper {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-right: 1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PolicyGridComponent } from './policy-grid.component';
|
||||
|
||||
describe('PolicyGridComponent', () => {
|
||||
let component: PolicyGridComponent;
|
||||
let fixture: ComponentFixture<PolicyGridComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PolicyGridComponent],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PolicyGridComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { PolicyComponentType } from 'src/app/modules/policies/policy-component-types.enum';
|
||||
import {
|
||||
LoginPolicyView,
|
||||
OrgIamPolicyView,
|
||||
PasswordComplexityPolicyView,
|
||||
PolicyState,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-policy-grid',
|
||||
templateUrl: './policy-grid.component.html',
|
||||
styleUrls: ['./policy-grid.component.scss'],
|
||||
})
|
||||
export class PolicyGridComponent {
|
||||
public complexityPolicy!: PasswordComplexityPolicyView.AsObject;
|
||||
public iamPolicy!: OrgIamPolicyView.AsObject;
|
||||
public loginPolicy!: LoginPolicyView.AsObject;
|
||||
|
||||
public PolicyState: any = PolicyState;
|
||||
public PolicyComponentType: any = PolicyComponentType;
|
||||
|
||||
constructor(
|
||||
public mgmtService: ManagementService,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
private getData(): void {
|
||||
this.mgmtService.GetPasswordComplexityPolicy().then(data => this.complexityPolicy = data.toObject()).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
this.mgmtService.GetMyOrgIamPolicy().then(data => this.iamPolicy = data.toObject());
|
||||
this.mgmtService.GetLoginPolicy().then(data => {
|
||||
this.loginPolicy = data.toObject();
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user