feat: console feature api (#1480)

This commit is contained in:
Max Peintner
2021-03-27 09:37:57 +01:00
committed by GitHub
parent c0b37924c8
commit 0a058a821e
70 changed files with 831 additions and 132 deletions
@@ -196,7 +196,6 @@ export class OrgCreateComponent {
name: ['', [Validators.required]],
});
console.log(this.orgForm);
} else {
this.createSteps = 2;
@@ -28,6 +28,23 @@
</app-card>
</ng-container>
<h2>{{'FEATURES.TITLE' | translate}}</h2>
<p class="top-desc">{{'FEATURES.DESCRIPTION' | translate}}</p>
<div *ngIf="features" class="tier">
<mat-icon>stars</mat-icon>
<div class="text" *ngIf="features.tier">
<p class="title"><strong>ZITADEL {{features.tier.name}}</strong></p>
<p>{{features.tier?.description}}</p>
<p>{{'FEATURES.TIERSTATES.'+features.tier.state | translate}}</p>
<p>{{features.tier?.statusInfo}}</p>
</div>
<span class="fill-space"></span>
<a class="ext" href="https://zitadel.ch/pricing" target="_blank"><i
class="las la-external-link-alt"></i></a>
<button mat-raised-button [routerLink]="['features']">{{'FEATURES.BTN-EDIT' | translate}}</button>
</div>
<ng-template appHasRole [appHasRole]="['policy.read']">
<app-policy-grid [type]="PolicyGridType.ORG"></app-policy-grid>
</ng-template>
@@ -2,11 +2,62 @@
margin-top: 0;
}
h2 {
font-size: 1.2rem;
letter-spacing: .05em;
text-transform: uppercase;
}
.top-desc {
color: var(--grey);
font-size: 14px;
}
.sub {
color: var(--grey);
margin-bottom: 2rem;
}
.tier {
display: flex;
flex-direction: row;
padding: 1rem;
border-radius: .5rem;
color: white;
background-color: rgb(245, 203, 99);
margin-bottom: .5rem;
.ext {
margin-right: .5rem;
align-self: center;
color: inherit;
}
mat-icon {
margin-right: 1rem;
font-size: 2rem;
}
.text {
display: flex;
flex-direction: column;
p {
margin: 0;
font-size: 14px;
}
.title {
font-size: 16px;
margin-bottom: .5rem;
}
}
.fill-space {
flex: 1;
}
}
.domain {
display: flex;
align-items: center;
@@ -10,6 +10,7 @@ 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 { Features } from 'src/app/proto/generated/zitadel/features_pb';
import { Member } from 'src/app/proto/generated/zitadel/member_pb';
import { Domain, Org, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
import { User } from 'src/app/proto/generated/zitadel/user_pb';
@@ -43,13 +44,17 @@ export class OrgDetailComponent implements OnInit {
= new BehaviorSubject<Member.AsObject[]>([]);
public PolicyGridType: any = PolicyGridType;
public features!: Features.AsObject;
constructor(
private dialog: MatDialog,
public translate: TranslateService,
public mgmtService: ManagementService,
private toast: ToastService,
private router: Router,
) { }
) {
}
public ngOnInit(): void {
this.getData();
@@ -65,12 +70,12 @@ export class OrgDetailComponent implements OnInit {
});
this.loadMembers();
this.loadDomains();
this.loadFeatures();
}
public loadDomains(): void {
this.mgmtService.listOrgDomains().then(result => {
this.domains = result.resultList;
console.log(this.domains);
this.primaryDomain = this.domains.find(domain => domain.isPrimary)?.domainName ?? '';
});
}
@@ -208,4 +213,13 @@ export class OrgDetailComponent implements OnInit {
this.membersSubject.next(members);
});
}
public loadFeatures(): void {
this.loadingSubject.next(true);
this.mgmtService.getFeatures().then(resp => {
if (resp.features) {
this.features = resp.features;
}
});
}
}
@@ -1,6 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { RoleGuard } from 'src/app/guards/role.guard';
import { FeatureServiceType } from 'src/app/modules/features/features.component';
import { PolicyComponentServiceType, PolicyComponentType } from 'src/app/modules/policies/policy-component-types.enum';
import { OrgCreateComponent } from './org-create/org-create.component';
@@ -39,6 +40,15 @@ const routes: Routes = [
},
],
},
{
path: 'features',
loadChildren: () => import('src/app/modules/features/features.module').then(m => m.FeaturesModule),
canActivate: [RoleGuard],
data: {
roles: ['features.read'],
serviceType: FeatureServiceType.MGMT,
},
},
{
path: 'policy',
children: [
@@ -15,6 +15,7 @@ import { HasRoleModule } from 'src/app/directives/has-role/has-role.module';
import { MemberCreateDialogModule } from 'src/app/modules/add-member-dialog/member-create-dialog.module';
import { CardModule } from 'src/app/modules/card/card.module';
import { ContributorsModule } from 'src/app/modules/contributors/contributors.module';
import { FeaturesModule } from 'src/app/modules/features/features.module';
import { InputModule } from 'src/app/modules/input/input.module';
import { MetaLayoutModule } from 'src/app/modules/meta-layout/meta-layout.module';
import { PolicyGridModule } from 'src/app/modules/policy-grid/policy-grid.module';
@@ -57,6 +58,7 @@ import { OrgsRoutingModule } from './orgs-routing.module';
ContributorsModule,
CopyToClipboardModule,
PolicyGridModule,
FeaturesModule,
],
})
export class OrgsModule { }