mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-23 05:18:46 +00:00
feat: rehauled console (#3525)
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
00f7dbe875
commit
08ae39ae19
-19
@@ -1,19 +0,0 @@
|
||||
<span class="title" mat-dialog-title>{{'ORG.DOMAINS.ADD.TITLE' | translate}}</span>
|
||||
<div mat-dialog-content>
|
||||
<p class="desc"> {{'ORG.DOMAINS.ADD.DESCRIPTION' | translate}}</p>
|
||||
|
||||
<cnsl-form-field label="Domain" required="true" class="form-field" appearance="outline">
|
||||
<cnsl-label>Domain</cnsl-label>
|
||||
<input cnslInput [(ngModel)]="newdomain" />
|
||||
</cnsl-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions class="action">
|
||||
<button mat-button (click)="closeDialog()">
|
||||
{{'ACTIONS.CANCEL' | translate}}
|
||||
</button>
|
||||
|
||||
<button color="primary" mat-raised-button class="ok-button" [disabled]="!newdomain"
|
||||
(click)="closeDialogWithSuccess()">
|
||||
{{'ACTIONS.ADD' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
.title {
|
||||
font-size: 1.2rem;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: var(--grey);
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.action {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.ok-button {
|
||||
margin-left: .5rem;
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { AddDomainDialogComponent } from './add-domain-dialog.component';
|
||||
|
||||
describe('WarnDialogComponent', () => {
|
||||
let component: AddDomainDialogComponent;
|
||||
let fixture: ComponentFixture<AddDomainDialogComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AddDomainDialogComponent],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddDomainDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-add-domain-dialog',
|
||||
templateUrl: './add-domain-dialog.component.html',
|
||||
styleUrls: ['./add-domain-dialog.component.scss'],
|
||||
})
|
||||
export class AddDomainDialogComponent {
|
||||
public newdomain: string = '';
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<AddDomainDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
public closeDialogWithSuccess(): void {
|
||||
this.dialogRef.close(this.newdomain);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { InputModule } from 'src/app/modules/input/input.module';
|
||||
|
||||
import { AddDomainDialogComponent } from './add-domain-dialog.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AddDomainDialogComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
TranslateModule,
|
||||
MatButtonModule,
|
||||
InputModule,
|
||||
FormsModule,
|
||||
],
|
||||
})
|
||||
export class AddDomainDialogModule { }
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
<span class="title" mat-dialog-title>{{'ORG.PAGES.ORGDOMAIN.TITLE' | translate}} {{domain.domainName}}</span>
|
||||
<div mat-dialog-content>
|
||||
<p class="desc">{{ 'ORG.PAGES.ORGDOMAIN.VERIFICATION' | translate }}</p>
|
||||
|
||||
<p class="desc warn">{{ 'ORG.PAGES.ORGDOMAIN.VERIFICATION_VALIDATION_DESC' | translate }}</p>
|
||||
|
||||
|
||||
<p *ngIf="domain.validationType !== DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED && !(dns || http)"
|
||||
class="desc">
|
||||
{{'ORG.PAGES.ORGDOMAIN.VERIFICATION_VALIDATION_ONGOING' | translate: domain }}
|
||||
{{'ORG.PAGES.ORGDOMAIN.VERIFICATION_VALIDATION_ONGOING_TYPE' | translate}}
|
||||
{{'ORG.PAGES.ORGDOMAIN.TYPES.'+ domain.validationType | translate}}</p>
|
||||
<div *ngIf="domain.validationType !== DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED"
|
||||
class="btn-container">
|
||||
<button color="primary" type="submit" mat-raised-button *ngIf="!(dns || http)" (click)="validate()">
|
||||
{{ 'ACTIONS.VERIFY' | translate }}
|
||||
</button>
|
||||
<mat-spinner class="spinner" *ngIf="validating" diameter="20" mode="indeterminate"></mat-spinner>
|
||||
|
||||
<button *ngIf="!showNew" mat-stroked-button color="primary"
|
||||
(click)="showNew = true">{{'ORG.PAGES.ORGDOMAIN.REQUESTNEWTOKEN' | translate}}</button>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="showNew">
|
||||
<p>{{ 'ORG.PAGES.ORGDOMAIN.VERIFICATION_NEWTOKEN_TITLE' | translate }}</p>
|
||||
<p class="desc">{{ 'ORG.PAGES.ORGDOMAIN.VERIFICATION_NEWTOKEN_DESC' | translate }}</p>
|
||||
|
||||
<div class="btn-container" *ngIf="!(http || dns)">
|
||||
<button color="primary" mat-raised-button (click)="loadHttpToken()">HTTP</button>
|
||||
<button color="primary" mat-raised-button (click)="loadDnsToken()">DNS</button>
|
||||
</div>
|
||||
<div *ngIf="http">
|
||||
<p>HTTP TOKEN</p>
|
||||
<p class="entry">{{http?.url}}.txt</p>
|
||||
|
||||
<div class="btn-container">
|
||||
<button mat-stroked-button (click)="saveFile()" color="primary">{{ 'ORG.PAGES.DOWNLOAD_FILE' | translate
|
||||
}}</button>
|
||||
<button color="primary" class="verify-button" type="submit" mat-raised-button (click)="validate()">
|
||||
<span>{{ 'ACTIONS.VERIFY' | translate }}</span>
|
||||
</button>
|
||||
<mat-spinner class="spinner" *ngIf="validating" diameter="20" mode="indeterminate"></mat-spinner>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="dns">
|
||||
<p>DNS TOKEN</p>
|
||||
<div class="line" *ngIf="dns?.token">
|
||||
<p class="entry">{{dns?.token}}</p>
|
||||
<button color="primary" [disabled]="copied === data.clientSecret" matTooltip="copy to clipboard"
|
||||
cnslCopyToClipboard [valueToCopy]="dns.token" (copiedValue)="copied = $event" mat-icon-button>
|
||||
<i *ngIf="copied !== dns.token" class="las la-clipboard"></i>
|
||||
<i *ngIf="copied === dns.token" class="las la-clipboard-check"></i>
|
||||
</button>
|
||||
<button color="primary" type="submit" mat-raised-button class="verify-button" (click)="validate()">
|
||||
{{ 'ACTIONS.VERIFY' | translate }}
|
||||
</button>
|
||||
<mat-spinner class="spinner" *ngIf="validating" diameter="20" mode="indeterminate"></mat-spinner>
|
||||
</div>
|
||||
<p class="entry">{{dns?.url}}</p>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div mat-dialog-actions class="action">
|
||||
<button mat-button class="ok-button" (click)="closeDialog()">
|
||||
{{'ACTIONS.CLOSE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
.btn-container {
|
||||
display: flex;
|
||||
margin: -.5rem;
|
||||
align-items: center;
|
||||
|
||||
button {
|
||||
margin: 1rem .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
color: var(--grey);
|
||||
font-size: .9rem;
|
||||
|
||||
&.warn {
|
||||
color: rgb(201, 51, 72);
|
||||
}
|
||||
}
|
||||
|
||||
.entry {
|
||||
margin: .5rem 0;
|
||||
}
|
||||
|
||||
.line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
.ok-button {
|
||||
margin-left: .5rem;
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { DomainVerificationComponent } from './domain-verification.component';
|
||||
|
||||
describe('DomainVerificationComponent', () => {
|
||||
let component: DomainVerificationComponent;
|
||||
let fixture: ComponentFixture<DomainVerificationComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [DomainVerificationComponent],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DomainVerificationComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { GenerateOrgDomainValidationResponse } from 'src/app/proto/generated/zitadel/management_pb';
|
||||
import { Domain, DomainValidationType } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-domain-verification',
|
||||
templateUrl: './domain-verification.component.html',
|
||||
styleUrls: ['./domain-verification.component.scss'],
|
||||
})
|
||||
export class DomainVerificationComponent {
|
||||
public domain!: Domain.AsObject;
|
||||
|
||||
public DomainValidationType: any = DomainValidationType;
|
||||
|
||||
public http!: GenerateOrgDomainValidationResponse.AsObject;
|
||||
public dns!: GenerateOrgDomainValidationResponse.AsObject;
|
||||
|
||||
public copied: string = '';
|
||||
|
||||
public showNew: boolean = false;
|
||||
|
||||
public validating: boolean = false;
|
||||
constructor(
|
||||
private toast: ToastService,
|
||||
public dialogRef: MatDialogRef<DomainVerificationComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private mgmtService: ManagementService,
|
||||
) {
|
||||
this.domain = data.domain;
|
||||
if (this.domain.validationType === DomainValidationType.DOMAIN_VALIDATION_TYPE_UNSPECIFIED) {
|
||||
this.showNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
async loadHttpToken(): Promise<void> {
|
||||
this.mgmtService.generateOrgDomainValidation(
|
||||
this.domain.domainName,
|
||||
DomainValidationType.DOMAIN_VALIDATION_TYPE_HTTP).then((http) => {
|
||||
this.http = http;
|
||||
});
|
||||
}
|
||||
|
||||
async loadDnsToken(): Promise<void> {
|
||||
this.mgmtService.generateOrgDomainValidation(
|
||||
this.domain.domainName,
|
||||
DomainValidationType.DOMAIN_VALIDATION_TYPE_DNS).then((dns) => {
|
||||
this.dns = dns;
|
||||
});
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
public validate(): void {
|
||||
this.validating = true;
|
||||
this.mgmtService.validateOrgDomain(this.domain.domainName).then(() => {
|
||||
this.dialogRef.close(true);
|
||||
this.toast.showInfo('ORG.PAGES.ORGDOMAIN.VERIFICATION_SUCCESSFUL', true);
|
||||
this.validating = false;
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
this.validating = false;
|
||||
});
|
||||
}
|
||||
|
||||
public saveFile(): void {
|
||||
const blob = new Blob([this.http.token], { type: 'text/plain;charset=utf-8' });
|
||||
saveAs(blob, this.http.token + '.txt');
|
||||
}
|
||||
}
|
||||
@@ -1,87 +1,28 @@
|
||||
<cnsl-meta-layout>
|
||||
<div class="max-width-container">
|
||||
<h1 class="h1">{{org?.name}}</h1>
|
||||
<p class="sub">{{'ORG_DETAIL.DESCRIPTION' | translate}}</p>
|
||||
<ng-container *ngIf="(['org.write$'] | hasRole) as canwrite$">
|
||||
<cnsl-card title="{{ 'ORG.DOMAINS.TITLE' | translate }}"
|
||||
description="{{ 'ORG.DOMAINS.DESCRIPTION' | translate }}">
|
||||
<cnsl-top-view [hasBackButton]="false" title="{{org?.name}}" [isActive]="org?.state === OrgState.ORG_STATE_ACTIVE"
|
||||
[isInactive]="org?.state === OrgState.ORG_STATE_INACTIVE" [hasContributors]="true"
|
||||
stateTooltip="{{'ORG.STATE.'+org?.state | translate}}">
|
||||
<cnsl-contributors topContributors [totalResult]="totalMemberResult" [loading]="loading$ | async"
|
||||
[membersSubject]="membersSubject" title="{{ 'PROJECT.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.MEMBER.TITLEDESC' | translate }}" (addClicked)="openAddMember()"
|
||||
(showDetailClicked)="showDetail()" (refreshClicked)="loadMembers()" [disabled]="false">
|
||||
</cnsl-contributors>
|
||||
|
||||
<button class="icon-button" (click)="loadDomains()" card-actions mat-icon-button>
|
||||
<mat-icon class="icon">refresh</mat-icon>
|
||||
</button>
|
||||
<cnsl-info-row topContent *ngIf="org" [org]="org"></cnsl-info-row>
|
||||
</cnsl-top-view>
|
||||
<div class="max-width-container">
|
||||
<cnsl-meta-layout>
|
||||
<ng-container *ngIf="['features.read'] | hasRole | async">
|
||||
<h2 class="org-subtitle">{{'FEATURES.TITLE' | translate}}</h2>
|
||||
<p class="org-top-desc cnsl-secondary-text">{{'FEATURES.DESCRIPTION' | translate}}</p>
|
||||
<cnsl-zitadel-tier [features]="features"></cnsl-zitadel-tier>
|
||||
</ng-container>
|
||||
|
||||
<div *ngFor="let domain of domains" class="domain">
|
||||
<span *ngIf="(canwrite$ | async) && (['custom_domain'] | hasFeature | async); else noCustom" (click)="verifyDomain(domain)"
|
||||
class="title">{{domain.domainName}}</span>
|
||||
<ng-template cnslHasRole [hasRole]="['policy.read']">
|
||||
<cnsl-policy-grid class="policies" [type]="PolicyComponentServiceType.MGMT"></cnsl-policy-grid>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #noCustom>
|
||||
<span class="title disabled">{{domain.domainName}}</span>
|
||||
</ng-template>
|
||||
<span *ngIf="(canwrite$ | async) === false" class="title disabled">{{domain?.domainName}}</span>
|
||||
|
||||
<i matTooltip="verified" *ngIf="domain.isVerified" class="verified las la-check-circle"></i>
|
||||
<i matTooltip="primary" *ngIf="domain.isPrimary" class="primary las la-star"></i>
|
||||
<a *ngIf="domain.isVerified && !domain.isPrimary && (canwrite$ | async)" class="primaryset"
|
||||
(click)="setPrimary(domain)">{{'ORG.DOMAINS.SETPRIMARY' | translate}}</a>
|
||||
|
||||
<span class="fill-space"></span>
|
||||
<button class="rem-button" [disabled]="(canwrite$ | async) === false" matTooltip="Remove domain"
|
||||
color="warn" mat-icon-button (click)="removeDomain(domain.domainName)"><i
|
||||
class="las la-trash"></i></button>
|
||||
</div>
|
||||
<p class="new-desc">{{'ORG.PAGES.ORGDOMAIN.VERIFICATION' | translate}}</p>
|
||||
|
||||
<cnsl-info-section *ngIf="(['custom_domain'] | hasFeature | async) === false" [featureLink]="['/org/features']" class="info" [type]="InfoSectionType.WARN">
|
||||
<span [innerHTML]="'FEATURES.NOTAVAILABLE' | translate: ({value: 'custom_domain'})"></span>
|
||||
</cnsl-info-section>
|
||||
|
||||
<button [disabled]="(canwrite$ | async) === false || (['custom_domain'] | hasFeature | async) === false" matTooltip="Add domain" mat-raised-button
|
||||
color="primary" (click)="addNewDomain()">{{'ORG.DOMAINS.NEW' | translate}}
|
||||
</button>
|
||||
</cnsl-card>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="['features.read'] | hasRole | async">
|
||||
<h2>{{'FEATURES.TITLE' | translate}}</h2>
|
||||
<p class="top-desc">{{'FEATURES.DESCRIPTION' | translate}}</p>
|
||||
<cnsl-zitadel-tier [features]="features"></cnsl-zitadel-tier>
|
||||
</ng-container>
|
||||
|
||||
<ng-template cnslHasRole [hasRole]="['policy.read']">
|
||||
<cnsl-policy-grid [type]="PolicyComponentServiceType.MGMT"></cnsl-policy-grid>
|
||||
</ng-template>
|
||||
<div metainfo>
|
||||
<cnsl-changes *ngIf="org" [changeType]="ChangeType.ORG" [id]="org.id"></cnsl-changes>
|
||||
</div>
|
||||
|
||||
<div class="side" metainfo>
|
||||
<div class="meta-details">
|
||||
<div class="meta-row">
|
||||
<span class="first">{{'RESOURCEID' | translate}}:</span>
|
||||
<span *ngIf="org?.id" class="second">{{ org.id }}</span>
|
||||
</div>
|
||||
<div class="meta-row">
|
||||
<span class="first">{{'ORG.PAGES.PRIMARYDOMAIN' | translate}}</span>
|
||||
<span class="second"><span style="display: block;">{{primaryDomain}}</span></span>
|
||||
</div>
|
||||
<div class="meta-row">
|
||||
<span class="first">{{'ORG.PAGES.STATE' | translate}}</span>
|
||||
<span *ngIf="org && org.state !== undefined" class="state"
|
||||
[ngClass]="{'active': org.state === OrgState.ORG_STATE_ACTIVE, 'inactive': org.state === OrgState.ORG_STATE_INACTIVE}">{{'ORG.STATE.'+org.state
|
||||
|
|
||||
translate}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" [disablePagination]="true">
|
||||
<mat-tab label="Details">
|
||||
<cnsl-contributors [totalResult]="totalMemberResult" [loading]="loading$ | async"
|
||||
[membersSubject]="membersSubject" title="{{ 'PROJECT.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.MEMBER.TITLEDESC' | translate }}" (addClicked)="openAddMember()"
|
||||
(showDetailClicked)="showDetail()" (refreshClicked)="loadMembers()" [disabled]="false">
|
||||
</cnsl-contributors>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'CHANGES.ORG.TITLE' | translate }}" class="meta-flex-col">
|
||||
<cnsl-changes *ngIf="org" [changeType]="ChangeType.ORG" [id]="org.id"></cnsl-changes>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</cnsl-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
</div>
|
||||
@@ -1,88 +1,15 @@
|
||||
.h1 {
|
||||
margin: 0;
|
||||
.org-top-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
.org-subtitle {
|
||||
font-size: 1.2rem;
|
||||
letter-spacing: .05em;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.top-desc {
|
||||
color: var(--grey);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sub {
|
||||
color: var(--grey);
|
||||
margin-bottom: 2rem;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
.icon {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.domain {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
margin-right: 1rem;
|
||||
|
||||
&:not(.disabled) {
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.primaryset {
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.verified,
|
||||
.primary {
|
||||
color: var(--color-main);
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.verify-btn {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.fill-space {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.rem-button {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.rem-button {
|
||||
visibility: visible;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.new-desc {
|
||||
font-size: 14px;
|
||||
color: var(--grey);
|
||||
}
|
||||
|
||||
.custom-domain-deactivated {
|
||||
margin-bottom: 1rem;
|
||||
.policies {
|
||||
display: block;
|
||||
padding-top: 2rem;
|
||||
}
|
||||
|
||||
@@ -1,26 +1,19 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MatButtonToggleChange } from '@angular/material/button-toggle';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
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 { InfoSectionType } from 'src/app/modules/info-section/info-section.component';
|
||||
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
|
||||
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 { Org, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { AddDomainDialogComponent } from './add-domain-dialog/add-domain-dialog.component';
|
||||
import { DomainVerificationComponent } from './domain-verification/domain-verification.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-org-detail',
|
||||
templateUrl: './org-detail.component.html',
|
||||
@@ -33,122 +26,51 @@ export class OrgDetailComponent implements OnInit {
|
||||
public OrgState: any = OrgState;
|
||||
public ChangeType: any = ChangeType;
|
||||
|
||||
public domains: Domain.AsObject[] = [];
|
||||
public primaryDomain: string = '';
|
||||
|
||||
// members
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public totalMemberResult: number = 0;
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]>
|
||||
= new BehaviorSubject<Member.AsObject[]>([]);
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
public features!: Features.AsObject;
|
||||
public InfoSectionType: any = InfoSectionType;
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
public translate: TranslateService,
|
||||
public mgmtService: ManagementService,
|
||||
private toast: ToastService,
|
||||
private router: Router,
|
||||
) { }
|
||||
breadcrumbService: BreadcrumbService,
|
||||
) {
|
||||
const iamBread = new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'IAM',
|
||||
routerLink: ['/system'],
|
||||
});
|
||||
const bread: Breadcrumb = {
|
||||
type: BreadcrumbType.ORG,
|
||||
routerLink: ['/org'],
|
||||
};
|
||||
breadcrumbService.setBreadcrumb([iamBread, bread]);
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
private async getData(): Promise<void> {
|
||||
this.mgmtService.getMyOrg().then((resp) => {
|
||||
if (resp.org) {
|
||||
this.org = resp.org;
|
||||
}
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
this.mgmtService
|
||||
.getMyOrg()
|
||||
.then((resp) => {
|
||||
if (resp.org) {
|
||||
this.org = resp.org;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
this.loadMembers();
|
||||
this.loadDomains();
|
||||
this.loadFeatures();
|
||||
}
|
||||
|
||||
public loadDomains(): void {
|
||||
this.mgmtService.listOrgDomains().then(result => {
|
||||
this.domains = result.resultList;
|
||||
this.primaryDomain = this.domains.find(domain => domain.isPrimary)?.domainName ?? '';
|
||||
});
|
||||
}
|
||||
|
||||
public setPrimary(domain: Domain.AsObject): void {
|
||||
this.mgmtService.setPrimaryOrgDomain(domain.domainName).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.SETPRIMARY', true);
|
||||
this.loadDomains();
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public changeState(event: MatButtonToggleChange | any): void {
|
||||
if (event.value === OrgState.ORG_STATE_ACTIVE) {
|
||||
this.mgmtService.reactivateOrg().then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.REACTIVATED', true);
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (event.value === OrgState.ORG_STATE_INACTIVE) {
|
||||
this.mgmtService.deactivateOrg().then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.DEACTIVATED', true);
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public addNewDomain(): void {
|
||||
const dialogRef = this.dialog.open(AddDomainDialogComponent, {
|
||||
data: {},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.mgmtService.addOrgDomain(resp).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.DOMAINADDED', true);
|
||||
|
||||
setTimeout(() => {
|
||||
this.loadDomains();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public removeDomain(domain: string): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'ORG.DOMAINS.DELETE.TITLE',
|
||||
descriptionKey: 'ORG.DOMAINS.DELETE.DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.mgmtService.removeOrgDomain(domain).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.DOMAINREMOVED', true);
|
||||
const index = this.domains.findIndex(d => d.domainName === domain);
|
||||
if (index > -1) {
|
||||
this.domains.splice(index, 1);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public openAddMember(): void {
|
||||
const dialogRef = this.dialog.open(MemberCreateDialogComponent, {
|
||||
data: {
|
||||
@@ -157,22 +79,29 @@ export class OrgDetailComponent implements OnInit {
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp) {
|
||||
const users: User.AsObject[] = resp.users;
|
||||
const roles: string[] = resp.roles;
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
Promise.all(users.map(user => {
|
||||
return this.mgmtService.addOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.loadMembers();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
Promise.all(
|
||||
users.map((user) => {
|
||||
return this.mgmtService.addOrgMember(user.id, roles);
|
||||
}),
|
||||
)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.loadMembers();
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
setTimeout(() => {
|
||||
this.loadMembers();
|
||||
}, 1000);
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -182,46 +111,38 @@ export class OrgDetailComponent implements OnInit {
|
||||
this.router.navigate(['org/members']);
|
||||
}
|
||||
|
||||
public verifyDomain(domain: Domain.AsObject): void {
|
||||
const dialogRef = this.dialog.open(DomainVerificationComponent, {
|
||||
data: {
|
||||
domain: domain,
|
||||
},
|
||||
width: '500px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((reload) => {
|
||||
if (reload) {
|
||||
this.loadDomains();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public loadMembers(): void {
|
||||
this.loadingSubject.next(true);
|
||||
from(this.mgmtService.listOrgMembers(100, 0)).pipe(
|
||||
map(resp => {
|
||||
if (resp.details?.totalResult) {
|
||||
this.totalMemberResult = resp.details?.totalResult;
|
||||
} else {
|
||||
this.totalMemberResult = 0;
|
||||
}
|
||||
from(this.mgmtService.listOrgMembers(100, 0))
|
||||
.pipe(
|
||||
map((resp) => {
|
||||
if (resp.details?.totalResult) {
|
||||
this.totalMemberResult = resp.details?.totalResult;
|
||||
} else {
|
||||
this.totalMemberResult = 0;
|
||||
}
|
||||
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
)
|
||||
.subscribe((members) => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
}
|
||||
|
||||
public loadFeatures(): void {
|
||||
this.loadingSubject.next(true);
|
||||
this.mgmtService.getFeatures().then(resp => {
|
||||
if (resp.features) {
|
||||
this.features = resp.features;
|
||||
}
|
||||
});
|
||||
this.mgmtService
|
||||
.getFeatures()
|
||||
.then((resp) => {
|
||||
if (resp.features) {
|
||||
this.features = resp.features;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +1,90 @@
|
||||
<div class="enlarged-container">
|
||||
<div class="max-width-container">
|
||||
<div class="enlarged-container">
|
||||
<h1>{{ 'ORG.PAGES.LIST' | translate }}</h1>
|
||||
<p class="top-desc">{{'ORG.PAGES.LISTDESCRIPTION' | translate}}</p>
|
||||
<p class="org-desc cnsl-secondary-text">{{'ORG.PAGES.LISTDESCRIPTION' | translate}}</p>
|
||||
|
||||
<cnsl-refresh-table *ngIf="dataSource" (refreshed)="refresh()" [dataSize]="dataSource.data.length"
|
||||
[loading]="loading$ | async">
|
||||
<cnsl-refresh-table *ngIf="dataSource" [hideRefresh]="true" (refreshed)="refresh()"
|
||||
[dataSize]="dataSource.data.length" [loading]="loading$ | async">
|
||||
|
||||
<cnsl-form-field @appearfade *ngIf="orgSearchKey !== undefined" actions class="filter">
|
||||
<cnsl-label>{{'ORG.PAGES.FILTER' | translate}}</cnsl-label>
|
||||
<input cnslInput (keyup)="applyFilter($event)" placeholder="{{'ORG.PAGES.FILTERPLACEHOLDER' | translate}}"
|
||||
#input>
|
||||
</cnsl-form-field>
|
||||
<cnsl-filter-org actions (filterChanged)="applySearchQuery($any($event))" (filterOpen)="filterOpen = $event">
|
||||
</cnsl-filter-org>
|
||||
|
||||
<table [dataSource]="dataSource" mat-table class="table" matSort aria-label="Elements">
|
||||
<ng-template actions cnslHasRole [hasRole]="['org.create','iam.write']">
|
||||
<a [routerLink]="[ '/org', 'create']" color="primary" mat-raised-button class="cnsl-action-button">
|
||||
<mat-icon class="icon">add</mat-icon>
|
||||
<span>{{ 'ACTIONS.NEW' | translate }}</span>
|
||||
<cnsl-action-keys (actionTriggered)="gotoRouterLink([ '/org', 'create'])">
|
||||
</cnsl-action-keys>
|
||||
</a>
|
||||
</ng-template>
|
||||
|
||||
<ng-container matColumnDef="select">
|
||||
<th class="selection" mat-header-cell *matHeaderCellDef>
|
||||
{{'ORG.PAGES.ACTIVE' | translate}}
|
||||
</th>
|
||||
<td class="selection" mat-cell *matCellDef="let row">
|
||||
<mat-radio-button (change)="selectOrg(row)" color="primary" (click)="$event.stopPropagation()"
|
||||
[checked]="row.id === activeOrg.id">
|
||||
</mat-radio-button>
|
||||
</td>
|
||||
</ng-container>
|
||||
<table [dataSource]="dataSource" mat-table class="table" aria-label="Elements">
|
||||
<ng-container matColumnDef="select">
|
||||
<th class="selection" mat-header-cell *matHeaderCellDef>
|
||||
{{'ORG.PAGES.ACTIVE' | translate}}
|
||||
</th>
|
||||
<td class="selection" mat-cell *matCellDef="let org">
|
||||
<mat-radio-button (change)="selectOrg(org)" color="primary" [checked]="org.id === activeOrg.id">
|
||||
</mat-radio-button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'ORG.PAGES.ID' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let org"> {{org.id}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'ORG.PAGES.ID' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let org" (change)="selectOrg(org)"> {{org.id}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
||||
[ngClass]="{'search-active': this.orgSearchKey === OrgListSearchKey.NAME}">
|
||||
{{ 'ORG.PAGES.NAME' | translate }}
|
||||
<template [ngTemplateOutlet]="templateRef"
|
||||
[ngTemplateOutletContext]="{key: OrgListSearchKey.NAME}"></template>
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let org"> {{org.name}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="primaryDomain">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'ORG.PAGES.PRIMARYDOMAIN' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let org"><span>{{org.primaryDomain}}</span>
|
||||
<button color="primary" class="cpy-button" mat-icon-button [disabled]="copied === org.primaryDomain"
|
||||
[matTooltip]="(copied !== org.primaryDomain ? 'ACTIONS.COPY' : 'ACTIONS.COPIED' ) | translate"
|
||||
cnslCopyToClipboard [valueToCopy]="org.primaryDomain" (copiedValue)="copied = $event">
|
||||
<i *ngIf="copied !== org.primaryDomain" class="las la-clipboard"></i>
|
||||
<i *ngIf="copied === org.primaryDomain" class="las la-clipboard-check"></i>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="creationDate">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
||||
[ngClass]="{'search-active': this.orgSearchKey === OrgListSearchKey.NAME}">
|
||||
{{ 'ORG.PAGES.CREATIONDATE' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let org">
|
||||
{{org.details?.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM YYYY, HH:mm'}}
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ 'ORG.PAGES.NAME' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let org" (click)="setAndNavigateToOrg(org)">{{org.name}}</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr (click)="setAndNavigateToOrg(row)" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<mat-paginator class="paginator" [pageSize]="10" #paginator [pageSizeOptions]="[10, 20, 100, 250]">
|
||||
</mat-paginator>
|
||||
<ng-container matColumnDef="state">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'ORG.PAGES.STATE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let org" (click)="setAndNavigateToOrg(org)">
|
||||
<span class="state"
|
||||
[ngClass]="{'active': org.state === OrgState.ORG_STATE_ACTIVE, 'inactive': org.state === OrgState.ORG_STATE_INACTIVE}"
|
||||
*ngIf="org.state">{{'ORG.STATE.'+org.state | translate}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="creationDate">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ 'ORG.PAGES.CREATIONDATE' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let org" (click)="setAndNavigateToOrg(org)">
|
||||
{{org.details?.creationDate | timestampToDate | localizedDate: 'fromNow'}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="changeDate">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ 'ORG.PAGES.DATECHANGED' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let org" (click)="setAndNavigateToOrg(org)">
|
||||
{{org.details?.changeDate | timestampToDate | localizedDate: 'fromNow'}}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<cnsl-paginator #paginator class="paginator" [timestamp]="timestamp" [length]="totalResult || 0"
|
||||
[pageSize]="initialLimit" [pageSizeOptions]="[10, 20, 50, 100]" (page)="changePage($event)"></cnsl-paginator>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
|
||||
<ng-template #templateRef let-key="key">
|
||||
<button class="search-button" mat-icon-button (click)="setFilter(key)">
|
||||
<mat-icon *ngIf="this.orgSearchKey !== key">search</mat-icon>
|
||||
<mat-icon *ngIf="this.orgSearchKey === key">search_off</mat-icon>
|
||||
</button>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,31 +1,26 @@
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.top-desc {
|
||||
color: var(--grey);
|
||||
.org-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.table,
|
||||
.paginator {
|
||||
width: 100%;
|
||||
td {
|
||||
cursor: pointer;
|
||||
|
||||
td,
|
||||
th {
|
||||
padding: 0 1rem;
|
||||
.cpy-button {
|
||||
visibility: hidden;
|
||||
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
i {
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
.cpy-button {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { enterAnimations } from 'src/app/animations';
|
||||
import { TextQueryMethod } from 'src/app/proto/generated/zitadel/object_pb';
|
||||
import { Org, OrgNameQuery, OrgQuery } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
||||
import { Org, OrgQuery, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
|
||||
enum OrgListSearchKey {
|
||||
@@ -18,59 +19,58 @@ enum OrgListSearchKey {
|
||||
selector: 'cnsl-org-list',
|
||||
templateUrl: './org-list.component.html',
|
||||
styleUrls: ['./org-list.component.scss'],
|
||||
animations: [
|
||||
enterAnimations,
|
||||
],
|
||||
animations: [enterAnimations],
|
||||
})
|
||||
export class OrgListComponent implements AfterViewInit {
|
||||
export class OrgListComponent {
|
||||
public orgSearchKey: OrgListSearchKey | undefined = undefined;
|
||||
|
||||
@ViewChild(MatPaginator) public paginator!: MatPaginator;
|
||||
@ViewChild(MatSort) sort!: MatSort;
|
||||
@ViewChild(PaginatorComponent) public paginator!: PaginatorComponent;
|
||||
@ViewChild('input') public filter!: Input;
|
||||
|
||||
public dataSource!: MatTableDataSource<Org.AsObject>;
|
||||
public displayedColumns: string[] = ['select', 'id', 'name', 'creationDate'];
|
||||
public displayedColumns: string[] = ['select', 'name', 'state', 'primaryDomain', 'creationDate', 'changeDate'];
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public activeOrg!: Org.AsObject;
|
||||
public OrgListSearchKey: any = OrgListSearchKey;
|
||||
public initialLimit: number = 20;
|
||||
public timestamp: Timestamp.AsObject | undefined = undefined;
|
||||
public totalResult: number = 0;
|
||||
public filterOpen: boolean = false;
|
||||
public OrgState: any = OrgState;
|
||||
public copied: string = '';
|
||||
constructor(private authService: GrpcAuthService, private router: Router, breadcrumbService: BreadcrumbService) {
|
||||
this.loadOrgs(this.initialLimit, 0);
|
||||
this.authService.getActiveOrg().then((org) => (this.activeOrg = org));
|
||||
|
||||
constructor(
|
||||
private authService: GrpcAuthService,
|
||||
private router: Router,
|
||||
) {
|
||||
this.loadOrgs(10, 0);
|
||||
|
||||
this.authService.getActiveOrg().then(org => this.activeOrg = org);
|
||||
}
|
||||
|
||||
public ngAfterViewInit(): void {
|
||||
this.loadOrgs(10, 0);
|
||||
}
|
||||
|
||||
public loadOrgs(limit: number, offset: number, filter?: string): void {
|
||||
this.loadingSubject.next(true);
|
||||
let query;
|
||||
if (filter) {
|
||||
query = new OrgQuery();
|
||||
const orgNameQuery = new OrgNameQuery();
|
||||
orgNameQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
|
||||
orgNameQuery.setName(filter);
|
||||
query.setNameQuery(orgNameQuery);
|
||||
}
|
||||
|
||||
from(this.authService.listMyProjectOrgs(limit, offset, query ? [query] : undefined)).pipe(
|
||||
map(resp => {
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(views => {
|
||||
this.dataSource = new MatTableDataSource(views);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
const iamBread = new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'IAM',
|
||||
routerLink: ['/system'],
|
||||
});
|
||||
const bread: Breadcrumb = {
|
||||
type: BreadcrumbType.ORG,
|
||||
routerLink: ['/org'],
|
||||
};
|
||||
breadcrumbService.setBreadcrumb([iamBread, bread]);
|
||||
}
|
||||
|
||||
public loadOrgs(limit: number, offset: number, queries?: OrgQuery[]): void {
|
||||
this.loadingSubject.next(true);
|
||||
|
||||
from(this.authService.listMyProjectOrgs(limit, offset, queries))
|
||||
.pipe(
|
||||
map((resp) => {
|
||||
this.timestamp = resp.details?.viewTimestamp;
|
||||
this.totalResult = resp.details?.totalResult ?? 0;
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
)
|
||||
.subscribe((views) => {
|
||||
this.dataSource = new MatTableDataSource(views);
|
||||
});
|
||||
}
|
||||
|
||||
public selectOrg(item: Org.AsObject, event?: any): void {
|
||||
@@ -81,6 +81,10 @@ export class OrgListComponent implements AfterViewInit {
|
||||
this.loadOrgs(this.paginator.length, this.paginator.pageSize * this.paginator.pageIndex);
|
||||
}
|
||||
|
||||
public applySearchQuery(searchQueries: OrgQuery[]): void {
|
||||
this.loadOrgs(this.paginator.pageSize, this.paginator.pageSize * this.paginator.pageIndex, searchQueries);
|
||||
}
|
||||
|
||||
public setFilter(key: OrgListSearchKey): void {
|
||||
setTimeout(() => {
|
||||
if (this.filter) {
|
||||
@@ -96,17 +100,16 @@ export class OrgListComponent implements AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
public applyFilter(event: Event): void {
|
||||
const filterValue = (event.target as HTMLInputElement).value;
|
||||
this.loadOrgs(
|
||||
this.paginator.pageSize,
|
||||
this.paginator.pageIndex * this.paginator.pageSize,
|
||||
filterValue.trim().toLowerCase(),
|
||||
);
|
||||
}
|
||||
|
||||
public setAndNavigateToOrg(org: Org.AsObject): void {
|
||||
this.authService.setActiveOrg(org);
|
||||
this.router.navigate(['/org']);
|
||||
}
|
||||
|
||||
public changePage(event: PageEvent): void {
|
||||
this.loadOrgs(event.pageSize, event.pageIndex * event.pageSize);
|
||||
}
|
||||
|
||||
public gotoRouterLink(rL: any) {
|
||||
this.router.navigate(rL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,17 @@ import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CopyToClipboardModule } from 'src/app/directives/copy-to-clipboard/copy-to-clipboard.module';
|
||||
import { HasRoleModule } from 'src/app/directives/has-role/has-role.module';
|
||||
import { ActionKeysModule } from 'src/app/modules/action-keys/action-keys.module';
|
||||
import { FilterOrgModule } from 'src/app/modules/filter-org/filter-org.module';
|
||||
import { InputModule } from 'src/app/modules/input/input.module';
|
||||
import { PaginatorModule } from 'src/app/modules/paginator/paginator.module';
|
||||
import { RefreshTableModule } from 'src/app/modules/refresh-table/refresh-table.module';
|
||||
import { LocalizedDatePipeModule } from 'src/app/pipes/localized-date-pipe/localized-date-pipe.module';
|
||||
import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/timestamp-to-date-pipe.module';
|
||||
@@ -18,23 +22,27 @@ import { OrgListRoutingModule } from './org-list-routing.module';
|
||||
import { OrgListComponent } from './org-list.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [OrgListComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
OrgListRoutingModule,
|
||||
MatTableModule,
|
||||
TranslateModule,
|
||||
RefreshTableModule,
|
||||
TimestampToDatePipeModule,
|
||||
LocalizedDatePipeModule,
|
||||
MatPaginatorModule,
|
||||
MatSortModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatTooltipModule,
|
||||
MatRadioModule,
|
||||
InputModule,
|
||||
FormsModule,
|
||||
],
|
||||
declarations: [OrgListComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
OrgListRoutingModule,
|
||||
MatTableModule,
|
||||
TranslateModule,
|
||||
RefreshTableModule,
|
||||
ActionKeysModule,
|
||||
FilterOrgModule,
|
||||
TimestampToDatePipeModule,
|
||||
LocalizedDatePipeModule,
|
||||
MatSortModule,
|
||||
MatIconModule,
|
||||
PaginatorModule,
|
||||
HasRoleModule,
|
||||
MatButtonModule,
|
||||
MatTooltipModule,
|
||||
CopyToClipboardModule,
|
||||
MatRadioModule,
|
||||
InputModule,
|
||||
FormsModule,
|
||||
],
|
||||
})
|
||||
export class OrgListModule { }
|
||||
export class OrgListModule {}
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<form>
|
||||
<cnsl-form-field appearance="outline" class="full-width">
|
||||
<cnsl-label>Role Name</cnsl-label>
|
||||
|
||||
<mat-select [formControl]="myControl" multiple>
|
||||
<mat-option *ngIf="isLoading" class="is-loading">
|
||||
<mat-spinner diameter="30"></mat-spinner>
|
||||
</mat-option>
|
||||
<mat-option *ngFor="let role of allRoles" [value]="role">
|
||||
{{ role }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</cnsl-form-field>
|
||||
</form>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { OrgMemberRolesAutocompleteComponent } from './org-member-roles-autocomplete.component';
|
||||
|
||||
describe('OrgMemberRolesAutocompleteComponent', () => {
|
||||
let component: OrgMemberRolesAutocompleteComponent;
|
||||
let fixture: ComponentFixture<OrgMemberRolesAutocompleteComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [OrgMemberRolesAutocompleteComponent],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(OrgMemberRolesAutocompleteComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import { Component, ElementRef, EventEmitter, Output, ViewChild } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { MatAutocomplete } from '@angular/material/autocomplete';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-org-member-roles-autocomplete',
|
||||
templateUrl: './org-member-roles-autocomplete.component.html',
|
||||
styleUrls: ['./org-member-roles-autocomplete.component.scss'],
|
||||
})
|
||||
export class OrgMemberRolesAutocompleteComponent {
|
||||
public myControl: FormControl = new FormControl();
|
||||
public names: string[] = [];
|
||||
public roles: string[] = [];
|
||||
public allRoles: string[] = [];
|
||||
public isLoading: boolean = false;
|
||||
@ViewChild('nameInput') public nameInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('auto') public matAutocomplete!: MatAutocomplete;
|
||||
@Output() public selectionChanged: EventEmitter<string[]> = new EventEmitter();
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) {
|
||||
this.mgmtService.listOrgMemberRoles().then(resp => {
|
||||
this.allRoles = resp.resultList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
this.myControl.valueChanges.subscribe(change => {
|
||||
this.selectionChanged.emit(change);
|
||||
});
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { InputModule } from 'src/app/modules/input/input.module';
|
||||
|
||||
import { OrgMemberRolesAutocompleteComponent } from './org-member-roles-autocomplete.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [OrgMemberRolesAutocompleteComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatSelectModule,
|
||||
InputModule,
|
||||
MatIconModule,
|
||||
ReactiveFormsModule,
|
||||
MatProgressSpinnerModule,
|
||||
FormsModule,
|
||||
TranslateModule,
|
||||
],
|
||||
exports: [
|
||||
OrgMemberRolesAutocompleteComponent,
|
||||
],
|
||||
})
|
||||
export class OrgMemberRolesAutocompleteModule { }
|
||||
@@ -1,23 +1,31 @@
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/org']" title="{{org?.name}} {{ 'ORG.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'ORG.MEMBER.DESCRIPTION' | translate }}">
|
||||
<p class="desc">{{'MEMBER.DOCSINFO' | translate}} <a href="https://docs.zitadel.ch/docs/manuals/admin-managers"
|
||||
target="_blank">ZITADEL Managers</a>.</p>
|
||||
<cnsl-members-table [dataSource]="dataSource" [memberRoleOptions]="memberRoleOptions"
|
||||
(updateRoles)="updateRoles($event.member, $event.change)" [factoryLoadFunc]="changePageFactory"
|
||||
(changedSelection)="selection = $event" [refreshTrigger]="changePage"
|
||||
[canDelete]="['org.member.delete:'+org?.id,'org.member.delete$'] | hasRole | async"
|
||||
[canWrite]="['org.member.write$'] | hasRole | async" (deleteMember)="removeOrgMember($event)">
|
||||
<ng-template cnslHasRole selectactions [hasRole]="['org.member.delete:'+org?.id,'org.member.delete']">
|
||||
<button (click)="removeOrgMemberSelection()" matTooltip="{{'ORG_DETAIL.TABLE.DELETE' | translate}}"
|
||||
class="del-button" mat-raised-button color="warn">
|
||||
<i class="las la-trash"></i>
|
||||
{{'ACTIONS.SELECTIONDELETE' | translate}}
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template cnslHasRole writeactions [hasRole]="['org.member.write:'+org?.id,'org.member.write']">
|
||||
<a color="primary" (click)="openAddMember()" color="primary" mat-raised-button>
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
</a>
|
||||
</ng-template>
|
||||
</cnsl-members-table>
|
||||
<cnsl-detail-layout title="{{org?.name}} {{ 'ORG.MEMBER.TITLE' | translate }}">
|
||||
<p class="subinfo" sub>
|
||||
<span class="cnsl-secondary-text">{{ 'ORG.MEMBER.DESCRIPTION' | translate }}</span>
|
||||
<a mat-icon-button href="https://docs.zitadel.ch/docs/manuals/admin-managers" target="_blank">
|
||||
<i class="las la-info-circle"></i>
|
||||
</a>
|
||||
</p>
|
||||
<cnsl-members-table [dataSource]="dataSource" [memberRoleOptions]="memberRoleOptions"
|
||||
(updateRoles)="updateRoles($event.member, $event.change)" [factoryLoadFunc]="changePageFactory"
|
||||
(changedSelection)="selection = $event" [refreshTrigger]="changePage"
|
||||
[canDelete]="['org.member.delete:'+org?.id,'org.member.delete$'] | hasRole | async"
|
||||
[canWrite]="['org.member.write$'] | hasRole | async" (deleteMember)="removeOrgMember($event)">
|
||||
<ng-template cnslHasRole selectactions [hasRole]="['org.member.delete:'+org?.id,'org.member.delete']">
|
||||
<button (click)="removeOrgMemberSelection()" matTooltip="{{'ORG_DETAIL.TABLE.DELETE' | translate}}"
|
||||
mat-raised-button color="warn">
|
||||
<i class="las la-trash"></i>
|
||||
<span>{{'ACTIONS.SELECTIONDELETE' | translate}}</span>
|
||||
<cnsl-action-keys [type]="ActionKeysType.DELETE" (actionTriggered)="removeOrgMemberSelection()">
|
||||
</cnsl-action-keys>
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template cnslHasRole writeactions [hasRole]="['org.member.write:'+org?.id,'org.member.write']">
|
||||
<button color="primary" (click)="openAddMember()" class="cnsl-action-button" mat-raised-button>
|
||||
<mat-icon class="icon">add</mat-icon>
|
||||
<span>{{ 'ACTIONS.NEW' | translate }}</span>
|
||||
<cnsl-action-keys (actionTriggered)="openAddMember()">
|
||||
</cnsl-action-keys>
|
||||
</button>
|
||||
</ng-template>
|
||||
</cnsl-members-table>
|
||||
</cnsl-detail-layout>
|
||||
@@ -1,8 +1,12 @@
|
||||
.del-button {
|
||||
margin-right: .5rem;
|
||||
}
|
||||
|
||||
.desc {
|
||||
.subinfo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
color: var(--grey);
|
||||
margin: -1.5rem 0 0 0;
|
||||
|
||||
i {
|
||||
font-size: 1.2rem;
|
||||
height: 1.2rem;
|
||||
line-height: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
@@ -7,28 +6,25 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { OrgMembersComponent } from './org-members.component';
|
||||
|
||||
describe('OrgMembersComponent', () => {
|
||||
let component: OrgMembersComponent;
|
||||
let fixture: ComponentFixture<OrgMembersComponent>;
|
||||
let component: OrgMembersComponent;
|
||||
let fixture: ComponentFixture<OrgMembersComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [OrgMembersComponent],
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
MatPaginatorModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [OrgMembersComponent],
|
||||
imports: [NoopAnimationsModule, MatSortModule, MatTableModule],
|
||||
}).compileComponents();
|
||||
}),
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(OrgMembersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(OrgMembersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should compile', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
it('should compile', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Component, EventEmitter } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { ActionKeysType } from 'src/app/modules/action-keys/action-keys.component';
|
||||
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
||||
import { Member } from 'src/app/proto/generated/zitadel/member_pb';
|
||||
import { Org } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -26,13 +27,26 @@ export class OrgMembersComponent {
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
public ActionKeysType: any = ActionKeysType;
|
||||
|
||||
constructor(
|
||||
private mgmtService: ManagementService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
) {
|
||||
this.mgmtService.getMyOrg().then(resp => {
|
||||
const iamBread = new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'IAM',
|
||||
routerLink: ['/system'],
|
||||
});
|
||||
const bread: Breadcrumb = {
|
||||
type: BreadcrumbType.ORG,
|
||||
routerLink: ['/org'],
|
||||
};
|
||||
breadcrumbService.setBreadcrumb([iamBread, bread]);
|
||||
|
||||
this.mgmtService.getMyOrg().then((resp) => {
|
||||
if (resp.org) {
|
||||
this.org = resp.org;
|
||||
this.dataSource = new OrgMembersDataSource(this.mgmtService);
|
||||
@@ -43,38 +57,45 @@ export class OrgMembersComponent {
|
||||
this.getRoleOptions();
|
||||
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
return this.dataSource.loadMembers(
|
||||
event?.pageIndex ?? 0,
|
||||
event?.pageSize ?? this.INITIALPAGESIZE,
|
||||
);
|
||||
return this.dataSource.loadMembers(event?.pageIndex ?? 0, event?.pageSize ?? this.INITIALPAGESIZE);
|
||||
};
|
||||
}
|
||||
|
||||
public getRoleOptions(): void {
|
||||
this.mgmtService.listOrgMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.resultList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
this.mgmtService
|
||||
.listOrgMemberRoles()
|
||||
.then((resp) => {
|
||||
this.memberRoleOptions = resp.resultList;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
updateRoles(member: Member.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateOrgMember(member.userId, selectionChange.value)
|
||||
updateRoles(member: Member.AsObject, selectionChange: string[]): void {
|
||||
this.mgmtService
|
||||
.updateOrgMember(member.userId, selectionChange)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public removeOrgMemberSelection(): void {
|
||||
Promise.all(this.selection.map(member => {
|
||||
return this.mgmtService.removeOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
})).then(() => {
|
||||
Promise.all(
|
||||
this.selection.map((member) => {
|
||||
return this.mgmtService
|
||||
.removeOrgMember(member.userId)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}),
|
||||
).then(() => {
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
@@ -82,15 +103,18 @@ export class OrgMembersComponent {
|
||||
}
|
||||
|
||||
public removeOrgMember(member: Member.AsObject): void {
|
||||
this.mgmtService.removeOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
this.mgmtService
|
||||
.removeOrgMember(member.userId)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public openAddMember(): void {
|
||||
@@ -101,22 +125,26 @@ export class OrgMembersComponent {
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp) {
|
||||
const users: User.AsObject[] = resp.users;
|
||||
const roles: string[] = resp.roles;
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
Promise.all(users.map(user => {
|
||||
return this.mgmtService.addOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
Promise.all(
|
||||
users.map((user) => {
|
||||
return this.mgmtService.addOrgMember(user.id, roles);
|
||||
}),
|
||||
)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HasRoleModule } from 'src/app/directives/has-role/has-role.module';
|
||||
import { ActionKeysModule } from 'src/app/modules/action-keys/action-keys.module';
|
||||
import { MemberCreateDialogModule } from 'src/app/modules/add-member-dialog/member-create-dialog.module';
|
||||
import { DetailLayoutModule } from 'src/app/modules/detail-layout/detail-layout.module';
|
||||
import { MembersTableModule } from 'src/app/modules/members-table/members-table.module';
|
||||
@@ -15,23 +16,23 @@ import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.mod
|
||||
import { OrgMembersRoutingModule } from './org-members-routing.module';
|
||||
import { OrgMembersComponent } from './org-members.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [OrgMembersComponent],
|
||||
imports: [
|
||||
OrgMembersRoutingModule,
|
||||
CommonModule,
|
||||
MatChipsModule,
|
||||
MatButtonModule,
|
||||
HasRoleModule,
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
TranslateModule,
|
||||
DetailLayoutModule,
|
||||
RefreshTableModule,
|
||||
MembersTableModule,
|
||||
HasRolePipeModule,
|
||||
MemberCreateDialogModule,
|
||||
],
|
||||
declarations: [OrgMembersComponent],
|
||||
imports: [
|
||||
OrgMembersRoutingModule,
|
||||
CommonModule,
|
||||
MatChipsModule,
|
||||
MatButtonModule,
|
||||
ActionKeysModule,
|
||||
HasRoleModule,
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
TranslateModule,
|
||||
DetailLayoutModule,
|
||||
RefreshTableModule,
|
||||
MembersTableModule,
|
||||
HasRolePipeModule,
|
||||
MemberCreateDialogModule,
|
||||
],
|
||||
})
|
||||
export class OrgMembersModule { }
|
||||
export class OrgMembersModule {}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
@@ -16,38 +15,39 @@ 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 { FeaturesModule } from 'src/app/modules/features/features.module';
|
||||
import { InfoRowModule } from 'src/app/modules/info-row/info-row.module';
|
||||
import { InfoSectionModule } from 'src/app/modules/info-section/info-section.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';
|
||||
import { SharedModule } from 'src/app/modules/shared/shared.module';
|
||||
import { TopViewModule } from 'src/app/modules/top-view/top-view.module';
|
||||
import { WarnDialogModule } from 'src/app/modules/warn-dialog/warn-dialog.module';
|
||||
import { HasFeaturePipeModule } from 'src/app/pipes/has-feature-pipe/has-feature-pipe.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
|
||||
import { ChangesModule } from '../../modules/changes/changes.module';
|
||||
import { ZitadelTierModule } from '../../modules/zitadel-tier/zitadel-tier.module';
|
||||
import { AddDomainDialogModule } from './org-detail/add-domain-dialog/add-domain-dialog.module';
|
||||
import { DomainVerificationComponent } from './org-detail/domain-verification/domain-verification.component';
|
||||
import { OrgDetailComponent } from './org-detail/org-detail.component';
|
||||
import { OrgsRoutingModule } from './orgs-routing.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [OrgDetailComponent, DomainVerificationComponent],
|
||||
declarations: [OrgDetailComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
HasRolePipeModule,
|
||||
OrgsRoutingModule,
|
||||
FormsModule,
|
||||
InfoRowModule,
|
||||
HasRoleModule,
|
||||
InputModule,
|
||||
InfoSectionModule,
|
||||
MatButtonModule,
|
||||
MatDialogModule,
|
||||
CardModule,
|
||||
TopViewModule,
|
||||
MatIconModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonToggleModule,
|
||||
MetaLayoutModule,
|
||||
MatTabsModule,
|
||||
MatTooltipModule,
|
||||
@@ -57,7 +57,6 @@ import { OrgsRoutingModule } from './orgs-routing.module';
|
||||
MatMenuModule,
|
||||
ChangesModule,
|
||||
MatProgressSpinnerModule,
|
||||
AddDomainDialogModule,
|
||||
TranslateModule,
|
||||
SharedModule,
|
||||
ContributorsModule,
|
||||
@@ -67,4 +66,4 @@ import { OrgsRoutingModule } from './orgs-routing.module';
|
||||
ZitadelTierModule,
|
||||
],
|
||||
})
|
||||
export class OrgsModule { }
|
||||
export class OrgsModule {}
|
||||
|
||||
Reference in New Issue
Block a user