mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-19 19:48:45 +00:00
fix(console): migrate from tslint to eslint, project delete from table (#2490)
* es lint * modify tsconfig, auto lint some stuff * lint * lint * lint * lint * html ts lint * lint * lint, tsconfig * fix project delete, state table * eslint config, remove cnslHint directive * mfa selector, info row fixes * lint * fix login policy, granted orgs table state, lint Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
co-authored by
Florian Forster
parent
bdf63800f7
commit
b1caef81da
@@ -1,9 +1,9 @@
|
||||
<div class="enlarged-container">
|
||||
<h1>{{ 'GRANTS.TITLE' | translate }}</h1>
|
||||
<p class="desc">{{'GRANTS.DESC' | translate }}</p>
|
||||
<app-user-grants [displayedColumns]="['select', 'user', 'org', 'projectId', 'creationDate','changeDate', 'roleNamesList']"
|
||||
[disableWrite]="((['user.grant.write$'] | hasRole) | async) == false"
|
||||
[disableDelete]="((['user.grant.delete$'] | hasRole) | async) == false"
|
||||
<cnsl-user-grants [displayedColumns]="['select', 'user', 'org', 'projectId', 'creationDate','changeDate', 'roleNamesList']"
|
||||
[disableWrite]="((['user.grant.write$'] | hasRole) | async) === false"
|
||||
[disableDelete]="((['user.grant.delete$'] | hasRole) | async) === false"
|
||||
[refreshOnPreviousRoutes]="['/grant-create']">
|
||||
</app-user-grants>
|
||||
</cnsl-user-grants>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-grants',
|
||||
templateUrl: './grants.component.html',
|
||||
styleUrls: ['./grants.component.scss'],
|
||||
selector: 'cnsl-grants',
|
||||
templateUrl: './grants.component.html',
|
||||
styleUrls: ['./grants.component.scss'],
|
||||
})
|
||||
export class GrantsComponent { }
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
|
||||
<div class="gridcontainer">
|
||||
<ng-template appHasRole [appHasRole]="['iam.write']">
|
||||
<ng-template cnslHasRole [hasRole]="['iam.write']">
|
||||
<a matRipple *ngIf="!firstStepsDismissed" class="onboard" [routerLink]="['/firststeps']">
|
||||
<p class="first-steps">{{'ONBOARDING.HEADER' | translate}}</p>
|
||||
<h2>{{'ONBOARDING.TITLE' | translate}}</h2>
|
||||
@@ -34,8 +34,8 @@
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['iam.write']">
|
||||
<app-card class="griditem" [nomargin]="true">
|
||||
<ng-template cnslHasRole [hasRole]="['iam.write']">
|
||||
<cnsl-card class="griditem" [nomargin]="true">
|
||||
<div class="top">
|
||||
<h2>
|
||||
<i class="icon las la-gem"></i>
|
||||
@@ -44,11 +44,11 @@
|
||||
<p>{{'HOME.IAM_DESC'| translate}}</p>
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['org.create','iam.write']">
|
||||
<ng-template cnslHasRole [hasRole]="['org.create','iam.write']">
|
||||
<a class="short-link" [routerLink]="[ '/org', 'create']">{{'HOME.IAM_CREATE_ORG' | translate}}<i
|
||||
class="las la-link"></i></a>
|
||||
</ng-template>
|
||||
<ng-template appHasRole [appHasRole]="['iam.policy.read']">
|
||||
<ng-template cnslHasRole [hasRole]="['iam.policy.read']">
|
||||
<a class="short-link" [routerLink]="[ '/iam', 'policy','iam']">{{'HOME.IAM_POLICY_IAM' |
|
||||
translate}}<i class="las la-link"></i></a>
|
||||
<a class="short-link" [routerLink]="[ '/iam', 'policy','complexity']">{{'HOME.IAM_POLICY_COMPLEXITY'
|
||||
@@ -63,10 +63,10 @@
|
||||
<div class="footer">
|
||||
<a color="primary" mat-stroked-button [routerLink]="['/iam']">{{'HOME.IAM_BUTTON' | translate}}</a>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
|
||||
<app-card class="griditem" [nomargin]="true">
|
||||
<cnsl-card class="griditem" [nomargin]="true">
|
||||
<div class="top">
|
||||
<h2> <i class="icon las la-user-circle"></i>
|
||||
{{'HOME.SECURITYANDPRIVACY'| translate}}</h2>
|
||||
@@ -80,17 +80,17 @@
|
||||
<a color="primary" mat-stroked-button [routerLink]="['/users/me']">{{'HOME.SECURITYANDPRIVACY_BUTTON' |
|
||||
translate}}</a>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.read']">
|
||||
<app-card class="griditem" [nomargin]="true">
|
||||
<ng-template cnslHasRole [hasRole]="['project.read']">
|
||||
<cnsl-card class="griditem" [nomargin]="true">
|
||||
<div class="top">
|
||||
<h2>
|
||||
<i class="icon las la-layer-group"></i>
|
||||
{{'HOME.PROJECTS'| translate}}
|
||||
</h2>
|
||||
<p>{{'HOME.PROJECTS_DESC'| translate}}</p>
|
||||
<ng-template appHasRole [appHasRole]="['project.create']">
|
||||
<ng-template cnslHasRole [hasRole]="['project.create']">
|
||||
<a class="short-link" [routerLink]="[ '/projects', 'create']">{{'HOME.PROJECTS_NEW_LINK' |
|
||||
translate}}<i class="las la-link"></i></a>
|
||||
</ng-template>
|
||||
@@ -100,20 +100,20 @@
|
||||
<a color="primary" mat-stroked-button [routerLink]="['/projects']">{{'HOME.PROJECTS_BUTTON' |
|
||||
translate}}</a>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['org.read']">
|
||||
<app-card class="griditem" [nomargin]="true">
|
||||
<ng-template cnslHasRole [hasRole]="['org.read']">
|
||||
<cnsl-card class="griditem" [nomargin]="true">
|
||||
<div class="top">
|
||||
<h2> <i class="icon las la-archway"></i>
|
||||
{{'HOME.PROTECTION'| translate}}</h2>
|
||||
<p>{{'HOME.PROTECTION_DESC'| translate}}</p>
|
||||
<ng-template appHasRole [appHasRole]="['iam.policy.read']">
|
||||
<ng-template cnslHasRole [hasRole]="['iam.policy.read']">
|
||||
<a class="short-link" [routerLink]="[ '/org', 'policy','iam']">{{'HOME.ORG_POLICY_IAM' |
|
||||
translate}}<i class="las la-link"></i></a>
|
||||
</ng-template>
|
||||
<ng-template appHasRole [appHasRole]="['policy.read']">
|
||||
<ng-template cnslHasRole [hasRole]="['policy.read']">
|
||||
<a class="short-link"
|
||||
[routerLink]="[ '/org', 'policy','complexity']">{{'HOME.ORG_POLICY_COMPLEXITY' |
|
||||
translate}}<i class="las la-link"></i></a>
|
||||
@@ -128,24 +128,24 @@
|
||||
<a color="primary" mat-stroked-button [routerLink]="['/org']">{{'HOME.PROTECTION_BUTTON' |
|
||||
translate}}</a>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['user.read']">
|
||||
<app-card class="griditem" [nomargin]="true">
|
||||
<ng-template cnslHasRole [hasRole]="['user.read']">
|
||||
<cnsl-card class="griditem" [nomargin]="true">
|
||||
<div class="top">
|
||||
<h2>
|
||||
<i class="las la-users"></i>
|
||||
{{'HOME.USERS'| translate}}
|
||||
</h2>
|
||||
<p>{{'HOME.USERS_DESC'| translate}}</p>
|
||||
<ng-template appHasRole [appHasRole]="['user.read(:[0-9]*)?']">
|
||||
<ng-template cnslHasRole [hasRole]="['user.read(:[0-9]*)?']">
|
||||
<a class="short-link" [routerLink]="[ '/users', 'list', 'humans']">{{'HOME.USERS_HUMANS' |
|
||||
translate}}<i class="las la-link"></i></a>
|
||||
<a class="short-link" [routerLink]="[ '/users', 'list', 'machines']">{{'HOME.USERS_MACHINES' |
|
||||
translate}}<i class="las la-link"></i></a>
|
||||
</ng-template>
|
||||
<ng-template appHasRole [appHasRole]="['user.read']">
|
||||
<ng-template cnslHasRole [hasRole]="['user.read']">
|
||||
<a class="short-link" [routerLink]="[ '/users', 'create']">{{'HOME.USERS_CREATE' | translate}}<i
|
||||
class="las la-link"></i></a>
|
||||
</ng-template>
|
||||
@@ -155,7 +155,7 @@
|
||||
<a color="primary" mat-stroked-button [routerLink]="['/users/list/humans']">{{'HOME.USERS_BUTTON' |
|
||||
translate}}</a>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
selector: 'cnsl-home',
|
||||
templateUrl: './home.component.html',
|
||||
styleUrls: ['./home.component.scss'],
|
||||
})
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<div class="enlarged-container">
|
||||
<h1>{{ 'IAM.EVENTSTORE.TITLE' | translate }}</h1>
|
||||
<p class="desc">{{'IAM.EVENTSTORE.DESCRIPTION' | translate }}</p>
|
||||
<app-card title="{{ 'IAM.VIEWS.TITLE' | translate }}" description="{{ 'IAM.VIEWS.DESCRIPTION' | translate }}">
|
||||
<app-iam-views></app-iam-views>
|
||||
</app-card>
|
||||
<cnsl-card title="{{ 'IAM.VIEWS.TITLE' | translate }}" description="{{ 'IAM.VIEWS.DESCRIPTION' | translate }}">
|
||||
<cnsl-iam-views></cnsl-iam-views>
|
||||
</cnsl-card>
|
||||
|
||||
<app-card title="{{ 'IAM.FAILEDEVENTS.TITLE' | translate }}"
|
||||
<cnsl-card title="{{ 'IAM.FAILEDEVENTS.TITLE' | translate }}"
|
||||
description="{{ 'IAM.FAILEDEVENTS.DESCRIPTION' | translate }}">
|
||||
<app-iam-failed-events></app-iam-failed-events>
|
||||
</app-card>
|
||||
<cnsl-iam-failed-events></cnsl-iam-failed-events>
|
||||
</cnsl-card>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-eventstore',
|
||||
templateUrl: './eventstore.component.html',
|
||||
styleUrls: ['./eventstore.component.scss'],
|
||||
selector: 'cnsl-eventstore',
|
||||
templateUrl: './eventstore.component.html',
|
||||
styleUrls: ['./eventstore.component.scss'],
|
||||
})
|
||||
export class EventstoreComponent { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="table-wrapper">
|
||||
<app-refresh-table *ngIf="eventDataSource" (refreshed)="loadEvents()" [dataSize]="eventDataSource.data.length"
|
||||
<cnsl-refresh-table *ngIf="eventDataSource" (refreshed)="loadEvents()" [dataSize]="eventDataSource.data.length"
|
||||
[loading]="loading$ | async">
|
||||
|
||||
<table [dataSource]="eventDataSource" mat-table class="table " aria-label="Elements">
|
||||
@@ -49,5 +49,5 @@
|
||||
</table>
|
||||
<mat-paginator class="paginator" [pageSize]="10" #paginator [pageSizeOptions]="[10, 20, 100, 250]">
|
||||
</mat-paginator>
|
||||
</app-refresh-table>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
@@ -8,45 +8,43 @@ import { AdminService } from 'src/app/services/admin.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-iam-failed-events',
|
||||
templateUrl: './failed-events.component.html',
|
||||
styleUrls: ['./failed-events.component.scss'],
|
||||
selector: 'cnsl-iam-failed-events',
|
||||
templateUrl: './failed-events.component.html',
|
||||
styleUrls: ['./failed-events.component.scss'],
|
||||
})
|
||||
export class FailedEventsComponent implements AfterViewInit {
|
||||
// public viewTimestamp!: Timestamp.AsObject;
|
||||
@ViewChild(MatPaginator) public eventPaginator!: MatPaginator;
|
||||
public eventDataSource!: MatTableDataSource<FailedEvent.AsObject>;
|
||||
|
||||
@ViewChild(MatPaginator) public eventPaginator!: MatPaginator;
|
||||
public eventDataSource!: MatTableDataSource<FailedEvent.AsObject>;
|
||||
public eventDisplayedColumns: string[] = ['viewName', 'database', 'failedSequence', 'failureCount', 'errorMessage', 'actions'];
|
||||
|
||||
public eventDisplayedColumns: string[] = ['viewName', 'database', 'failedSequence', 'failureCount', 'errorMessage', 'actions'];
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
constructor(private adminService: AdminService, private toast: ToastService) {
|
||||
this.loadEvents();
|
||||
}
|
||||
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
constructor(private adminService: AdminService, private toast: ToastService) {
|
||||
this.loadEvents();
|
||||
}
|
||||
ngAfterViewInit(): void {
|
||||
this.loadEvents();
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.loadEvents();
|
||||
}
|
||||
public loadEvents(): void {
|
||||
this.loadingSubject.next(true);
|
||||
from(this.adminService.listFailedEvents()).pipe(
|
||||
map(resp => {
|
||||
return resp?.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(views => {
|
||||
this.eventDataSource = new MatTableDataSource(views);
|
||||
this.eventDataSource.paginator = this.eventPaginator;
|
||||
});
|
||||
}
|
||||
|
||||
public loadEvents(): void {
|
||||
this.loadingSubject.next(true);
|
||||
from(this.adminService.listFailedEvents()).pipe(
|
||||
map(resp => {
|
||||
return resp?.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(views => {
|
||||
this.eventDataSource = new MatTableDataSource(views);
|
||||
this.eventDataSource.paginator = this.eventPaginator;
|
||||
});
|
||||
}
|
||||
|
||||
public cancelEvent(viewname: string, db: string, seq: number): void {
|
||||
this.adminService.removeFailedEvent(viewname, db, seq).then(() => {
|
||||
this.toast.showInfo('IAM.FAILEDEVENTS.DELETESUCCESS', true);
|
||||
});
|
||||
}
|
||||
public cancelEvent(viewname: string, db: string, seq: number): void {
|
||||
this.adminService.removeFailedEvent(viewname, db, seq).then(() => {
|
||||
this.toast.showInfo('IAM.FAILEDEVENTS.DELETESUCCESS', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,53 +11,53 @@ import { AdminService } from 'src/app/services/admin.service';
|
||||
* (including sorting, pagination, and filtering).
|
||||
*/
|
||||
export class IamMembersDataSource extends DataSource<Member.AsObject> {
|
||||
public totalResult: number = 0;
|
||||
public viewTimestamp!: Timestamp.AsObject;
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public totalResult: number = 0;
|
||||
public viewTimestamp!: Timestamp.AsObject;
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private adminService: AdminService) {
|
||||
super();
|
||||
}
|
||||
constructor(private service: AdminService) {
|
||||
super();
|
||||
}
|
||||
|
||||
public loadMembers(
|
||||
pageIndex: number, pageSize: number): void {
|
||||
const offset = pageIndex * pageSize;
|
||||
public loadMembers(
|
||||
pageIndex: number, pageSize: number): void {
|
||||
const offset = pageIndex * pageSize;
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
this.loadingSubject.next(true);
|
||||
|
||||
from(this.adminService.listIAMMembers(pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.details?.totalResult || 0;
|
||||
if (resp.details?.viewTimestamp) {
|
||||
this.viewTimestamp = resp.details?.viewTimestamp;
|
||||
}
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
}
|
||||
from(this.service.listIAMMembers(pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.details?.totalResult || 0;
|
||||
if (resp.details?.viewTimestamp) {
|
||||
this.viewTimestamp = resp.details?.viewTimestamp;
|
||||
}
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Connect this data source to the table. The table will only update when
|
||||
* the returned stream emits new items.
|
||||
* @returns A stream of the items to be rendered.
|
||||
*/
|
||||
public connect(): Observable<Member.AsObject[]> {
|
||||
return this.membersSubject.asObservable();
|
||||
}
|
||||
/**
|
||||
* Connect this data source to the table. The table will only update when
|
||||
* the returned stream emits new items.
|
||||
* @returns A stream of the items to be rendered.
|
||||
*/
|
||||
public connect(): Observable<Member.AsObject[]> {
|
||||
return this.membersSubject.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the table is being destroyed. Use this function, to clean up
|
||||
* any open connections or free any held resources that were set up during connect.
|
||||
*/
|
||||
public disconnect(): void {
|
||||
this.membersSubject.complete();
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
/**
|
||||
* Called when the table is being destroyed. Use this function, to clean up
|
||||
* any open connections or free any held resources that were set up during connect.
|
||||
*/
|
||||
public disconnect(): void {
|
||||
this.membersSubject.complete();
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<div class="wrapp">
|
||||
<app-detail-layout [backRouterLink]="[ '/iam']" title="{{ 'IAM.MEMBER.TITLE' | translate }}"
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/iam']" title="{{ 'IAM.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'IAM.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>
|
||||
<app-members-table [dataSource]="dataSource" [memberRoleOptions]="memberRoleOptions"
|
||||
<cnsl-members-table [dataSource]="dataSource" [memberRoleOptions]="memberRoleOptions"
|
||||
(updateRoles)="updateRoles($event.member, $event.change)" [factoryLoadFunc]="changePageFactory"
|
||||
(changedSelection)="selection = $event" [refreshTrigger]="changePage"
|
||||
[canWrite]="['iam.member.write$'] | hasRole | async" [canDelete]="['iam.member.delete$'] | hasRole | async"
|
||||
(deleteMember)="removeMember($event)">
|
||||
|
||||
<ng-template appHasRole selectactions [appHasRole]="['iam.member.delete']">
|
||||
<ng-template cnslHasRole selectactions [hasRole]="['iam.member.delete']">
|
||||
<button color="warn" (click)="removeMemberSelection()"
|
||||
matTooltip="{{'ORG_DETAIL.TABLE.DELETE' | translate}}" class="del-button" mat-raised-button>
|
||||
<i class="las la-trash"></i>
|
||||
{{'ACTIONS.SELECTIONDELETE' | translate}}
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template appHasRole writeactions [appHasRole]="['iam.member.write']">
|
||||
<ng-template cnslHasRole writeactions [hasRole]="['iam.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>
|
||||
</app-members-table>
|
||||
</app-detail-layout>
|
||||
</cnsl-members-table>
|
||||
</cnsl-detail-layout>
|
||||
</div>
|
||||
@@ -11,100 +11,100 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { IamMembersDataSource } from './iam-members-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-iam-members',
|
||||
templateUrl: './iam-members.component.html',
|
||||
styleUrls: ['./iam-members.component.scss'],
|
||||
selector: 'cnsl-iam-members',
|
||||
templateUrl: './iam-members.component.html',
|
||||
styleUrls: ['./iam-members.component.scss'],
|
||||
})
|
||||
export class IamMembersComponent {
|
||||
public INITIALPAGESIZE: number = 25;
|
||||
public dataSource!: IamMembersDataSource;
|
||||
public INITIALPAGESIZE: number = 25;
|
||||
public dataSource!: IamMembersDataSource;
|
||||
|
||||
public memberRoleOptions: string[] = [];
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
public memberRoleOptions: string[] = [];
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
|
||||
constructor(private adminService: AdminService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService) {
|
||||
constructor(private adminService: AdminService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService) {
|
||||
|
||||
this.dataSource = new IamMembersDataSource(this.adminService);
|
||||
this.dataSource.loadMembers(0, 25);
|
||||
this.getRoleOptions();
|
||||
this.dataSource = new IamMembersDataSource(this.adminService);
|
||||
this.dataSource.loadMembers(0, 25);
|
||||
this.getRoleOptions();
|
||||
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
return this.dataSource.loadMembers(
|
||||
event?.pageIndex ?? 0,
|
||||
event?.pageSize ?? this.INITIALPAGESIZE,
|
||||
);
|
||||
};
|
||||
}
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
return this.dataSource.loadMembers(
|
||||
event?.pageIndex ?? 0,
|
||||
event?.pageSize ?? this.INITIALPAGESIZE,
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public getRoleOptions(): void {
|
||||
this.adminService.listIAMMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.rolesList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
public getRoleOptions(): void {
|
||||
this.adminService.listIAMMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.rolesList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
updateRoles(member: Member.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.adminService.updateIAMMember(member.userId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
updateRoles(member: Member.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.adminService.updateIAMMember(member.userId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public removeMemberSelection(): void {
|
||||
Promise.all(this.selection.map(member => {
|
||||
return this.adminService.removeIAMMember(member.userId).then(() => {
|
||||
this.toast.showInfo('IAM.TOAST.MEMBERREMOVED', true);
|
||||
this.changePage.emit();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
public removeMemberSelection(): void {
|
||||
Promise.all(this.selection.map(member => {
|
||||
return this.adminService.removeIAMMember(member.userId).then(() => {
|
||||
this.toast.showInfo('IAM.TOAST.MEMBERREMOVED', true);
|
||||
this.changePage.emit();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
public removeMember(member: Member.AsObject): void {
|
||||
this.adminService.removeIAMMember(member.userId).then(() => {
|
||||
this.toast.showInfo('IAM.TOAST.MEMBERREMOVED', true);
|
||||
public removeMember(member: Member.AsObject): void {
|
||||
this.adminService.removeIAMMember(member.userId).then(() => {
|
||||
this.toast.showInfo('IAM.TOAST.MEMBERREMOVED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public openAddMember(): void {
|
||||
const dialogRef = this.dialog.open(MemberCreateDialogComponent, {
|
||||
data: {
|
||||
creationType: CreationType.IAM,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
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.adminService.addIAMMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('IAM.TOAST.MEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public openAddMember(): void {
|
||||
const dialogRef = this.dialog.open(MemberCreateDialogComponent, {
|
||||
data: {
|
||||
creationType: CreationType.IAM,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
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.adminService.addIAMMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('IAM.TOAST.MEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +1,50 @@
|
||||
<div class="table-wrapper">
|
||||
<app-refresh-table *ngIf="dataSource" (refreshed)="loadViews()" [dataSize]="dataSource.data.length"
|
||||
[loading]="loading$ | async">
|
||||
<cnsl-refresh-table *ngIf="dataSource" (refreshed)="loadViews()" [dataSize]="dataSource.data.length"
|
||||
[loading]="loading$ | async">
|
||||
|
||||
<table [dataSource]="dataSource" mat-table class="table" aria-label="Elements" matSort>
|
||||
<ng-container matColumnDef="viewName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'IAM.VIEWS.VIEWNAME' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view"> {{view.viewName}} </td>
|
||||
</ng-container>
|
||||
<table [dataSource]="dataSource" mat-table class="table views-table" aria-label="Views" matSort>
|
||||
<ng-container matColumnDef="viewName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'IAM.VIEWS.VIEWNAME' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view"> {{view.viewName}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="database">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'IAM.VIEWS.DATABASE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view"> {{view.database}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="database">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'IAM.VIEWS.DATABASE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view"> {{view.database}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="sequence">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'IAM.VIEWS.SEQUENCE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view"> {{view.processedSequence}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="sequence">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'IAM.VIEWS.SEQUENCE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view"> {{view.processedSequence}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="eventTimestamp">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'IAM.VIEWS.EVENTTIMESTAMP' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view">
|
||||
<span>{{view?.eventTimestamp | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="eventTimestamp">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'IAM.VIEWS.EVENTTIMESTAMP' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view">
|
||||
<span>{{view?.eventTimestamp | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="lastSuccessfulSpoolerRun">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'IAM.VIEWS.LASTSPOOL' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view">
|
||||
<span>{{view?.lastSuccessfulSpoolerRun | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="lastSuccessfulSpoolerRun">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'IAM.VIEWS.LASTSPOOL' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let view">
|
||||
<span>{{view?.lastSuccessfulSpoolerRun | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let view">
|
||||
<button mat-icon-button matTooltip="{{'IAM.VIEWS.CLEAR' | translate}}" color="warn"
|
||||
(click)="cancelView(view.viewName, view.database)">
|
||||
<mat-icon svgIcon="mdi_broom"></mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="actions" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let view">
|
||||
<button mat-icon-button matTooltip="{{'IAM.VIEWS.CLEAR' | translate}}" color="warn"
|
||||
(click)="cancelView(view.viewName, view.database)">
|
||||
<mat-icon svgIcon="mdi_broom"></mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<mat-paginator class="paginator" [pageSize]="10" #paginator [pageSizeOptions]="[10, 20, 100, 250]">
|
||||
</mat-paginator>
|
||||
</app-refresh-table>
|
||||
</div>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
<mat-paginator class="paginator" [pageSize]="10" #paginator [pageSizeOptions]="[10, 20, 100, 250]">
|
||||
</mat-paginator>
|
||||
</cnsl-refresh-table>
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.views-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
tr {
|
||||
button {
|
||||
visibility: hidden;
|
||||
|
||||
@@ -11,63 +11,63 @@ import { AdminService } from 'src/app/services/admin.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-iam-views',
|
||||
templateUrl: './iam-views.component.html',
|
||||
styleUrls: ['./iam-views.component.scss'],
|
||||
selector: 'cnsl-iam-views',
|
||||
templateUrl: './iam-views.component.html',
|
||||
styleUrls: ['./iam-views.component.scss'],
|
||||
})
|
||||
export class IamViewsComponent implements AfterViewInit {
|
||||
@ViewChild(MatSort) sort!: MatSort;
|
||||
@ViewChild(MatSort) sort!: MatSort;
|
||||
|
||||
@ViewChild(MatPaginator) public paginator!: MatPaginator;
|
||||
public dataSource!: MatTableDataSource<View.AsObject>;
|
||||
@ViewChild(MatPaginator) public paginator!: MatPaginator;
|
||||
public dataSource!: MatTableDataSource<View.AsObject>;
|
||||
|
||||
public displayedColumns: string[] = ['viewName', 'database', 'sequence', 'eventTimestamp', 'lastSuccessfulSpoolerRun', 'actions'];
|
||||
public displayedColumns: string[] = ['viewName', 'database', 'sequence', 'eventTimestamp', 'lastSuccessfulSpoolerRun', 'actions'];
|
||||
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
constructor(private adminService: AdminService, private dialog: MatDialog, private toast: ToastService) {
|
||||
this.loadViews();
|
||||
}
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
constructor(private adminService: AdminService, private dialog: MatDialog, private toast: ToastService) {
|
||||
this.loadViews();
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.loadViews();
|
||||
}
|
||||
ngAfterViewInit(): void {
|
||||
this.loadViews();
|
||||
}
|
||||
|
||||
public loadViews(): void {
|
||||
this.loadingSubject.next(true);
|
||||
from(this.adminService.listViews()).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;
|
||||
public loadViews(): void {
|
||||
this.loadingSubject.next(true);
|
||||
from(this.adminService.listViews()).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;
|
||||
});
|
||||
}
|
||||
|
||||
public cancelView(viewname: string, db: string): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.CLEAR',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'IAM.VIEWS.DIALOG.VIEW_CLEAR_TITLE',
|
||||
descriptionKey: 'IAM.VIEWS.DIALOG.VIEW_CLEAR_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.adminService.clearView(viewname, db).then(() => {
|
||||
this.toast.showInfo('IAM.VIEWS.CLEARED', true);
|
||||
this.loadViews();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public cancelView(viewname: string, db: string): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.CLEAR',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'IAM.VIEWS.DIALOG.VIEW_CLEAR_TITLE',
|
||||
descriptionKey: 'IAM.VIEWS.DIALOG.VIEW_CLEAR_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.adminService.clearView(viewname, db).then(() => {
|
||||
this.toast.showInfo('IAM.VIEWS.CLEARED', true);
|
||||
this.loadViews();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<app-meta-layout>
|
||||
<cnsl-meta-layout>
|
||||
<div class="enlarged-container">
|
||||
<h1 class="h1">{{'IAM.POLICIES.TITLE' | translate}}</h1>
|
||||
<p class="sub">{{'IAM.POLICIES.DESCRIPTION' | translate}} </p>
|
||||
@@ -7,14 +7,14 @@
|
||||
<p class="top-desc">{{'FEATURES.DESCRIPTION' | translate}}</p>
|
||||
<cnsl-zitadel-tier [features]="features" [iam]="true"></cnsl-zitadel-tier>
|
||||
|
||||
<app-policy-grid [type]="PolicyComponentServiceType.ADMIN"></app-policy-grid>
|
||||
<cnsl-policy-grid [type]="PolicyComponentServiceType.ADMIN"></cnsl-policy-grid>
|
||||
</div>
|
||||
|
||||
<div metainfo>
|
||||
<app-contributors [totalResult]="totalMemberResult" [loading]="loading$ | async"
|
||||
<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">
|
||||
</app-contributors>
|
||||
</cnsl-contributors>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
|
||||
@@ -12,7 +12,7 @@ import { AdminService } from 'src/app/services/admin.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-iam',
|
||||
selector: 'cnsl-iam',
|
||||
templateUrl: './iam.component.html',
|
||||
styleUrls: ['./iam.component.scss'],
|
||||
})
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['iam.write']">
|
||||
<mat-slide-toggle [disabled]="currentCreateStep != 1" class="example-margin" color="primary"
|
||||
<ng-template cnslHasRole [hasRole]="['iam.write']">
|
||||
<mat-slide-toggle [disabled]="currentCreateStep !== 1" class="example-margin" color="primary"
|
||||
(change)="changeSelf($event)" [(ngModel)]="forSelf">
|
||||
Use your personal account as organisation owner
|
||||
</mat-slide-toggle>
|
||||
|
||||
<ng-container *ngIf="!forSelf">
|
||||
<ng-container *ngIf="currentCreateStep == 1">
|
||||
<ng-container *ngIf="currentCreateStep === 1">
|
||||
<h1>{{'ORG.PAGES.ORGDETAIL_TITLE' | translate}} </h1>
|
||||
|
||||
<form [formGroup]="orgForm" (ngSubmit)="next()">
|
||||
@@ -37,7 +37,7 @@
|
||||
</form>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="currentCreateStep == createSteps">
|
||||
<ng-container *ngIf="currentCreateStep === createSteps">
|
||||
<h1>{{'ORG.PAGES.ORGDETAILUSER_TITLE' | translate}}</h1>
|
||||
|
||||
<div class="user">
|
||||
@@ -47,35 +47,35 @@
|
||||
<cnsl-form-field class="formfield" appearance="outline">
|
||||
<cnsl-label>{{ 'USER.PROFILE.USERNAME' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="userName" required />
|
||||
<span cnsl-error *ngIf="userName?.invalid && userName?.errors?.required">
|
||||
<span cnslError *ngIf="userName?.invalid && userName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield" appearance="outline">
|
||||
<cnsl-label>{{ 'USER.PROFILE.EMAIL' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="email" required />
|
||||
<span cnsl-error *ngIf="email?.invalid && email?.errors?.required">
|
||||
<span cnslError *ngIf="email?.invalid && email?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield" appearance="outline">
|
||||
<cnsl-label>{{ 'USER.PROFILE.FIRSTNAME' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="firstName" required />
|
||||
<span cnsl-error *ngIf="firstName?.invalid && firstName?.errors?.required">
|
||||
<span cnslError *ngIf="firstName?.invalid && firstName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield" appearance="outline">
|
||||
<cnsl-label>{{ 'USER.PROFILE.LASTNAME' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="lastName" required />
|
||||
<span cnsl-error *ngIf="lastName?.invalid && lastName?.errors?.required">
|
||||
<span cnslError *ngIf="lastName?.invalid && lastName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield" appearance="outline">
|
||||
<cnsl-label>{{ 'USER.PROFILE.NICKNAME' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="nickName" />
|
||||
<span cnsl-error *ngIf="nickName?.invalid && nickName?.errors?.required">
|
||||
<span cnslError *ngIf="nickName?.invalid && nickName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -89,7 +89,7 @@
|
||||
{{ 'GENDERS.'+gender | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<span cnsl-error *ngIf="gender?.invalid && gender?.errors?.required">
|
||||
<span cnslError *ngIf="gender?.invalid && gender?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -99,7 +99,7 @@
|
||||
<mat-option *ngFor="let language of languages" [value]="language">
|
||||
{{ 'LANGUAGES.'+language | translate }}
|
||||
</mat-option>
|
||||
<span cnsl-error
|
||||
<span cnslError
|
||||
*ngIf="preferredLanguage?.invalid && preferredLanguage?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
@@ -113,9 +113,9 @@
|
||||
<ng-container *ngIf="usePassword && pwdForm">
|
||||
<p class="section">{{ 'USER.CREATE.PASSWORDSECTION' | translate }}</p>
|
||||
|
||||
<app-password-complexity-view class="complexity-view" [policy]="this.policy"
|
||||
<cnsl-password-complexity-view class="complexity-view" [policy]="this.policy"
|
||||
[password]="password">
|
||||
</app-password-complexity-view>
|
||||
</cnsl-password-complexity-view>
|
||||
|
||||
<form [formGroup]="pwdForm" class="pwd-form">
|
||||
<cnsl-form-field class="pwd" *ngIf="password" appearance="outline">
|
||||
@@ -123,7 +123,7 @@
|
||||
<input cnslInput autocomplete="off" name="firstpassword"
|
||||
formControlName="password" type="password" />
|
||||
|
||||
<span cnsl-error *ngIf="password?.errors?.required">
|
||||
<span cnslError *ngIf="password?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
|
||||
@@ -133,10 +133,10 @@
|
||||
<input cnslInput autocomplete="off" name="confirmPassword"
|
||||
formControlName="confirmPassword" type="password" />
|
||||
|
||||
<span cnsl-error *ngIf="confirmPassword?.errors?.required">
|
||||
<span cnslError *ngIf="confirmPassword?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
<span cnsl-error *ngIf="confirmPassword?.errors?.notequal">
|
||||
<span cnslError *ngIf="confirmPassword?.errors?.notequal">
|
||||
{{ 'USER.PASSWORD.NOTEQUAL' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -156,9 +156,9 @@
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-template>
|
||||
<ng-template appHasRole [appHasRole]="['org.create']">
|
||||
<ng-template cnslHasRole [hasRole]="['org.create']">
|
||||
<div *ngIf="forSelf">
|
||||
<ng-container *ngIf="currentCreateStep == 1">
|
||||
<ng-container *ngIf="currentCreateStep === 1">
|
||||
<h1>{{'ORG.PAGES.ORGDETAIL_TITLE_WITHOUT_DOMAIN' | translate}} </h1>
|
||||
|
||||
<form [formGroup]="orgForm" (ngSubmit)="createOrgForSelf()">
|
||||
|
||||
@@ -15,257 +15,257 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
function passwordConfirmValidator(c: AbstractControl): any {
|
||||
if (!c.parent || !c) {
|
||||
return;
|
||||
}
|
||||
const pwd = c.parent.get('password');
|
||||
const cpwd = c.parent.get('confirmPassword');
|
||||
if (!c.parent || !c) {
|
||||
return;
|
||||
}
|
||||
const pwd = c.parent.get('password');
|
||||
const cpwd = c.parent.get('confirmPassword');
|
||||
|
||||
if (!pwd || !cpwd) {
|
||||
return;
|
||||
}
|
||||
if (pwd.value !== cpwd.value) {
|
||||
return {
|
||||
invalid: true,
|
||||
notequal: {
|
||||
valid: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
if (!pwd || !cpwd) {
|
||||
return;
|
||||
}
|
||||
if (pwd.value !== cpwd.value) {
|
||||
return {
|
||||
invalid: true,
|
||||
notequal: {
|
||||
valid: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-create',
|
||||
templateUrl: './org-create.component.html',
|
||||
styleUrls: ['./org-create.component.scss'],
|
||||
animations: [
|
||||
trigger('openClose', [
|
||||
transition(':enter', [
|
||||
style({ height: '0', opacity: 0 }),
|
||||
animate('150ms ease-in-out', style({ height: '*', opacity: 1 })),
|
||||
]),
|
||||
transition(':leave', [
|
||||
animate('150ms ease-in-out', style({ height: '0', opacity: 0 })),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
selector: 'cnsl-org-create',
|
||||
templateUrl: './org-create.component.html',
|
||||
styleUrls: ['./org-create.component.scss'],
|
||||
animations: [
|
||||
trigger('openClose', [
|
||||
transition(':enter', [
|
||||
style({ height: '0', opacity: 0 }),
|
||||
animate('150ms ease-in-out', style({ height: '*', opacity: 1 })),
|
||||
]),
|
||||
transition(':leave', [
|
||||
animate('150ms ease-in-out', style({ height: '0', opacity: 0 })),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class OrgCreateComponent {
|
||||
public orgForm!: FormGroup;
|
||||
public userForm!: FormGroup;
|
||||
public pwdForm!: FormGroup;
|
||||
public orgForm!: FormGroup;
|
||||
public userForm!: FormGroup;
|
||||
public pwdForm!: FormGroup;
|
||||
|
||||
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
|
||||
public languages: string[] = ['de', 'en'];
|
||||
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
|
||||
public languages: string[] = ['de', 'en'];
|
||||
|
||||
public policy!: PasswordComplexityPolicy.AsObject;
|
||||
public usePassword: boolean = false;
|
||||
public policy!: PasswordComplexityPolicy.AsObject;
|
||||
public usePassword: boolean = false;
|
||||
|
||||
public forSelf: boolean = true;
|
||||
public forSelf: boolean = true;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private adminService: AdminService,
|
||||
private _location: Location,
|
||||
private fb: FormBuilder,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
) {
|
||||
this.authService.isAllowed(['iam.write']).pipe(take(1)).subscribe((allowed) => {
|
||||
if (allowed) {
|
||||
this.forSelf = false;
|
||||
}
|
||||
});
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private adminService: AdminService,
|
||||
private _location: Location,
|
||||
private fb: FormBuilder,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
) {
|
||||
this.authService.isAllowed(['iam.write']).pipe(take(1)).subscribe((allowed) => {
|
||||
if (allowed) {
|
||||
this.forSelf = false;
|
||||
}
|
||||
});
|
||||
|
||||
this.orgForm = this.fb.group({
|
||||
name: ['', [Validators.required]],
|
||||
domain: [''],
|
||||
});
|
||||
this.orgForm = this.fb.group({
|
||||
name: ['', [Validators.required]],
|
||||
domain: [''],
|
||||
});
|
||||
|
||||
this.initForm();
|
||||
this.initForm();
|
||||
}
|
||||
|
||||
public createSteps: number = 2;
|
||||
public currentCreateStep: number = 1;
|
||||
|
||||
public finish(): void {
|
||||
const createOrgRequest: SetUpOrgRequest.Org = new SetUpOrgRequest.Org();
|
||||
createOrgRequest.setName(this.name?.value);
|
||||
createOrgRequest.setDomain(this.domain?.value);
|
||||
|
||||
const humanRequest: SetUpOrgRequest.Human = new SetUpOrgRequest.Human();
|
||||
humanRequest.setEmail(new SetUpOrgRequest.Human.Email().setEmail(this.email?.value));
|
||||
humanRequest.setUserName(this.userName?.value);
|
||||
|
||||
const profile: SetUpOrgRequest.Human.Profile = new SetUpOrgRequest.Human.Profile();
|
||||
profile.setFirstName(this.firstName?.value);
|
||||
profile.setLastName(this.lastName?.value);
|
||||
profile.setNickName(this.nickName?.value);
|
||||
profile.setGender(this.gender?.value);
|
||||
profile.setPreferredLanguage(this.preferredLanguage?.value);
|
||||
|
||||
humanRequest.setProfile(profile);
|
||||
if (this.usePassword && this.password) {
|
||||
humanRequest.setPassword(this.password?.value);
|
||||
}
|
||||
|
||||
public createSteps: number = 2;
|
||||
public currentCreateStep: number = 1;
|
||||
this.adminService
|
||||
.SetUpOrg(createOrgRequest, humanRequest)
|
||||
.then((resp) => {
|
||||
this.router.navigate(['/org/overview']);
|
||||
|
||||
public finish(): void {
|
||||
const createOrgRequest: SetUpOrgRequest.Org = new SetUpOrgRequest.Org();
|
||||
createOrgRequest.setName(this.name?.value);
|
||||
createOrgRequest.setDomain(this.domain?.value);
|
||||
// const orgResp = org.getOrg();
|
||||
// if (orgResp) {
|
||||
// this.authService.setActiveOrg(orgResp.toObject());
|
||||
// this.router.navigate(['/org']);
|
||||
// } else {
|
||||
// this.router.navigate(['/org', 'overview']);
|
||||
// }
|
||||
})
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
const humanRequest: SetUpOrgRequest.Human = new SetUpOrgRequest.Human();
|
||||
humanRequest.setEmail(new SetUpOrgRequest.Human.Email().setEmail(this.email?.value));
|
||||
humanRequest.setUserName(this.userName?.value);
|
||||
public next(): void {
|
||||
this.currentCreateStep++;
|
||||
}
|
||||
|
||||
const profile: SetUpOrgRequest.Human.Profile = new SetUpOrgRequest.Human.Profile();
|
||||
profile.setFirstName(this.firstName?.value);
|
||||
profile.setLastName(this.lastName?.value);
|
||||
profile.setNickName(this.nickName?.value);
|
||||
profile.setGender(this.gender?.value);
|
||||
profile.setPreferredLanguage(this.preferredLanguage?.value);
|
||||
public previous(): void {
|
||||
this.currentCreateStep--;
|
||||
}
|
||||
|
||||
humanRequest.setProfile(profile);
|
||||
if (this.usePassword && this.password) {
|
||||
humanRequest.setPassword(this.password?.value);
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
userName: ['', [Validators.required]],
|
||||
firstName: ['', [Validators.required]],
|
||||
lastName: ['', [Validators.required]],
|
||||
email: ['', [Validators.required]],
|
||||
gender: [''],
|
||||
nickName: [''],
|
||||
preferredLanguage: [''],
|
||||
});
|
||||
}
|
||||
|
||||
public initPwdValidators(): void {
|
||||
const validators: Validators[] = [Validators.required];
|
||||
|
||||
if (this.usePassword) {
|
||||
this.mgmtService.getDefaultPasswordComplexityPolicy().then(data => {
|
||||
if (data.policy) {
|
||||
this.policy = data.policy;
|
||||
|
||||
if (this.policy.minLength) {
|
||||
validators.push(Validators.minLength(this.policy.minLength));
|
||||
}
|
||||
if (this.policy.hasLowercase) {
|
||||
validators.push(lowerCaseValidator);
|
||||
}
|
||||
if (this.policy.hasUppercase) {
|
||||
validators.push(upperCaseValidator);
|
||||
}
|
||||
if (this.policy.hasNumber) {
|
||||
validators.push(numberValidator);
|
||||
}
|
||||
if (this.policy.hasSymbol) {
|
||||
validators.push(symbolValidator);
|
||||
}
|
||||
|
||||
const pwdValidators = [...validators] as ValidatorFn[];
|
||||
const confirmPwdValidators = [...validators, passwordConfirmValidator] as ValidatorFn[];
|
||||
this.pwdForm = this.fb.group({
|
||||
password: ['', pwdValidators],
|
||||
confirmPassword: ['', confirmPwdValidators],
|
||||
});
|
||||
}
|
||||
|
||||
this.adminService
|
||||
.SetUpOrg(createOrgRequest, humanRequest)
|
||||
.then((resp) => {
|
||||
this.router.navigate(['/org/overview']);
|
||||
|
||||
// const orgResp = org.getOrg();
|
||||
// if (orgResp) {
|
||||
// this.authService.setActiveOrg(orgResp.toObject());
|
||||
// this.router.navigate(['/org']);
|
||||
// } else {
|
||||
// this.router.navigate(['/org', 'overview']);
|
||||
// }
|
||||
})
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.pwdForm = this.fb.group({
|
||||
password: ['', []],
|
||||
confirmPassword: ['', []],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public next(): void {
|
||||
this.currentCreateStep++;
|
||||
public changeSelf(change: MatSlideToggleChange): void {
|
||||
if (change.checked) {
|
||||
this.createSteps = 1;
|
||||
|
||||
this.orgForm = this.fb.group({
|
||||
name: ['', [Validators.required]],
|
||||
});
|
||||
|
||||
} else {
|
||||
this.createSteps = 2;
|
||||
|
||||
this.orgForm = this.fb.group({
|
||||
name: ['', [Validators.required]],
|
||||
domain: [''],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public previous(): void {
|
||||
this.currentCreateStep--;
|
||||
public createOrgForSelf(): void {
|
||||
if (this.name && this.name.value) {
|
||||
this.mgmtService.addOrg(this.name.value).then(() => {
|
||||
this.router.navigate(['/org/overview']);
|
||||
// const newOrg = org.toObject();
|
||||
// setTimeout(() => {
|
||||
// this.authService.setActiveOrg(newOrg);
|
||||
// this.router.navigate(['/org']);
|
||||
// }, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
userName: ['', [Validators.required]],
|
||||
firstName: ['', [Validators.required]],
|
||||
lastName: ['', [Validators.required]],
|
||||
email: ['', [Validators.required]],
|
||||
gender: [''],
|
||||
nickName: [''],
|
||||
preferredLanguage: [''],
|
||||
});
|
||||
}
|
||||
public get name(): AbstractControl | null {
|
||||
return this.orgForm.get('name');
|
||||
}
|
||||
|
||||
public initPwdValidators(): void {
|
||||
const validators: Validators[] = [Validators.required];
|
||||
public get domain(): AbstractControl | null {
|
||||
return this.orgForm.get('domain');
|
||||
}
|
||||
|
||||
if (this.usePassword) {
|
||||
this.mgmtService.getDefaultPasswordComplexityPolicy().then(data => {
|
||||
if (data.policy) {
|
||||
this.policy = data.policy;
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
|
||||
if (this.policy.minLength) {
|
||||
validators.push(Validators.minLength(this.policy.minLength));
|
||||
}
|
||||
if (this.policy.hasLowercase) {
|
||||
validators.push(lowerCaseValidator);
|
||||
}
|
||||
if (this.policy.hasUppercase) {
|
||||
validators.push(upperCaseValidator);
|
||||
}
|
||||
if (this.policy.hasNumber) {
|
||||
validators.push(numberValidator);
|
||||
}
|
||||
if (this.policy.hasSymbol) {
|
||||
validators.push(symbolValidator);
|
||||
}
|
||||
public get firstName(): AbstractControl | null {
|
||||
return this.userForm.get('firstName');
|
||||
}
|
||||
|
||||
const pwdValidators = [...validators] as ValidatorFn[];
|
||||
const confirmPwdValidators = [...validators, passwordConfirmValidator] as ValidatorFn[];
|
||||
this.pwdForm = this.fb.group({
|
||||
password: ['', pwdValidators],
|
||||
confirmPassword: ['', confirmPwdValidators],
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.pwdForm = this.fb.group({
|
||||
password: ['', []],
|
||||
confirmPassword: ['', []],
|
||||
});
|
||||
}
|
||||
}
|
||||
public get lastName(): AbstractControl | null {
|
||||
return this.userForm.get('lastName');
|
||||
}
|
||||
|
||||
public changeSelf(change: MatSlideToggleChange): void {
|
||||
if (change.checked) {
|
||||
this.createSteps = 1;
|
||||
public get email(): AbstractControl | null {
|
||||
return this.userForm.get('email');
|
||||
}
|
||||
|
||||
this.orgForm = this.fb.group({
|
||||
name: ['', [Validators.required]],
|
||||
});
|
||||
public get nickName(): AbstractControl | null {
|
||||
return this.userForm.get('nickName');
|
||||
}
|
||||
|
||||
} else {
|
||||
this.createSteps = 2;
|
||||
public get preferredLanguage(): AbstractControl | null {
|
||||
return this.userForm.get('preferredLanguage');
|
||||
}
|
||||
|
||||
this.orgForm = this.fb.group({
|
||||
name: ['', [Validators.required]],
|
||||
domain: [''],
|
||||
});
|
||||
}
|
||||
}
|
||||
public get gender(): AbstractControl | null {
|
||||
return this.userForm.get('gender');
|
||||
}
|
||||
|
||||
public createOrgForSelf(): void {
|
||||
if (this.name && this.name.value) {
|
||||
this.mgmtService.addOrg(this.name.value).then(() => {
|
||||
this.router.navigate(['/org/overview']);
|
||||
// const newOrg = org.toObject();
|
||||
// setTimeout(() => {
|
||||
// this.authService.setActiveOrg(newOrg);
|
||||
// this.router.navigate(['/org']);
|
||||
// }, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
public get password(): AbstractControl | null {
|
||||
return this.pwdForm.get('password');
|
||||
}
|
||||
|
||||
public get name(): AbstractControl | null {
|
||||
return this.orgForm.get('name');
|
||||
}
|
||||
public get confirmPassword(): AbstractControl | null {
|
||||
return this.pwdForm.get('confirmPassword');
|
||||
}
|
||||
|
||||
public get domain(): AbstractControl | null {
|
||||
return this.orgForm.get('domain');
|
||||
}
|
||||
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
|
||||
public get firstName(): AbstractControl | null {
|
||||
return this.userForm.get('firstName');
|
||||
}
|
||||
|
||||
public get lastName(): AbstractControl | null {
|
||||
return this.userForm.get('lastName');
|
||||
}
|
||||
|
||||
public get email(): AbstractControl | null {
|
||||
return this.userForm.get('email');
|
||||
}
|
||||
|
||||
public get nickName(): AbstractControl | null {
|
||||
return this.userForm.get('nickName');
|
||||
}
|
||||
|
||||
public get preferredLanguage(): AbstractControl | null {
|
||||
return this.userForm.get('preferredLanguage');
|
||||
}
|
||||
|
||||
public get gender(): AbstractControl | null {
|
||||
return this.userForm.get('gender');
|
||||
}
|
||||
|
||||
public get password(): AbstractControl | null {
|
||||
return this.pwdForm.get('password');
|
||||
}
|
||||
|
||||
public get confirmPassword(): AbstractControl | null {
|
||||
return this.pwdForm.get('confirmPassword');
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
}
|
||||
|
||||
+16
-19
@@ -1,26 +1,23 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-domain-dialog',
|
||||
templateUrl: './add-domain-dialog.component.html',
|
||||
styleUrls: ['./add-domain-dialog.component.scss'],
|
||||
selector: 'cnsl-add-domain-dialog',
|
||||
templateUrl: './add-domain-dialog.component.html',
|
||||
styleUrls: ['./add-domain-dialog.component.scss'],
|
||||
})
|
||||
export class AddDomainDialogComponent implements OnInit {
|
||||
public newdomain: string = '';
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<AddDomainDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
export class AddDomainDialogComponent {
|
||||
public newdomain: string = '';
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<AddDomainDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
public closeDialogWithSuccess(): void {
|
||||
this.dialogRef.close(this.newdomain);
|
||||
}
|
||||
public closeDialogWithSuccess(): void {
|
||||
this.dialogRef.close(this.newdomain);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -47,10 +47,10 @@
|
||||
<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"
|
||||
appCopyToClipboard [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 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 }}
|
||||
|
||||
+52
-52
@@ -7,69 +7,69 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-domain-verification',
|
||||
templateUrl: './domain-verification.component.html',
|
||||
styleUrls: ['./domain-verification.component.scss'],
|
||||
selector: 'cnsl-domain-verification',
|
||||
templateUrl: './domain-verification.component.html',
|
||||
styleUrls: ['./domain-verification.component.scss'],
|
||||
})
|
||||
export class DomainVerificationComponent {
|
||||
public domain!: Domain.AsObject;
|
||||
public domain!: Domain.AsObject;
|
||||
|
||||
public DomainValidationType: any = DomainValidationType;
|
||||
public DomainValidationType: any = DomainValidationType;
|
||||
|
||||
public http!: GenerateOrgDomainValidationResponse.AsObject;
|
||||
public dns!: GenerateOrgDomainValidationResponse.AsObject;
|
||||
public http!: GenerateOrgDomainValidationResponse.AsObject;
|
||||
public dns!: GenerateOrgDomainValidationResponse.AsObject;
|
||||
|
||||
public copied: string = '';
|
||||
public copied: string = '';
|
||||
|
||||
public showNew: boolean = false;
|
||||
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;
|
||||
}
|
||||
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 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;
|
||||
});
|
||||
}
|
||||
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 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 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');
|
||||
}
|
||||
public saveFile(): void {
|
||||
const blob = new Blob([this.http.token], { type: 'text/plain;charset=utf-8' });
|
||||
saveAs(blob, this.http.token + '.txt');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<app-meta-layout>
|
||||
<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$">
|
||||
<app-card title="{{ 'ORG.DOMAINS.TITLE' | translate }}"
|
||||
<cnsl-card title="{{ 'ORG.DOMAINS.TITLE' | translate }}"
|
||||
description="{{ 'ORG.DOMAINS.DESCRIPTION' | translate }}">
|
||||
|
||||
<button class="icon-button" (click)="loadDomains()" card-actions mat-icon-button>
|
||||
@@ -17,7 +17,7 @@
|
||||
<ng-template #noCustom>
|
||||
<span class="title disabled">{{domain.domainName}}</span>
|
||||
</ng-template>
|
||||
<span *ngIf="(canwrite$ | async) == false" class="title disabled">{{domain?.domainName}}</span>
|
||||
<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>
|
||||
@@ -25,20 +25,20 @@
|
||||
(click)="setPrimary(domain)">{{'ORG.DOMAINS.SETPRIMARY' | translate}}</a>
|
||||
|
||||
<span class="fill-space"></span>
|
||||
<button class="rem-button" [disabled]="(canwrite$ | async) == false" matTooltip="Remove domain"
|
||||
<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="WARN">
|
||||
<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
|
||||
<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>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="['features.read'] | hasRole | async">
|
||||
@@ -47,8 +47,8 @@
|
||||
<cnsl-zitadel-tier [features]="features"></cnsl-zitadel-tier>
|
||||
</ng-container>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['policy.read']">
|
||||
<app-policy-grid [type]="PolicyComponentServiceType.MGMT"></app-policy-grid>
|
||||
<ng-template cnslHasRole [hasRole]="['policy.read']">
|
||||
<cnsl-policy-grid [type]="PolicyComponentServiceType.MGMT"></cnsl-policy-grid>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
@@ -71,17 +71,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" disablePagination="true">
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" [disablePagination]="true">
|
||||
<mat-tab label="Details">
|
||||
<app-contributors [totalResult]="totalMemberResult" [loading]="loading$ | async"
|
||||
<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">
|
||||
</app-contributors>
|
||||
</cnsl-contributors>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'CHANGES.ORG.TITLE' | translate }}" class="meta-flex-col">
|
||||
<app-changes *ngIf="org" [changeType]="ChangeType.ORG" [id]="org.id"></app-changes>
|
||||
<cnsl-changes *ngIf="org" [changeType]="ChangeType.ORG" [id]="org.id"></cnsl-changes>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
@@ -7,6 +7,7 @@ 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';
|
||||
@@ -21,7 +22,7 @@ import { DomainVerificationComponent } from './domain-verification/domain-verifi
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-detail',
|
||||
selector: 'cnsl-org-detail',
|
||||
templateUrl: './org-detail.component.html',
|
||||
styleUrls: ['./org-detail.component.scss'],
|
||||
})
|
||||
@@ -42,6 +43,7 @@ export class OrgDetailComponent implements OnInit {
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]>
|
||||
= new BehaviorSubject<Member.AsObject[]>([]);
|
||||
public features!: Features.AsObject;
|
||||
public InfoSectionType: any = InfoSectionType;
|
||||
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<h1>{{ 'ORG.PAGES.LIST' | translate }}</h1>
|
||||
<p class="top-desc">{{'ORG.PAGES.LISTDESCRIPTION' | translate}}</p>
|
||||
|
||||
<app-refresh-table *ngIf="dataSource" (refreshed)="refresh()" [dataSize]="dataSource.data.length"
|
||||
<cnsl-refresh-table *ngIf="dataSource" (refreshed)="refresh()" [dataSize]="dataSource.data.length"
|
||||
[loading]="loading$ | async">
|
||||
|
||||
<cnsl-form-field @appearfade *ngIf="orgSearchKey != undefined" actions class="filter">
|
||||
<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>
|
||||
@@ -19,7 +19,7 @@
|
||||
</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">
|
||||
[checked]="row.id === activeOrg.id">
|
||||
</mat-radio-button>
|
||||
</td>
|
||||
</ng-container>
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
||||
[ngClass]="{'search-active': this.orgSearchKey == OrgListSearchKey.NAME}">
|
||||
[ngClass]="{'search-active': this.orgSearchKey === OrgListSearchKey.NAME}">
|
||||
{{ 'ORG.PAGES.NAME' | translate }}
|
||||
<template [ngTemplateOutlet]="templateRef"
|
||||
[ngTemplateOutletContext]="{key: OrgListSearchKey.NAME}"></template>
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
<ng-container matColumnDef="creationDate">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
||||
[ngClass]="{'search-active': this.orgSearchKey == OrgListSearchKey.NAME}">
|
||||
[ngClass]="{'search-active': this.orgSearchKey === OrgListSearchKey.NAME}">
|
||||
{{ 'ORG.PAGES.CREATIONDATE' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let org">
|
||||
@@ -54,12 +54,12 @@
|
||||
</table>
|
||||
<mat-paginator class="paginator" [pageSize]="10" #paginator [pageSizeOptions]="[10, 20, 100, 250]">
|
||||
</mat-paginator>
|
||||
</app-refresh-table>
|
||||
</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>
|
||||
<mat-icon *ngIf="this.orgSearchKey !== key">search</mat-icon>
|
||||
<mat-icon *ngIf="this.orgSearchKey === key">search_off</mat-icon>
|
||||
</button>
|
||||
</ng-template>
|
||||
@@ -15,7 +15,7 @@ enum OrgListSearchKey {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-list',
|
||||
selector: 'cnsl-org-list',
|
||||
templateUrl: './org-list.component.html',
|
||||
styleUrls: ['./org-list.component.scss'],
|
||||
animations: [
|
||||
|
||||
+21
-21
@@ -5,28 +5,28 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-member-roles-autocomplete',
|
||||
templateUrl: './org-member-roles-autocomplete.component.html',
|
||||
styleUrls: ['./org-member-roles-autocomplete.component.scss'],
|
||||
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);
|
||||
});
|
||||
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);
|
||||
});
|
||||
}
|
||||
this.myControl.valueChanges.subscribe(change => {
|
||||
this.selectionChanged.emit(change);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,51 +6,51 @@ import { Member } from 'src/app/proto/generated/zitadel/member_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
export class OrgMembersDataSource extends DataSource<Member.AsObject> {
|
||||
public totalResult: number = 0;
|
||||
public viewTimestamp!: Timestamp.AsObject;
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public totalResult: number = 0;
|
||||
public viewTimestamp!: Timestamp.AsObject;
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
constructor(private service: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
public loadMembers(pageIndex: number, pageSize: number): void {
|
||||
const offset = pageIndex * pageSize;
|
||||
public loadMembers(pageIndex: number, pageSize: number): void {
|
||||
const offset = pageIndex * pageSize;
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
from(this.mgmtService.listOrgMembers(pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.details?.totalResult || 0;
|
||||
if (resp.details?.viewTimestamp) {
|
||||
this.viewTimestamp = resp.details.viewTimestamp;
|
||||
}
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
}
|
||||
this.loadingSubject.next(true);
|
||||
from(this.service.listOrgMembers(pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.details?.totalResult || 0;
|
||||
if (resp.details?.viewTimestamp) {
|
||||
this.viewTimestamp = resp.details.viewTimestamp;
|
||||
}
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Connect this data source to the table. The table will only update when
|
||||
* the returned stream emits new items.
|
||||
* @returns A stream of the items to be rendered.
|
||||
*/
|
||||
public connect(): Observable<Member.AsObject[]> {
|
||||
return this.membersSubject.asObservable();
|
||||
}
|
||||
/**
|
||||
* Connect this data source to the table. The table will only update when
|
||||
* the returned stream emits new items.
|
||||
* @returns A stream of the items to be rendered.
|
||||
*/
|
||||
public connect(): Observable<Member.AsObject[]> {
|
||||
return this.membersSubject.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the table is being destroyed. Use this function, to clean up
|
||||
* any open connections or free any held resources that were set up during connect.
|
||||
*/
|
||||
public disconnect(): void {
|
||||
this.membersSubject.complete();
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
/**
|
||||
* Called when the table is being destroyed. Use this function, to clean up
|
||||
* any open connections or free any held resources that were set up during connect.
|
||||
*/
|
||||
public disconnect(): void {
|
||||
this.membersSubject.complete();
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<app-detail-layout [backRouterLink]="[ '/org']" title="{{org?.name}} {{ 'ORG.MEMBER.TITLE' | translate }}"
|
||||
<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>
|
||||
<app-members-table [dataSource]="dataSource" [memberRoleOptions]="memberRoleOptions"
|
||||
<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 appHasRole selectactions [appHasRole]="['org.member.delete:'+org?.id,'org.member.delete']">
|
||||
<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 appHasRole writeactions [appHasRole]="['org.member.write:'+org?.id,'org.member.write']">
|
||||
<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>
|
||||
</app-members-table>
|
||||
</app-detail-layout>
|
||||
</cnsl-members-table>
|
||||
</cnsl-detail-layout>
|
||||
@@ -12,113 +12,113 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { OrgMembersDataSource } from './org-members-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-org-members',
|
||||
templateUrl: './org-members.component.html',
|
||||
styleUrls: ['./org-members.component.scss'],
|
||||
selector: 'cnsl-org-members',
|
||||
templateUrl: './org-members.component.html',
|
||||
styleUrls: ['./org-members.component.scss'],
|
||||
})
|
||||
export class OrgMembersComponent {
|
||||
public INITIALPAGESIZE: number = 25;
|
||||
public org!: Org.AsObject;
|
||||
public disableWrite: boolean = false;
|
||||
public dataSource!: OrgMembersDataSource;
|
||||
public INITIALPAGESIZE: number = 25;
|
||||
public org!: Org.AsObject;
|
||||
public disableWrite: boolean = false;
|
||||
public dataSource!: OrgMembersDataSource;
|
||||
|
||||
public memberRoleOptions: string[] = [];
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
public memberRoleOptions: string[] = [];
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
|
||||
constructor(
|
||||
private mgmtService: ManagementService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.mgmtService.getMyOrg().then(resp => {
|
||||
if (resp.org) {
|
||||
this.org = resp.org;
|
||||
this.dataSource = new OrgMembersDataSource(this.mgmtService);
|
||||
this.dataSource.loadMembers(0, this.INITIALPAGESIZE);
|
||||
}
|
||||
});
|
||||
constructor(
|
||||
private mgmtService: ManagementService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.mgmtService.getMyOrg().then(resp => {
|
||||
if (resp.org) {
|
||||
this.org = resp.org;
|
||||
this.dataSource = new OrgMembersDataSource(this.mgmtService);
|
||||
this.dataSource.loadMembers(0, this.INITIALPAGESIZE);
|
||||
}
|
||||
});
|
||||
|
||||
this.getRoleOptions();
|
||||
this.getRoleOptions();
|
||||
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
return this.dataSource.loadMembers(
|
||||
event?.pageIndex ?? 0,
|
||||
event?.pageSize ?? this.INITIALPAGESIZE,
|
||||
);
|
||||
};
|
||||
}
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
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);
|
||||
});
|
||||
}
|
||||
public getRoleOptions(): void {
|
||||
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)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
updateRoles(member: Member.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateOrgMember(member.userId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERCHANGED', true);
|
||||
}).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(() => {
|
||||
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(() => {
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
public removeOrgMember(member: Member.AsObject): void {
|
||||
this.mgmtService.removeOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public openAddMember(): void {
|
||||
const dialogRef = this.dialog.open(MemberCreateDialogComponent, {
|
||||
data: {
|
||||
creationType: CreationType.ORG,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
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();
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
|
||||
public removeOrgMember(member: Member.AsObject): void {
|
||||
this.mgmtService.removeOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public openAddMember(): void {
|
||||
const dialogRef = this.dialog.open(MemberCreateDialogComponent, {
|
||||
data: {
|
||||
creationType: CreationType.ORG,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
<cnsl-form-field appearance="outline" class="formfield">
|
||||
<cnsl-label>{{ 'APP.NAME' | translate }}</cnsl-label>
|
||||
<input cnslInput cdkFocusInitial formControlName="name" />
|
||||
<span cnsl-error *ngIf="name?.errors?.required">{{'PROJECT.APP.NAMEREQUIRED' | translate}}</span>
|
||||
<span cnslError *ngIf="name?.errors?.required">{{'PROJECT.APP.NAMEREQUIRED' | translate}}</span>
|
||||
</cnsl-form-field>
|
||||
|
||||
<p class="step-title">{{'APP.OIDC.TYPETITLE' | translate}}</p>
|
||||
|
||||
<app-type-radio [types]="appTypes" (selectedType)="appType?.setValue($event)"
|
||||
<cnsl-type-radio [types]="appTypes" (selectedType)="appType?.setValue($event)"
|
||||
[selected]="appType?.value">
|
||||
</app-type-radio>
|
||||
</cnsl-type-radio>
|
||||
<div class="actions">
|
||||
<button mat-raised-button [disabled]="firstFormGroup.invalid" color="primary"
|
||||
matStepperNext>{{'ACTIONS.CONTINUE' | translate}}</button>
|
||||
@@ -46,10 +46,10 @@
|
||||
<form [formGroup]="secondFormGroup">
|
||||
<ng-template matStepLabel>{{'APP.AUTHMETHODSECTION' | translate}}</ng-template>
|
||||
|
||||
<app-auth-method-radio [authMethods]="authMethods" [selected]="authMethod?.value"
|
||||
[isOIDC]="appType?.value?.createType == AppCreateType.OIDC"
|
||||
<cnsl-auth-method-radio [authMethods]="authMethods" [selected]="authMethod?.value"
|
||||
[isOIDC]="appType?.value?.createType === AppCreateType.OIDC"
|
||||
(selectedMethod)="authMethod?.setValue($event)">
|
||||
</app-auth-method-radio>
|
||||
</cnsl-auth-method-radio>
|
||||
|
||||
<div class="actions">
|
||||
<button mat-stroked-button color="primary" matStepperPrevious>{{'ACTIONS.BACK' |
|
||||
@@ -61,7 +61,7 @@
|
||||
</mat-step>
|
||||
|
||||
<!-- show redirect step only for OIDC apps -->
|
||||
<mat-step *ngIf="appType?.value?.createType == AppCreateType.OIDC" [editable]="true">
|
||||
<mat-step *ngIf="appType?.value?.createType === AppCreateType.OIDC" [editable]="true">
|
||||
<ng-template matStepLabel>{{'APP.OIDC.REDIRECTSECTION' | translate}}</ng-template>
|
||||
|
||||
<p class="step-title">{{'APP.OIDC.REDIRECTTITLE' | translate}}</p>
|
||||
@@ -71,8 +71,8 @@
|
||||
{{'APP.OIDC.REDIRECTDESCRIPTIONWEB' | translate}}</p>
|
||||
|
||||
<cnsl-redirect-uris class="redirect-section" [canWrite]="true"
|
||||
[isNative]="oidcAppRequest.appType == OIDCAppType.OIDC_APP_TYPE_NATIVE"
|
||||
(changedUris)="oidcAppRequest.redirectUrisList = $event" [urisList]="oidcAppRequest.redirectUrisList"
|
||||
[isNative]="oidcAppRequest.appType === OIDCAppType.OIDC_APP_TYPE_NATIVE"
|
||||
(changedUris)="oidcAppRequest.redirectUrisList = $any($event)" [urisList]="oidcAppRequest.redirectUrisList"
|
||||
[getValues]="requestRedirectValuesSubject$" title="{{ 'APP.OIDC.REDIRECT' | translate }}">
|
||||
</cnsl-redirect-uris>
|
||||
|
||||
@@ -84,10 +84,10 @@
|
||||
{{'APP.OIDC.REDIRECTDESCRIPTIONWEB' | translate}}</p>
|
||||
|
||||
<cnsl-redirect-uris class="redirect-section" [canWrite]="true"
|
||||
(changedUris)="oidcAppRequest.postLogoutRedirectUrisList = $event"
|
||||
(changedUris)="oidcAppRequest.postLogoutRedirectUrisList = $any($event)"
|
||||
[urisList]="oidcAppRequest.postLogoutRedirectUrisList"
|
||||
title="{{ 'APP.OIDC.POSTLOGOUTREDIRECT' | translate }}" [getValues]="requestRedirectValuesSubject$"
|
||||
[isNative]="oidcAppRequest.appType == OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
[isNative]="oidcAppRequest.appType === OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
</cnsl-redirect-uris>
|
||||
|
||||
<div class="actions">
|
||||
@@ -109,7 +109,7 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="appType?.value?.createType == AppCreateType.OIDC">
|
||||
<ng-container *ngIf="appType?.value?.createType === AppCreateType.OIDC">
|
||||
<div class="row">
|
||||
<span class="left">
|
||||
{{ 'APP.TYPE' | translate }}
|
||||
@@ -122,7 +122,7 @@
|
||||
<span class="left">
|
||||
{{ 'APP.GRANT' | translate }}
|
||||
</span>
|
||||
<span class="right" *ngIf="oidcAppRequest.grantTypesList?.length > 0">
|
||||
<span class="right" *ngIf="oidcAppRequest.grantTypesList && oidcAppRequest.grantTypesList.length > 0">
|
||||
[<span *ngFor="let element of oidcAppRequest.grantTypesList; index as i">
|
||||
{{'APP.OIDC.GRANT.'+element | translate}}
|
||||
{{i < oidcAppRequest.grantTypesList.length - 1 ? ', ' : '' }} </span>]
|
||||
@@ -132,7 +132,7 @@
|
||||
<span class="left">
|
||||
{{ 'APP.OIDC.RESPONSETYPE' | translate }}
|
||||
</span>
|
||||
<span class="right" *ngIf="oidcAppRequest.responseTypesList?.length > 0">
|
||||
<span class="right" *ngIf="oidcAppRequest.responseTypesList && oidcAppRequest.responseTypesList.length > 0">
|
||||
[<span *ngFor="let element of oidcAppRequest.responseTypesList; index as i">
|
||||
{{('APP.OIDC.RESPONSE.'+element | translate)}}
|
||||
{{i < oidcAppRequest.responseTypesList.length - 1 ? ', ' : '' }} </span>]
|
||||
@@ -154,7 +154,7 @@
|
||||
<span class="left">
|
||||
{{ 'APP.OIDC.REDIRECT' | translate }}
|
||||
</span>
|
||||
<span class="right" *ngIf="oidcAppRequest.redirectUrisList?.length > 0">
|
||||
<span class="right" *ngIf="oidcAppRequest.redirectUrisList && oidcAppRequest.redirectUrisList.length > 0">
|
||||
[<span *ngFor="let redirect of oidcAppRequest.redirectUrisList; index as i">
|
||||
{{redirect}}
|
||||
{{i < oidcAppRequest.redirectUrisList.length - 1 ? ', ' : '' }} </span>]
|
||||
@@ -165,7 +165,7 @@
|
||||
<span class="left">
|
||||
{{ 'APP.OIDC.POSTLOGOUTREDIRECT' | translate }}
|
||||
</span>
|
||||
<span class="right" *ngIf="oidcAppRequest.postLogoutRedirectUrisList?.length > 0">
|
||||
<span class="right" *ngIf="oidcAppRequest.postLogoutRedirectUrisList && oidcAppRequest.postLogoutRedirectUrisList.length > 0">
|
||||
[<span *ngFor="let redirect of oidcAppRequest.postLogoutRedirectUrisList; index as i">
|
||||
{{redirect}}
|
||||
{{i < oidcAppRequest.postLogoutRedirectUrisList.length - 1 ? ', ' : '' }} </span>]
|
||||
@@ -173,7 +173,7 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="appType?.value?.createType == AppCreateType.API">
|
||||
<ng-container *ngIf="appType?.value?.createType === AppCreateType.API">
|
||||
<div class="row">
|
||||
<span class="left">
|
||||
{{ 'APP.AUTHMETHOD' | translate }}
|
||||
@@ -211,7 +211,7 @@
|
||||
</mat-select>
|
||||
</cnsl-form-field>
|
||||
|
||||
<ng-container *ngIf="formappType?.value?.createType == AppCreateType.OIDC">
|
||||
<ng-container *ngIf="formappType?.value?.createType === AppCreateType.OIDC">
|
||||
<cnsl-form-field appearance="outline" class="formfield">
|
||||
<cnsl-label>{{ 'APP.OIDC.GRANTTYPE' | translate }}</cnsl-label>
|
||||
<mat-select formControlName="grantTypesList" multiple>
|
||||
@@ -242,21 +242,21 @@
|
||||
</cnsl-form-field>
|
||||
</div>
|
||||
|
||||
<div class="content" *ngIf="formappType?.value?.createType == AppCreateType.OIDC">
|
||||
<div class="content" *ngIf="formappType?.value?.createType === AppCreateType.OIDC">
|
||||
<div class="formfield full-width">
|
||||
<cnsl-redirect-uris class="redirect-section" [canWrite]="true"
|
||||
(changedUris)="oidcAppRequest.redirectUrisList = $event"
|
||||
(changedUris)="oidcAppRequest.redirectUrisList = $any($event)"
|
||||
[urisList]="oidcAppRequest.redirectUrisList" title="{{ 'APP.OIDC.REDIRECT' | translate }}"
|
||||
[getValues]="requestRedirectValuesSubject$"
|
||||
[isNative]="oidcAppRequest.appType == OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
[isNative]="oidcAppRequest.appType === OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
</cnsl-redirect-uris>
|
||||
|
||||
<cnsl-redirect-uris class="redirect-section" [canWrite]="true"
|
||||
(changedUris)="oidcAppRequest.postLogoutRedirectUrisList = $event"
|
||||
(changedUris)="oidcAppRequest.postLogoutRedirectUrisList = $any($event)"
|
||||
[urisList]="oidcAppRequest.postLogoutRedirectUrisList"
|
||||
title="{{ 'APP.OIDC.POSTLOGOUTREDIRECT' | translate }}"
|
||||
[getValues]="requestRedirectValuesSubject$"
|
||||
[isNative]="oidcAppRequest.appType == OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
[isNative]="oidcAppRequest.appType === OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
</cnsl-redirect-uris>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@ import { API_TYPE, AppCreateType, NATIVE_TYPE, RadioItemAppType, USER_AGENT_TYPE
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-create',
|
||||
selector: 'cnsl-app-create',
|
||||
templateUrl: './app-create.component.html',
|
||||
styleUrls: ['./app-create.component.scss'],
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<app-meta-layout>
|
||||
<cnsl-meta-layout>
|
||||
<div class="enlarged-container">
|
||||
<div class="head">
|
||||
<a [routerLink]="['/projects', projectId]" mat-icon-button>
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<ng-container *ngIf="isZitadel === false">
|
||||
<span class="fill-space"></span>
|
||||
<ng-template appHasRole [appHasRole]="['project.app.write:'+projectId, 'project.app.write']">
|
||||
<ng-template cnslHasRole [hasRole]="['project.app.write:'+projectId, 'project.app.write']">
|
||||
<button class="actions-trigger" mat-raised-button color="primary" [matMenuTriggerFor]="actions">
|
||||
<span>{{'ACTIONS.ACTIONS' | translate}}</span>
|
||||
<mat-icon class="icon">keyboard_arrow_down</mat-icon>
|
||||
@@ -27,11 +27,11 @@
|
||||
(click)="changeState(AppState.APP_STATE_INACTIVE)">
|
||||
{{'ACTIONS.DEACTIVATE' | translate}}
|
||||
</button>
|
||||
<button mat-menu-item *ngIf="app?.state == AppState.APP_STATE_INACTIVE"
|
||||
<button mat-menu-item *ngIf="app?.state === AppState.APP_STATE_INACTIVE"
|
||||
(click)="changeState(AppState.APP_STATE_ACTIVE)">
|
||||
{{'ACTIONS.REACTIVATE' | translate}}
|
||||
</button>
|
||||
<ng-template appHasRole [appHasRole]="['project.app.delete:'+projectId, 'project.app.delete']">
|
||||
<ng-template cnslHasRole [hasRole]="['project.app.delete:'+projectId, 'project.app.delete']">
|
||||
<button mat-menu-item matTooltip="{{'APP.PAGES.DELETE' | translate}}"
|
||||
(click)="deleteApp()">
|
||||
<span [style.color]="'var(--warn)'">{{'APP.PAGES.DELETE' | translate}}</span>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
<div class="compliance"
|
||||
*ngIf="app?.oidcConfig?.complianceProblemsList && app.oidcConfig?.complianceProblemsList?.length">
|
||||
<cnsl-info-section class="problem" type="WARN">
|
||||
<cnsl-info-section class="problem" [type]="InfoSectionType.WARN">
|
||||
<ul style="margin: 0;">
|
||||
<li style="margin: 0 0 .5rem 0;"
|
||||
*ngFor="let problem of app.oidcConfig?.complianceProblemsList || []">
|
||||
@@ -70,20 +70,20 @@
|
||||
</button>
|
||||
</p>
|
||||
<ng-container *ngIf="showRedirects">
|
||||
<cnsl-info-section *ngIf="appType?.value == OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
<cnsl-info-section *ngIf="appType?.value === OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
<div class="dev-col">
|
||||
<span>{{'APP.OIDC.REDIRECTDESCRIPTIONNATIVE' | translate}}</span>
|
||||
<mat-slide-toggle color="primary" class="devmode" [formControl]="devMode" name="devMode"
|
||||
<mat-slide-toggle *ngIf="devMode" color="primary" class="devmode" [formControl]="devMode" name="devMode"
|
||||
matTooltip="{{'APP.OIDC.DEVMODEDESC' | translate}}">
|
||||
{{ 'APP.OIDC.DEVMODE' | translate }}
|
||||
</mat-slide-toggle>
|
||||
</div>
|
||||
</cnsl-info-section>
|
||||
<cnsl-info-section
|
||||
*ngIf="appType?.value == OIDCAppType.OIDC_APP_TYPE_WEB || appType?.value == OIDCAppType.OIDC_APP_TYPE_USER_AGENT">
|
||||
*ngIf="appType?.value === OIDCAppType.OIDC_APP_TYPE_WEB || appType?.value === OIDCAppType.OIDC_APP_TYPE_USER_AGENT">
|
||||
<div class="dev-col">
|
||||
<span>{{'APP.OIDC.REDIRECTDESCRIPTIONWEB' | translate}}</span>
|
||||
<mat-slide-toggle color="primary" class="devmode" [formControl]="devMode" name="devMode"
|
||||
<mat-slide-toggle *ngIf="devMode" color="primary" class="devmode" [formControl]="devMode" name="devMode"
|
||||
matTooltip="{{'APP.OIDC.DEVMODEDESC' | translate}}">
|
||||
{{ 'APP.OIDC.DEVMODE' | translate }}
|
||||
</mat-slide-toggle>
|
||||
@@ -93,16 +93,16 @@
|
||||
<div class="content">
|
||||
<cnsl-redirect-uris *ngIf="appType?.value !== undefined" class="redirect-section" [canWrite]="canWrite"
|
||||
[devMode]="devMode?.value" [getValues]="requestRedirectValuesSubject$"
|
||||
(changedUris)="redirectUrisList = $event" [urisList]="redirectUrisList"
|
||||
(changedUris)="redirectUrisList = $any($event)" [urisList]="redirectUrisList"
|
||||
title="{{ 'APP.OIDC.REDIRECT' | translate }}"
|
||||
[isNative]="appType?.value == OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
[isNative]="appType?.value === OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
</cnsl-redirect-uris>
|
||||
|
||||
<cnsl-redirect-uris *ngIf="appType?.value !== undefined" class="redirect-section" [canWrite]="canWrite"
|
||||
[devMode]="devMode?.value" (changedUris)="postLogoutRedirectUrisList = $event"
|
||||
[devMode]="devMode?.value" (changedUris)="postLogoutRedirectUrisList = $any($event)"
|
||||
[urisList]="postLogoutRedirectUrisList" [getValues]="requestRedirectValuesSubject$"
|
||||
title="{{ 'APP.OIDC.POSTLOGOUTREDIRECT' | translate }}"
|
||||
[isNative]="appType?.value == OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
[isNative]="appType?.value === OIDCAppType.OIDC_APP_TYPE_NATIVE">
|
||||
</cnsl-redirect-uris>
|
||||
</div>
|
||||
</ng-container>
|
||||
@@ -119,7 +119,7 @@
|
||||
<ng-container *ngIf="showAdditionalOrigins">
|
||||
<p class="desc">{{'APP.ADDITIONALORIGINSDESC' | translate}}</p>
|
||||
<cnsl-additional-origins *ngIf="appType?.value !== undefined" class="input" [canWrite]="canWrite"
|
||||
[getValues]="requestRedirectValuesSubject$" (changedUris)="additionalOriginsList = $event"
|
||||
[getValues]="requestRedirectValuesSubject$" (changedUris)="additionalOriginsList = $any($event)"
|
||||
[urisList]="additionalOriginsList" title="{{ 'APP.ORIGINS' | translate }}">
|
||||
</cnsl-additional-origins>
|
||||
</ng-container>
|
||||
@@ -128,15 +128,15 @@
|
||||
<div style="margin: .5rem" class="divider"></div>
|
||||
</div>
|
||||
|
||||
<app-auth-method-radio *ngIf="authMethods && initialAuthMethod && (app?.oidcConfig || app?.apiConfig)"
|
||||
<cnsl-auth-method-radio *ngIf="authMethods && initialAuthMethod && (app?.oidcConfig || app?.apiConfig)"
|
||||
[authMethods]="authMethods" [selected]="initialAuthMethod" [current]="currentAuthMethod"
|
||||
[isOIDC]="app?.oidcConfig !== undefined" (selectedMethod)="setPartialConfigFromAuthMethod($event)">
|
||||
</app-auth-method-radio>
|
||||
</cnsl-auth-method-radio>
|
||||
|
||||
<app-card *ngIf="currentAuthMethod == 'PK_JWT' && projectId && app?.id" [expanded]="false"
|
||||
<cnsl-card *ngIf="currentAuthMethod === 'PK_JWT' && projectId && app?.id" [expanded]="false"
|
||||
title="{{ 'USER.MACHINE.KEYSTITLE' | translate }}" description="{{ 'USER.MACHINE.KEYSDESC' | translate }}">
|
||||
<app-client-keys [projectId]="projectId" [appId]="app.id"></app-client-keys>
|
||||
</app-card>
|
||||
<cnsl-client-keys [projectId]="projectId" [appId]="app.id"></cnsl-client-keys>
|
||||
</cnsl-card>
|
||||
|
||||
<div *ngIf="apiForm && app?.apiConfig" class="btn-container">
|
||||
<button class="submit-button" (click)="saveAPIApp()" color="primary"
|
||||
@@ -145,15 +145,15 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="currentAuthMethod == 'BASIC'">
|
||||
<div *ngIf="currentAuthMethod === 'BASIC'">
|
||||
<button [disabled]="!canWrite" mat-stroked-button
|
||||
(click)="regenerateAPIClientSecret()">{{'APP.API.REGENERATESECRET' | translate}}</button>
|
||||
</div>
|
||||
|
||||
|
||||
<form *ngIf="oidcForm && app?.oidcConfig" [formGroup]="oidcForm" (ngSubmit)="saveOIDCApp()">
|
||||
<app-card title=" {{ 'APP.OIDC.TITLE' | translate }}" *ngIf="app && app.oidcConfig" [expanded]="false">
|
||||
<div card-actions *ngIf="currentAuthMethod == 'CODE' || currentAuthMethod == 'POST'">
|
||||
<cnsl-card title=" {{ 'APP.OIDC.TITLE' | translate }}" *ngIf="app && app.oidcConfig" [expanded]="false">
|
||||
<div card-actions *ngIf="currentAuthMethod === 'CODE' || currentAuthMethod === 'POST'">
|
||||
<button type="button" [disabled]="!canWrite" mat-stroked-button
|
||||
(click)="regenerateOIDCClientSecret()">{{'APP.OIDC.REGENERATESECRET' | translate}}</button>
|
||||
</div>
|
||||
@@ -249,7 +249,7 @@
|
||||
<span>{{'APP.OIDC.CLOCKSKEW' | translate}}</span>
|
||||
</cnsl-info-section>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
|
||||
<div class="btn-container">
|
||||
<button class="submit-button" type="submit" color="primary" [disabled]="oidcForm.invalid || !canWrite"
|
||||
@@ -277,6 +277,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-changes *ngIf="app" [changeType]="ChangeType.APP" [id]="app.id" [secId]="projectId"></app-changes>
|
||||
<cnsl-changes *ngIf="app" [changeType]="ChangeType.APP" [id]="app.id" [secId]="projectId"></cnsl-changes>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { COMMA, ENTER, SPACE } from '@angular/cdk/keycodes';
|
||||
import { Location } from '@angular/common';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { AbstractControl, FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { AbstractControl, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
@@ -12,6 +12,7 @@ import { Subject, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { RadioItemAuthType } from 'src/app/modules/app-radio/app-auth-method-radio/app-auth-method-radio.component';
|
||||
import { ChangeType } from 'src/app/modules/changes/changes.component';
|
||||
import { InfoSectionType } from 'src/app/modules/info-section/info-section.component';
|
||||
import { CnslLinks } from 'src/app/modules/links/links.component';
|
||||
import { NameDialogComponent } from 'src/app/modules/name-dialog/name-dialog.component';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
@@ -50,7 +51,7 @@ import {
|
||||
} from '../authmethods';
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-detail',
|
||||
selector: 'cnsl-app-detail',
|
||||
templateUrl: './app-detail.component.html',
|
||||
styleUrls: ['./app-detail.component.scss'],
|
||||
})
|
||||
@@ -122,6 +123,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
public requestRedirectValuesSubject$: Subject<void> = new Subject();
|
||||
public copiedKey: any = '';
|
||||
public nextLinks: Array<CnslLinks> = [];
|
||||
public InfoSectionType: any = InfoSectionType;
|
||||
|
||||
constructor(
|
||||
public translate: TranslateService,
|
||||
@@ -596,8 +598,8 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
return this.apiForm.get('authMethodType');
|
||||
}
|
||||
|
||||
public get devMode(): AbstractControl | null {
|
||||
return this.oidcForm.get('devMode');
|
||||
public get devMode(): FormControl | null {
|
||||
return this.oidcForm.get('devMode') as FormControl;
|
||||
}
|
||||
|
||||
public get accessTokenType(): AbstractControl | null {
|
||||
|
||||
+7
-7
@@ -5,19 +5,19 @@
|
||||
<div mat-dialog-content>
|
||||
<div class="flex" *ngIf="data.clientId">
|
||||
<span class="overflow-auto"><span class="desc">ClientId:</span> {{data.clientId}}</span>
|
||||
<button color="primary" [disabled]="copied == data.clientId" matTooltip="copy to clipboard" appCopyToClipboard
|
||||
<button color="primary" [disabled]="copied === data.clientId" matTooltip="copy to clipboard" cnslCopyToClipboard
|
||||
[valueToCopy]="data.clientId" (copiedValue)="this.copied = $event" mat-icon-button>
|
||||
<i *ngIf="copied != data.clientId" class="las la-clipboard"></i>
|
||||
<i *ngIf="copied == data.clientId" class="las la-clipboard-check"></i>
|
||||
<i *ngIf="copied !== data.clientId" class="las la-clipboard"></i>
|
||||
<i *ngIf="copied === data.clientId" class="las la-clipboard-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="data.clientSecret; else showNoSecretInfo" class="flex">
|
||||
<span class="overflow-auto"><span class="desc">ClientSecret:</span> {{data.clientSecret}}</span>
|
||||
<button color="primary" [disabled]="copied == data.clientSecret" matTooltip="copy to clipboard"
|
||||
appCopyToClipboard [valueToCopy]="data.clientSecret" (copiedValue)="this.copied = $event" mat-icon-button>
|
||||
<i *ngIf="copied != data.clientSecret" class="las la-clipboard"></i>
|
||||
<i *ngIf="copied == data.clientSecret" class="las la-clipboard-check"></i>
|
||||
<button color="primary" [disabled]="copied === data.clientSecret" matTooltip="copy to clipboard"
|
||||
cnslCopyToClipboard [valueToCopy]="data.clientSecret" (copiedValue)="this.copied = $event" mat-icon-button>
|
||||
<i *ngIf="copied !== data.clientSecret" class="las la-clipboard"></i>
|
||||
<i *ngIf="copied === data.clientSecret" class="las la-clipboard-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
+9
-9
@@ -2,16 +2,16 @@ import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-secret-dialog',
|
||||
templateUrl: './app-secret-dialog.component.html',
|
||||
styleUrls: ['./app-secret-dialog.component.scss'],
|
||||
selector: 'cnsl-app-secret-dialog',
|
||||
templateUrl: './app-secret-dialog.component.html',
|
||||
styleUrls: ['./app-secret-dialog.component.scss'],
|
||||
})
|
||||
export class AppSecretDialogComponent {
|
||||
public copied: string = '';
|
||||
constructor(public dialogRef: MatDialogRef<AppSecretDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
public copied: string = '';
|
||||
constructor(public dialogRef: MatDialogRef<AppSecretDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
<app-meta-layout>
|
||||
<cnsl-meta-layout>
|
||||
<div class="max-width-container">
|
||||
<div class="head" *ngIf="project?.projectId">
|
||||
<a [routerLink]="[ '/granted-projects' ]" mat-icon-button>
|
||||
@@ -12,17 +12,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['user.grant.read', 'user.grant.read:'+grantId]">
|
||||
<app-card *ngIf="project?.projectId" title="{{ 'GRANTS.PROJECT.TITLE' | translate }}"
|
||||
<ng-template cnslHasRole [hasRole]="['user.grant.read', 'user.grant.read:'+grantId]">
|
||||
<cnsl-card *ngIf="project?.projectId" title="{{ 'GRANTS.PROJECT.TITLE' | translate }}"
|
||||
description="{{'GRANTS.PROJECT.DESCRIPTION' | translate }}">
|
||||
<app-user-grants *ngIf="projectId && grantId" [context]="UserGrantContext.GRANTED_PROJECT"
|
||||
<cnsl-user-grants *ngIf="projectId && grantId" [context]="UserGrantContext.GRANTED_PROJECT"
|
||||
[projectId]="projectId" [grantId]="grantId"
|
||||
[displayedColumns]="['select','user', 'projectId', 'dates', 'roleNamesList']"
|
||||
[disableWrite]="(['user.grant.write$','user.grant.write:'+grantId] | hasRole | async) == false"
|
||||
[disableDelete]="(['user.grant.delete$','user.grant.delete:'+grantId] | hasRole | async) == false"
|
||||
refreshOnPreviousRoutes="['/grant-create/project/{{projectId}}/grant/{{grantId}}']">
|
||||
</app-user-grants>
|
||||
</app-card>
|
||||
[disableWrite]="(['user.grant.write$','user.grant.write:'+grantId] | hasRole | async) === false"
|
||||
[disableDelete]="(['user.grant.delete$','user.grant.delete:'+grantId] | hasRole | async) === false"
|
||||
[refreshOnPreviousRoutes]="['/grant-create/project/{{projectId}}/grant/{{grantId}}']">
|
||||
</cnsl-user-grants>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div class="side" metainfo>
|
||||
@@ -38,18 +38,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" disablePagination="true">
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" [disablePagination]="true">
|
||||
<mat-tab label="Details">
|
||||
<app-contributors *ngIf="project" [loading]="loading$ | async" [totalResult]="totalMemberResult"
|
||||
<cnsl-contributors *ngIf="project" [loading]="loading$ | async" [totalResult]="totalMemberResult"
|
||||
[membersSubject]="membersSubject" title="{{ 'PROJECT.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.MEMBER.TITLEDESC' | translate }}" (addClicked)="openAddMember()"
|
||||
(showDetailClicked)="showDetail()" (refreshClicked)="loadMembers()"
|
||||
[disabled]="(['project.member.write$', 'project.member.write:'+ project.projectId]| hasRole | async) == false">
|
||||
</app-contributors>
|
||||
[disabled]="(['project.member.write$', 'project.member.write:'+ project.projectId]| hasRole | async) === false">
|
||||
</cnsl-contributors>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'CHANGES.PROJECT.TITLE' | translate }}" class="meta-flex-col">
|
||||
<app-changes *ngIf="project" [changeType]="ChangeType.PROJECT" [id]="project.projectId"></app-changes>
|
||||
<cnsl-changes *ngIf="project" [changeType]="ChangeType.PROJECT" [id]="project.projectId"></cnsl-changes>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
+1
-1
@@ -15,7 +15,7 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-granted-project-detail',
|
||||
selector: 'cnsl-granted-project-detail',
|
||||
templateUrl: './granted-project-detail.component.html',
|
||||
styleUrls: ['./granted-project-detail.component.scss'],
|
||||
})
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@
|
||||
<div class="item card" *ngFor="let item of selection.selected; index as i"
|
||||
(click)="navigateToProject(item.projectId,item.grantId, $event)">
|
||||
<div class="text-part">
|
||||
<span *ngIf="item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
<span *ngIf="item.details && item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
{{
|
||||
item.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
|
||||
<span class="description" *ngIf="item.projectOwnerName">{{item.projectOwnerName}}</span>
|
||||
<span *ngIf="item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
<span *ngIf="item.details && item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
{{ item.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
<span class="fill-space"></span>
|
||||
@@ -38,7 +38,7 @@
|
||||
<div class="item card" *ngFor="let item of notPinned; index as i"
|
||||
(click)="navigateToProject(item.projectId,item.grantId, $event)">
|
||||
<div class="text-part">
|
||||
<span *ngIf="item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
<span *ngIf="item.details && item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
{{
|
||||
item.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
@@ -47,7 +47,7 @@
|
||||
<div class="state-dot" [ngClass]="{'active': item.state === ProjectGrantState.PROJECT_GRANT_STATE_ACTIVE, 'inactive': item.state === ProjectGrantState.PROJECT_GRANT_STATE_INACTIVE}"></div>
|
||||
</div>
|
||||
<span class="description" *ngIf="item.projectOwnerName">{{item.projectOwnerName}}</span>
|
||||
<span *ngIf="item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
<span *ngIf="item.details && item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
{{ item.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
<span class="fill-space"></span>
|
||||
</div>
|
||||
|
||||
+5
-3
@@ -7,7 +7,7 @@ import { GrantedProject, ProjectGrantState } from 'src/app/proto/generated/zitad
|
||||
import { StorageKey, StorageLocation, StorageService } from 'src/app/services/storage.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-granted-project-grid',
|
||||
selector: 'cnsl-granted-project-grid',
|
||||
templateUrl: './granted-project-grid.component.html',
|
||||
styleUrls: ['./granted-project-grid.component.scss'],
|
||||
animations: [
|
||||
@@ -35,7 +35,7 @@ export class GrantedProjectGridComponent implements OnChanges {
|
||||
public notPinned: Array<GrantedProject.AsObject> = [];
|
||||
@Output() newClicked: EventEmitter<boolean> = new EventEmitter();
|
||||
@Output() changedView: EventEmitter<boolean> = new EventEmitter();
|
||||
@Input() loading: boolean = false;
|
||||
@Input() loading: boolean | null = false;
|
||||
public selection: SelectionModel<GrantedProject.AsObject> = new SelectionModel<GrantedProject.AsObject>(true, []);
|
||||
|
||||
public showNewProject: boolean = false;
|
||||
@@ -70,9 +70,11 @@ export class GrantedProjectGridComponent implements OnChanges {
|
||||
this.getPrefixedItem('pinned-granted-projects').then(storageEntry => {
|
||||
if (storageEntry) {
|
||||
const array: string[] = JSON.parse(storageEntry);
|
||||
const toSelect: GrantedProject.AsObject[] = this.items.filter((item, index) => {
|
||||
const toSelect: GrantedProject.AsObject[] = this.items.filter((item) => {
|
||||
if (array.includes(item.projectId)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
this.selection.select(...toSelect);
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<app-granted-project-grid *ngIf="grid" [loading]="loading$ | async" (changedView)="grid = false"
|
||||
<cnsl-granted-project-grid *ngIf="grid" [loading]="loading$ | async" (changedView)="grid = false"
|
||||
[items]="grantedProjectList">
|
||||
</app-granted-project-grid>
|
||||
</cnsl-granted-project-grid>
|
||||
|
||||
<div *ngIf="!grid" class="view-toggle">
|
||||
<button class="icon-button" (click)="grid = true" mat-icon-button
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
|
||||
<div *ngIf="!grid && grantedProjectList">
|
||||
<app-refresh-table (refreshed)="refreshPage()" [dataSize]="totalResult" [timestamp]="viewTimestamp"
|
||||
<cnsl-refresh-table (refreshed)="refreshPage()" [dataSize]="totalResult" [timestamp]="viewTimestamp"
|
||||
[selection]="selection" [loading]="loading$ | async">
|
||||
|
||||
<div class="table-wrapper">
|
||||
@@ -70,12 +70,12 @@
|
||||
[routerLink]="['/granted-projects', row.projectId, 'grant', row.grantId]"></tr>
|
||||
|
||||
</table>
|
||||
<div *ngIf="(loading$ | async) == false && !dataSource?.data?.length" class="no-content-row">
|
||||
<div *ngIf="(loading$ | async) === false && !dataSource?.data?.length" class="no-content-row">
|
||||
<i class="las la-exclamation"></i>
|
||||
<span>{{'PROJECT.TABLE.EMPTY' | translate}}</span>
|
||||
</div>
|
||||
<cnsl-paginator class="paginator" #paginator [timestamp]="viewTimestamp" [length]="totalResult" [pageSize]="10"
|
||||
[pageSizeOptions]="[5, 10, 20]" (page)="changePage($event)"></cnsl-paginator>
|
||||
</div>
|
||||
</app-refresh-table>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-granted-project-list',
|
||||
selector: 'cnsl-granted-project-list',
|
||||
templateUrl: './granted-project-list.component.html',
|
||||
styleUrls: ['./granted-project-list.component.scss'],
|
||||
animations: [
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<p class="sub">{{ 'PROJECT.PAGES.LISTDESCRIPTION' | translate }}</p>
|
||||
|
||||
<h2>{{'PROJECT.PAGES.TYPE.GRANTED' | translate}}</h2>
|
||||
<app-granted-project-list>
|
||||
</app-granted-project-list>
|
||||
<cnsl-granted-project-list>
|
||||
</cnsl-granted-project-list>
|
||||
</div>
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-granted-projects',
|
||||
templateUrl: './granted-projects.component.html',
|
||||
styleUrls: ['./granted-projects.component.scss'],
|
||||
selector: 'cnsl-granted-projects',
|
||||
templateUrl: './granted-projects.component.html',
|
||||
styleUrls: ['./granted-projects.component.scss'],
|
||||
})
|
||||
export class GrantedProjectsComponent {
|
||||
constructor() { }
|
||||
constructor() { }
|
||||
}
|
||||
|
||||
+4
-4
@@ -16,9 +16,9 @@
|
||||
[isApiApp]="app.apiConfig !== undefined">
|
||||
{{ app.name.charAt(0)}}
|
||||
<ng-container *ngIf="app.oidcConfig?.appType !== undefined">
|
||||
<i *ngIf="app.oidcConfig?.appType == OIDCAppType.OIDC_APP_TYPE_NATIVE" class="las la-mobile"></i>
|
||||
<i *ngIf="app.oidcConfig?.appType == OIDCAppType.OIDC_APP_TYPE_WEB" class="las la-code"></i>
|
||||
<i *ngIf="app.oidcConfig?.appType == OIDCAppType.OIDC_APP_TYPE_USER_AGENT" class="las la-code"></i>
|
||||
<i *ngIf="app.oidcConfig?.appType === OIDCAppType.OIDC_APP_TYPE_NATIVE" class="las la-mobile"></i>
|
||||
<i *ngIf="app.oidcConfig?.appType === OIDCAppType.OIDC_APP_TYPE_WEB" class="las la-code"></i>
|
||||
<i *ngIf="app.oidcConfig?.appType === OIDCAppType.OIDC_APP_TYPE_USER_AGENT" class="las la-code"></i>
|
||||
<i *ngIf="app.apiConfig" class="las la-code"></i>
|
||||
</ng-container>
|
||||
</cnsl-app-card>
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.app.write']">
|
||||
<ng-template cnslHasRole [hasRole]="['project.app.write']">
|
||||
<div class="app-wrap" *ngIf="!disabled" [routerLink]="[ '/projects', projectId, 'apps', 'create']">
|
||||
<cnsl-app-card class="grid-card add" matRipple>
|
||||
<mat-icon>add</mat-icon>
|
||||
|
||||
+28
-28
@@ -5,38 +5,38 @@ import { App, OIDCAppType } from 'src/app/proto/generated/zitadel/app_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-application-grid',
|
||||
templateUrl: './application-grid.component.html',
|
||||
styleUrls: ['./application-grid.component.scss'],
|
||||
selector: 'cnsl-application-grid',
|
||||
templateUrl: './application-grid.component.html',
|
||||
styleUrls: ['./application-grid.component.scss'],
|
||||
})
|
||||
export class ApplicationGridComponent implements OnInit {
|
||||
@Input() public projectId: string = '';
|
||||
@Input() public disabled: boolean = false;
|
||||
@Output() public changeView: EventEmitter<void> = new EventEmitter();
|
||||
public appsSubject: BehaviorSubject<App.AsObject[]> = new BehaviorSubject<App.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public OIDCAppType: any = OIDCAppType;
|
||||
@Input() public projectId: string = '';
|
||||
@Input() public disabled: boolean = false;
|
||||
@Output() public changeView: EventEmitter<void> = new EventEmitter();
|
||||
public appsSubject: BehaviorSubject<App.AsObject[]> = new BehaviorSubject<App.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public OIDCAppType: any = OIDCAppType;
|
||||
|
||||
constructor(private mgmtService: ManagementService) { }
|
||||
constructor(private mgmtService: ManagementService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.loadApps();
|
||||
}
|
||||
public ngOnInit(): void {
|
||||
this.loadApps();
|
||||
}
|
||||
|
||||
public loadApps(): void {
|
||||
from(this.mgmtService.listApps(this.projectId, 100, 0)).pipe(
|
||||
map(resp => {
|
||||
return resp.resultList;
|
||||
}),
|
||||
// catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe((apps) => {
|
||||
this.appsSubject.next(apps as App.AsObject[]);
|
||||
});
|
||||
}
|
||||
public loadApps(): void {
|
||||
from(this.mgmtService.listApps(this.projectId, 100, 0)).pipe(
|
||||
map(resp => {
|
||||
return resp.resultList;
|
||||
}),
|
||||
// catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe((apps) => {
|
||||
this.appsSubject.next(apps as App.AsObject[]);
|
||||
});
|
||||
}
|
||||
|
||||
public closeView(): void {
|
||||
this.changeView.emit();
|
||||
}
|
||||
public closeView(): void {
|
||||
this.changeView.emit();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
<app-refresh-table [loading]="dataSource.loading$ | async" [selection]="selection" (refreshed)="refreshPage()"
|
||||
<cnsl-refresh-table [loading]="dataSource.loading$ | async" [selection]="selection" (refreshed)="refreshPage()"
|
||||
[dataSize]="dataSource.totalResult" [timestamp]="dataSource?.viewTimestamp">
|
||||
<ng-template appHasRole [appHasRole]="['project.app.write']" actions>
|
||||
<ng-template cnslHasRole [hasRole]="['project.app.write']" actions>
|
||||
<a [disabled]="disabled" [routerLink]="[ '/projects', projectId, 'apps', 'create']" color="primary"
|
||||
mat-raised-button>
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
@@ -49,4 +49,4 @@
|
||||
[pageSizeOptions]="[25, 50, 100, 250]">
|
||||
</cnsl-paginator>
|
||||
</div>
|
||||
</app-refresh-table>
|
||||
</cnsl-refresh-table>
|
||||
+1
-1
@@ -10,7 +10,7 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ProjectApplicationsDataSource } from './applications-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-applications',
|
||||
selector: 'cnsl-applications',
|
||||
templateUrl: './applications.component.html',
|
||||
styleUrls: ['./applications.component.scss'],
|
||||
})
|
||||
|
||||
+41
-41
@@ -1,4 +1,4 @@
|
||||
<app-meta-layout>
|
||||
<cnsl-meta-layout>
|
||||
<div class="max-width-container">
|
||||
<div class="head" *ngIf="project?.id">
|
||||
<a [routerLink]="[ '/projects' ]" mat-icon-button>
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<span class="fill-space"></span>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.write:'+projectId, 'project.write']">
|
||||
<ng-template cnslHasRole [hasRole]="['project.write:'+projectId, 'project.write']">
|
||||
<button class="actions-trigger" mat-raised-button color="primary" [matMenuTriggerFor]="actions">
|
||||
<span>{{'ACTIONS.ACTIONS' | translate}}</span>
|
||||
<mat-icon class="icon">keyboard_arrow_down</mat-icon>
|
||||
@@ -19,20 +19,20 @@
|
||||
</button>
|
||||
|
||||
<button mat-menu-item
|
||||
[disabled]="isZitadel || (['project.write$', 'project.write:'+ project.id]| hasRole | async) == false"
|
||||
[disabled]="isZitadel || (['project.write$', 'project.write:'+ project.id]| hasRole | async) === false"
|
||||
*ngIf="project?.state === ProjectState.PROJECT_STATE_ACTIVE"
|
||||
(click)="changeState(ProjectState.PROJECT_STATE_INACTIVE)">
|
||||
{{'PROJECT.TABLE.DEACTIVATE' | translate}}
|
||||
</button>
|
||||
|
||||
<button mat-menu-item
|
||||
[disabled]="isZitadel || (['project.write$', 'project.write:'+ project.id]| hasRole | async) == false"
|
||||
[disabled]="isZitadel || (['project.write$', 'project.write:'+ project.id]| hasRole | async) === false"
|
||||
*ngIf="project?.state === ProjectState.PROJECT_STATE_INACTIVE"
|
||||
(click)="changeState(ProjectState.PROJECT_STATE_ACTIVE)">
|
||||
{{'PROJECT.TABLE.ACTIVATE' | translate}}
|
||||
</button>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.delete$', 'project.delete:'+projectId]">
|
||||
<ng-template cnslHasRole [hasRole]="['project.delete$', 'project.delete:'+projectId]">
|
||||
<button mat-menu-item matTooltip="{{'ACTIONS.DELETE' | translate}}" (click)="deleteProject()"
|
||||
aria-label="Edit project name" *ngIf="isZitadel === false">
|
||||
<span [style.color]="'var(--warn)'">{{'PROJECT.PAGES.DELETE' | translate}}</span>
|
||||
@@ -52,72 +52,72 @@
|
||||
<h2 class="setting-title">{{'PROJECT.PAGES.PRIVATELABEL.TITLE' | translate}}</h2>
|
||||
<p class="setting-desc">
|
||||
<span>{{'PROJECT.PAGES.PRIVATELABEL.'+project.privateLabelingSetting+'.TITLE' | translate}}</span>
|
||||
<button [disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async))== false"
|
||||
<button [disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async)) === false"
|
||||
(click)="openPrivateLabelingDialog()" mat-icon-button><i class="las la-edit"></i></button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.app.read:' + project.id, 'project.app.read']">
|
||||
<app-application-grid *ngIf="grid" [disabled]="isZitadel" (changeView)="grid = false" [projectId]="projectId">
|
||||
</app-application-grid>
|
||||
<app-card *ngIf="!grid" title="{{ 'PROJECT.APP.TITLE' | translate }}">
|
||||
<ng-template cnslHasRole [hasRole]="['project.app.read:' + project.id, 'project.app.read']">
|
||||
<cnsl-application-grid *ngIf="grid" [disabled]="isZitadel" (changeView)="grid = false" [projectId]="projectId">
|
||||
</cnsl-application-grid>
|
||||
<cnsl-card *ngIf="!grid" title="{{ 'PROJECT.APP.TITLE' | translate }}">
|
||||
<div class="card-actions" card-actions>
|
||||
<button mat-icon-button (click)="grid = true">
|
||||
<i matTooltip="show grid view" class="las la-th-large"></i>
|
||||
</button>
|
||||
</div>
|
||||
<app-applications [disabled]="isZitadel" [projectId]="projectId"></app-applications>
|
||||
</app-card>
|
||||
<cnsl-applications [disabled]="isZitadel" [projectId]="projectId"></cnsl-applications>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
|
||||
<ng-container *ngIf="isZitadel == false">
|
||||
<ng-template appHasRole [appHasRole]="['project.grant.read:' + project.id, 'project.grant.read']">
|
||||
<app-card title="{{ 'PROJECT.GRANT.TITLE' | translate }}"
|
||||
<ng-container *ngIf="isZitadel === false">
|
||||
<ng-template cnslHasRole [hasRole]="['project.grant.read:' + project.id, 'project.grant.read']">
|
||||
<cnsl-card title="{{ 'PROJECT.GRANT.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.GRANT.DESCRIPTION' | translate }}">
|
||||
<app-project-grants
|
||||
<cnsl-project-grants
|
||||
[refreshOnPreviousRoutes]="['/projects/'+projectId+'/grants/create','/projects/'+projectId+'/roles/create']"
|
||||
[disabled]="((['project.grant.write$', 'project.grant.write:'+ project.id]| hasRole | async))== false"
|
||||
[disabled]="((['project.grant.write$', 'project.grant.write:'+ project.id]| hasRole | async)) === false"
|
||||
[projectId]="projectId">
|
||||
</app-project-grants>
|
||||
</app-card>
|
||||
</cnsl-project-grants>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.role.read:' + project.id, 'project.role.read']">
|
||||
<app-card id="roles" title="{{ 'PROJECT.ROLE.TITLE' | translate }}"
|
||||
<ng-template cnslHasRole [hasRole]="['project.role.read:' + project.id, 'project.role.read']">
|
||||
<cnsl-card id="roles" title="{{ 'PROJECT.ROLE.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.ROLE.DESCRIPTION' | translate }}">
|
||||
<p>{{'PROJECT.ROLE.OPTIONS' | translate}}</p>
|
||||
<mat-checkbox [(ngModel)]="project.projectRoleAssertion"
|
||||
[disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async))== false"
|
||||
[disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async)) === false"
|
||||
(change)="saveProject()" color="primary">
|
||||
{{'PROJECT.ROLE.ASSERTION' | translate}}</mat-checkbox>
|
||||
<p class="desc">{{'PROJECT.ROLE.ASSERTION_DESCRIPTION' | translate}}</p>
|
||||
<mat-checkbox [(ngModel)]="project.projectRoleCheck"
|
||||
[disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async))== false"
|
||||
[disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async)) === false"
|
||||
(change)="saveProject()" color="primary">
|
||||
{{'PROJECT.ROLE.CHECK' | translate}}</mat-checkbox>
|
||||
<p class="desc">{{'PROJECT.ROLE.CHECK_DESCRIPTION' | translate}}</p>
|
||||
<mat-checkbox [(ngModel)]="project.hasProjectCheck"
|
||||
[disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async))== false"
|
||||
[disabled]="((['project.write$', 'project.write:'+ project.id]| hasRole | async)) === false"
|
||||
(change)="saveProject()" color="primary">
|
||||
{{'PROJECT.HAS_PROJECT' | translate}}</mat-checkbox>
|
||||
<p class="desc">{{'PROJECT.HAS_PROJECT_DESCRIPTION' | translate}}</p>
|
||||
<div class="divider"></div>
|
||||
<app-project-roles
|
||||
[disabled]="(['project.role.write$', 'project.role.write:'+ project.id]| hasRole | async) == false"
|
||||
<cnsl-project-roles
|
||||
[disabled]="(['project.role.write$', 'project.role.write:'+ project.id]| hasRole | async) === false"
|
||||
[actionsVisible]="true" [projectId]="projectId">
|
||||
</app-project-roles>
|
||||
</app-card>
|
||||
</cnsl-project-roles>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['user.grant.read']">
|
||||
<app-card *ngIf="project?.id" title="{{ 'GRANTS.PROJECT.TITLE' | translate }}"
|
||||
<ng-template cnslHasRole [hasRole]="['user.grant.read']">
|
||||
<cnsl-card *ngIf="project?.id" title="{{ 'GRANTS.PROJECT.TITLE' | translate }}"
|
||||
description="{{'GRANTS.PROJECT.DESCRIPTION' | translate }}">
|
||||
<app-user-grants [context]="UserGrantContext.OWNED_PROJECT" [projectId]="projectId"
|
||||
<cnsl-user-grants [context]="UserGrantContext.OWNED_PROJECT" [projectId]="projectId"
|
||||
[refreshOnPreviousRoutes]="['/grant-create/project/'+projectId]"
|
||||
[disableWrite]="((['user.grant.write$', 'user.grant.write:'+projectId] | hasRole) | async) == false"
|
||||
[disableDelete]="((['user.grant.delete$','user.grant.delete:'+projectId] | hasRole) | async) == false">
|
||||
</app-user-grants>
|
||||
</app-card>
|
||||
[disableWrite]="((['user.grant.write$', 'user.grant.write:'+projectId] | hasRole) | async) === false"
|
||||
[disableDelete]="((['user.grant.delete$','user.grant.delete:'+projectId] | hasRole) | async) === false">
|
||||
</cnsl-user-grants>
|
||||
</cnsl-card>
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
@@ -136,18 +136,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" disablePagination="true">
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" [disablePagination]="true">
|
||||
<mat-tab label="Details">
|
||||
<app-contributors *ngIf="project" [loading]="loading$ | async" [totalResult]="totalMemberResult"
|
||||
<cnsl-contributors *ngIf="project" [loading]="loading$ | async" [totalResult]="totalMemberResult"
|
||||
[membersSubject]="membersSubject" title="{{ 'PROJECT.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.MEMBER.TITLEDESC' | translate }}" (addClicked)="openAddMember()"
|
||||
(showDetailClicked)="showDetail()" (refreshClicked)="loadMembers()"
|
||||
[disabled]="(['project.member.write$', 'project.member.write:'+ project.id]| hasRole | async) == false">
|
||||
</app-contributors>
|
||||
[disabled]="(['project.member.write$', 'project.member.write:'+ project.id]| hasRole | async) === false">
|
||||
</cnsl-contributors>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'CHANGES.PROJECT.TITLE' | translate }}" class="meta-flex-col">
|
||||
<app-changes *ngIf="project" [changeType]="ChangeType.PROJECT" [id]="project.id"></app-changes>
|
||||
<cnsl-changes *ngIf="project" [changeType]="ChangeType.PROJECT" [id]="project.id"></cnsl-changes>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
+1
-1
@@ -24,7 +24,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { NameDialogComponent } from '../../../../modules/name-dialog/name-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-owned-project-detail',
|
||||
selector: 'cnsl-owned-project-detail',
|
||||
templateUrl: './owned-project-detail.component.html',
|
||||
styleUrls: ['./owned-project-detail.component.scss'],
|
||||
|
||||
|
||||
+88
-78
@@ -1,87 +1,97 @@
|
||||
<app-refresh-table [loading]="dataSource?.loading$ | async" *ngIf="projectId" (refreshed)="loadGrantsPage()"
|
||||
[dataSize]="dataSource.totalResult" [selection]="selection" [timestamp]="dataSource?.viewTimestamp"
|
||||
[emitRefreshOnPreviousRoutes]="refreshOnPreviousRoutes" (refreshed)="getRoleOptions(projectId)">
|
||||
<ng-template appHasRole [appHasRole]="['project.grant.member.delete:'+projectId, 'project.grant.member.delete']"
|
||||
actions>
|
||||
<button (click)="deleteSelectedGrants()" [disabled]="disabled" mat-icon-button *ngIf="selection.hasValue()"
|
||||
color="warn">
|
||||
<i class="las la-trash"></i>
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template appHasRole [appHasRole]="['project.grant.member.write:'+projectId,'project.grant.member.write']"
|
||||
actions>
|
||||
<a [disabled]="disabled" color="primary" color="primary" mat-raised-button
|
||||
[routerLink]="[ '/projects', projectId, 'grants', 'create']">
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
</a>
|
||||
</ng-template>
|
||||
<cnsl-refresh-table [loading]="dataSource?.loading$ | async" *ngIf="projectId" (refreshed)="loadGrantsPage()"
|
||||
[dataSize]="dataSource.totalResult" [selection]="selection" [timestamp]="dataSource?.viewTimestamp"
|
||||
[emitRefreshOnPreviousRoutes]="refreshOnPreviousRoutes" (refreshed)="getRoleOptions(projectId)">
|
||||
<ng-template cnslHasRole [hasRole]="['project.grant.member.delete:'+projectId, 'project.grant.member.delete']"
|
||||
actions>
|
||||
<button (click)="deleteSelectedGrants()" [disabled]="disabled" mat-icon-button *ngIf="selection.hasValue()"
|
||||
color="warn">
|
||||
<i class="las la-trash"></i>
|
||||
</button>
|
||||
</ng-template>
|
||||
<ng-template cnslHasRole [hasRole]="['project.grant.member.write:'+projectId,'project.grant.member.write']" actions>
|
||||
<a [disabled]="disabled" color="primary" color="primary" mat-raised-button
|
||||
[routerLink]="[ '/projects', projectId, 'grants', 'create']">
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
</a>
|
||||
</ng-template>
|
||||
|
||||
<div class="table-wrapper">
|
||||
<table mat-table multiTemplateDataRows class="table" aria-label="Elements" [dataSource]="dataSource">
|
||||
<div class="table-wrapper">
|
||||
<table mat-table multiTemplateDataRows class="table" aria-label="Elements" [dataSource]="dataSource">
|
||||
|
||||
<ng-container matColumnDef="select">
|
||||
<th class="selection" mat-header-cell *matHeaderCellDef>
|
||||
<mat-checkbox [disabled]="disabled" color="primary" (change)="$event ? masterToggle() : null"
|
||||
[checked]="selection.hasValue() && isAllSelected()"
|
||||
[indeterminate]="selection.hasValue() && !isAllSelected()">
|
||||
</mat-checkbox>
|
||||
</th>
|
||||
<td class="selection" mat-cell *matCellDef="let row">
|
||||
<mat-checkbox [disabled]="disabled" color="primary" (click)="$event.stopPropagation()"
|
||||
(change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">
|
||||
</mat-checkbox>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="select">
|
||||
<th class="selection" mat-header-cell *matHeaderCellDef>
|
||||
<mat-checkbox [disabled]="disabled" color="primary" (change)="$event ? masterToggle() : null"
|
||||
[checked]="selection.hasValue() && isAllSelected()"
|
||||
[indeterminate]="selection.hasValue() && !isAllSelected()">
|
||||
</mat-checkbox>
|
||||
</th>
|
||||
<td class="selection" mat-cell *matCellDef="let row">
|
||||
<mat-checkbox [disabled]="disabled" color="primary" (click)="$event.stopPropagation()"
|
||||
(change)="$event ? selection.toggle(row) : null" [checked]="selection.isSelected(row)">
|
||||
</mat-checkbox>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="grantedOrgName">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.GRANT.GRANTEDORG' | translate }} </th>
|
||||
<td [routerLink]="['/projects',grant.projectId,'grant', grant.grantId]" class="pointer" mat-cell
|
||||
*matCellDef="let grant">
|
||||
{{grant.grantedOrgName}} </td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="grantedOrgName">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.GRANT.GRANTEDORG' | translate }} </th>
|
||||
<td [routerLink]="['/projects',grant.projectId,'grant', grant.grantId]" class="pointer" mat-cell
|
||||
*matCellDef="let grant">
|
||||
{{grant.grantedOrgName}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="dates">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.GRANT.DATES' | translate }} </th>
|
||||
<td [routerLink]="['/projects',grant.projectId,'grant', grant.grantId]" class="pointer" mat-cell
|
||||
*matCellDef="let grant">
|
||||
<div class="date-block">
|
||||
<span class="date-sub">{{ 'PROJECT.GRANT.CREATIONDATE' | translate }}:</span>
|
||||
<span>{{grant.details.creationDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' }}</span>
|
||||
</div>
|
||||
<div class="date-block">
|
||||
<span class="date-sub">{{ 'PROJECT.GRANT.CHANGEDATE' | translate }}</span>
|
||||
<span>{{grant.details.changeDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' }}</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="dates">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.GRANT.DATES' | translate }} </th>
|
||||
<td [routerLink]="['/projects',grant.projectId,'grant', grant.grantId]" class="pointer" mat-cell
|
||||
*matCellDef="let grant">
|
||||
<div class="date-block">
|
||||
<span class="date-sub">{{ 'PROJECT.GRANT.CREATIONDATE' | translate }}:</span>
|
||||
<span>{{grant.details.creationDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' }}</span>
|
||||
</div>
|
||||
<div class="date-block">
|
||||
<span class="date-sub">{{ 'PROJECT.GRANT.CHANGEDATE' | translate }}</span>
|
||||
<span>{{grant.details.changeDate | timestampToDate | localizedDate: 'dd. MMM, HH:mm' }}</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="roleNamesList">
|
||||
<th mat-header-cell *matHeaderCellDef class="role-row"> {{ 'PROJECT.GRANT.ROLENAMESLIST' | translate }}
|
||||
</th>
|
||||
<td class="pointer role-row" mat-cell *matCellDef="let grant">
|
||||
<cnsl-form-field class="form-field" appearance="outline" *ngIf="grant.roleKeysList">
|
||||
<cnsl-label>{{ 'PROJECT.GRANT.ROLENAMESLIST' | translate }}</cnsl-label>
|
||||
<mat-select [(ngModel)]="grant.roleKeysList" multiple [disabled]="disabled"
|
||||
(selectionChange)="updateRoles(grant, $event)">
|
||||
<mat-option *ngFor="let role of memberRoleOptions" [value]="role.key">
|
||||
{{role.key}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</cnsl-form-field>
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="state">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.GRANT.STATE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let grant" [routerLink]="grant.id ? ['/users', grant.id ]: null">
|
||||
<span class="state"
|
||||
[ngClass]="{'active': grant.state === ProjectGrantState.PROJECT_GRANT_STATE_ACTIVE, 'inactive': grant.state === ProjectGrantState.PROJECT_GRANT_STATE_INACTIVE}">
|
||||
{{ 'PROJECT.GRANT.STATES.'+grant.state | translate }}
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let grant; columns: displayedColumns;">
|
||||
</tr>
|
||||
</table>
|
||||
<ng-container matColumnDef="roleNamesList">
|
||||
<th mat-header-cell *matHeaderCellDef class="role-row"> {{ 'PROJECT.GRANT.ROLENAMESLIST' | translate }}
|
||||
</th>
|
||||
<td class="pointer role-row" mat-cell *matCellDef="let grant">
|
||||
<cnsl-form-field class="form-field" appearance="outline" *ngIf="grant.roleKeysList">
|
||||
<cnsl-label>{{ 'PROJECT.GRANT.ROLENAMESLIST' | translate }}</cnsl-label>
|
||||
<mat-select [(ngModel)]="grant.roleKeysList" multiple [disabled]="disabled"
|
||||
(selectionChange)="updateRoles(grant, $event)">
|
||||
<mat-option *ngFor="let role of memberRoleOptions" [value]="role.key">
|
||||
{{role.key}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</cnsl-form-field>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<div *ngIf="(dataSource.loading$ | async) == false && !dataSource?.totalResult" class="no-content-row">
|
||||
<i class="las la-exclamation"></i>
|
||||
<span>{{'PROJECT.GRANT.EMPTY' | translate}}</span>
|
||||
</div>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let grant; columns: displayedColumns;">
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<cnsl-paginator class="paginator" #paginator [pageSize]="50" [timestamp]="dataSource?.viewTimestamp" [pageSizeOptions]="[25, 50, 100, 250]"
|
||||
[length]="dataSource.totalResult" (page)="loadGrantsPage($event.pageIndex, $event.pageSize)">
|
||||
</cnsl-paginator>
|
||||
<div *ngIf="(dataSource.loading$ | async) === false && !dataSource?.totalResult" class="no-content-row">
|
||||
<i class="las la-exclamation"></i>
|
||||
<span>{{'PROJECT.GRANT.EMPTY' | translate}}</span>
|
||||
</div>
|
||||
</app-refresh-table>
|
||||
|
||||
<cnsl-paginator class="paginator" #paginator [pageSize]="50" [timestamp]="dataSource?.viewTimestamp"
|
||||
[pageSizeOptions]="[25, 50, 100, 250]" [length]="dataSource.totalResult"
|
||||
(page)="loadGrantsPage($event.pageIndex, $event.pageSize)">
|
||||
</cnsl-paginator>
|
||||
</div>
|
||||
</cnsl-refresh-table>
|
||||
+85
-83
@@ -5,106 +5,108 @@ import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
||||
import { GrantedProject, Role } from 'src/app/proto/generated/zitadel/project_pb';
|
||||
import { GrantedProject, ProjectGrantState, Role } from 'src/app/proto/generated/zitadel/project_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { ProjectGrantsDataSource } from './project-grants-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-grants',
|
||||
templateUrl: './project-grants.component.html',
|
||||
styleUrls: ['./project-grants.component.scss'],
|
||||
animations: [
|
||||
trigger('detailExpand', [
|
||||
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
||||
state('expanded', style({ height: '*' })),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
||||
]),
|
||||
],
|
||||
selector: 'cnsl-project-grants',
|
||||
templateUrl: './project-grants.component.html',
|
||||
styleUrls: ['./project-grants.component.scss'],
|
||||
animations: [
|
||||
trigger('detailExpand', [
|
||||
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
||||
state('expanded', style({ height: '*' })),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
@Input() refreshOnPreviousRoutes: string[] = [];
|
||||
@Input() public projectId: string = '';
|
||||
@Input() public disabled: boolean = false;
|
||||
@ViewChild(PaginatorComponent) public paginator!: PaginatorComponent;
|
||||
@ViewChild(MatTable) public table!: MatTable<GrantedProject.AsObject>;
|
||||
public dataSource!: ProjectGrantsDataSource;
|
||||
public selection: SelectionModel<GrantedProject.AsObject> = new SelectionModel<GrantedProject.AsObject>(true, []);
|
||||
public memberRoleOptions: Role.AsObject[] = [];
|
||||
@Input() refreshOnPreviousRoutes: string[] = [];
|
||||
@Input() public projectId: string = '';
|
||||
@Input() public disabled: boolean = false;
|
||||
@ViewChild(PaginatorComponent) public paginator!: PaginatorComponent;
|
||||
@ViewChild(MatTable) public table!: MatTable<GrantedProject.AsObject>;
|
||||
public dataSource!: ProjectGrantsDataSource;
|
||||
public selection: SelectionModel<GrantedProject.AsObject> = new SelectionModel<GrantedProject.AsObject>(true, []);
|
||||
public memberRoleOptions: Role.AsObject[] = [];
|
||||
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
public displayedColumns: string[] = ['select', 'grantedOrgName', 'dates'];
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
public displayedColumns: string[] = ['select', 'grantedOrgName','state', 'dates'];
|
||||
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) { }
|
||||
ProjectGrantState: any = ProjectGrantState;
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.dataSource = new ProjectGrantsDataSource(this.mgmtService);
|
||||
this.dataSource.loadGrants(this.projectId, 0, 25, 'asc');
|
||||
this.getRoleOptions(this.projectId);
|
||||
}
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) { }
|
||||
|
||||
public ngAfterViewInit(): void {
|
||||
this.paginator.page
|
||||
.pipe(
|
||||
tap(() => this.loadGrantsPage()),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
public ngOnInit(): void {
|
||||
this.dataSource = new ProjectGrantsDataSource(this.mgmtService);
|
||||
this.dataSource.loadGrants(this.projectId, 0, 25, 'asc');
|
||||
this.getRoleOptions(this.projectId);
|
||||
}
|
||||
|
||||
public loadGrantsPage(pageIndex?: number, pageSize?: number): void {
|
||||
this.dataSource.loadGrants(
|
||||
this.projectId,
|
||||
pageIndex ?? this.paginator.pageIndex,
|
||||
pageSize ?? this.paginator.pageSize,
|
||||
);
|
||||
}
|
||||
public ngAfterViewInit(): void {
|
||||
this.paginator.page
|
||||
.pipe(
|
||||
tap(() => this.loadGrantsPage()),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
public isAllSelected(): boolean {
|
||||
const numSelected = this.selection.selected.length;
|
||||
const numRows = this.dataSource.grantsSubject.value.length;
|
||||
return numSelected === numRows;
|
||||
}
|
||||
public loadGrantsPage(pageIndex?: number, pageSize?: number): void {
|
||||
this.dataSource.loadGrants(
|
||||
this.projectId,
|
||||
pageIndex ?? this.paginator.pageIndex,
|
||||
pageSize ?? this.paginator.pageSize,
|
||||
);
|
||||
}
|
||||
|
||||
public masterToggle(): void {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.grantsSubject.value.forEach(row => this.selection.select(row));
|
||||
}
|
||||
public isAllSelected(): boolean {
|
||||
const numSelected = this.selection.selected.length;
|
||||
const numRows = this.dataSource.grantsSubject.value.length;
|
||||
return numSelected === numRows;
|
||||
}
|
||||
|
||||
public getRoleOptions(projectId: string): void {
|
||||
this.mgmtService.listProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.memberRoleOptions = resp.resultList;
|
||||
});
|
||||
}
|
||||
public masterToggle(): void {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.grantsSubject.value.forEach(row => this.selection.select(row));
|
||||
}
|
||||
|
||||
updateRoles(grant: GrantedProject.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateProjectGrant(grant.grantId, grant.projectId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTCHANGED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
public getRoleOptions(projectId: string): void {
|
||||
this.mgmtService.listProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.memberRoleOptions = resp.resultList;
|
||||
});
|
||||
}
|
||||
|
||||
deleteSelectedGrants(): void {
|
||||
const promises = this.selection.selected.map(grant => {
|
||||
return this.mgmtService.removeProjectGrant(grant.grantId, grant.projectId);
|
||||
});
|
||||
updateRoles(grant: GrantedProject.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateProjectGrant(grant.grantId, grant.projectId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTCHANGED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
this.toast.showInfo('GRANTS.TOAST.BULKREMOVED', true);
|
||||
const data = this.dataSource.grantsSubject.getValue();
|
||||
this.selection.selected.forEach((item) => {
|
||||
const index = data.findIndex(i => i.grantId === item.grantId);
|
||||
if (index > -1) {
|
||||
data.splice(index, 1);
|
||||
this.dataSource.grantsSubject.next(data);
|
||||
}
|
||||
});
|
||||
this.selection.clear();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
deleteSelectedGrants(): void {
|
||||
const promises = this.selection.selected.map(grant => {
|
||||
return this.mgmtService.removeProjectGrant(grant.grantId, grant.projectId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
this.toast.showInfo('GRANTS.TOAST.BULKREMOVED', true);
|
||||
const data = this.dataSource.grantsSubject.getValue();
|
||||
this.selection.selected.forEach((item) => {
|
||||
const index = data.findIndex(i => i.grantId === item.grantId);
|
||||
if (index > -1) {
|
||||
data.splice(index, 1);
|
||||
this.dataSource.grantsSubject.next(data);
|
||||
}
|
||||
});
|
||||
this.selection.clear();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+8
-14
@@ -13,19 +13,15 @@
|
||||
(click)="navigateToProject(item.id, $event)"
|
||||
[ngClass]="{ inactive: item.state !== ProjectState.PROJECT_STATE_ACTIVE}">
|
||||
<div class="text-part">
|
||||
<span *ngIf="item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
{{
|
||||
item.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
<span *ngIf="item.details && item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
{{ item.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
<div class="name-row">
|
||||
<span class="name" *ngIf="item.name">{{ item.name }}</span>
|
||||
<div class="state-dot" [ngClass]="{'active': item.state === ProjectState.PROJECT_STATE_ACTIVE, 'inactive': item.state === ProjectState.PROJECT_STATE_INACTIVE}"></div>
|
||||
</div>
|
||||
|
||||
<span *ngIf="item.details.changeDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
{{
|
||||
item.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
<span *ngIf="item.details && item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
{{ item.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
<span class="fill-space"></span>
|
||||
</div>
|
||||
|
||||
@@ -40,16 +36,14 @@
|
||||
<div class="item card" *ngFor="let item of notPinned; index as i" (click)="navigateToProject(item.id, $event)"
|
||||
[ngClass]="{ inactive: item.state !== ProjectState.PROJECT_STATE_ACTIVE}">
|
||||
<div class="text-part">
|
||||
<span *ngIf="item.details?.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
{{
|
||||
item.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
<span *ngIf="item.details && item.details.changeDate" class="top">{{'PROJECT.PAGES.LASTMODIFIED' | translate}}
|
||||
{{ item.details.changeDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
<div class="name-row">
|
||||
<span class="name" *ngIf="item.name">{{ item.name }}</span>
|
||||
<div class="state-dot" [ngClass]="{'active': item.state === ProjectState.PROJECT_STATE_ACTIVE, 'inactive': item.state === ProjectState.PROJECT_STATE_INACTIVE}"></div>
|
||||
</div>
|
||||
|
||||
<span *ngIf="item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
<span *ngIf="item.details && item.details.creationDate" class="created">{{'PROJECT.PAGES.CREATEDON' | translate}}
|
||||
{{
|
||||
item.details.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm'
|
||||
}}</span>
|
||||
@@ -62,7 +56,7 @@
|
||||
|
||||
<p class="n-items" *ngIf="!loading && items.length === 0">{{'PROJECT.PAGES.NOITEMS' | translate}}</p>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['project.create']">
|
||||
<ng-template cnslHasRole [hasRole]="['project.create']">
|
||||
<div class="add-project-button card" (click)="addItem()">
|
||||
<mat-icon class="icon">add</mat-icon>
|
||||
<span>{{'PROJECT.PAGES.ADDNEW' | translate}}</span>
|
||||
|
||||
+5
-3
@@ -11,7 +11,7 @@ import { StorageKey, StorageLocation, StorageService } from 'src/app/services/st
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-owned-project-grid',
|
||||
selector: 'cnsl-owned-project-grid',
|
||||
templateUrl: './owned-project-grid.component.html',
|
||||
styleUrls: ['./owned-project-grid.component.scss'],
|
||||
animations: [
|
||||
@@ -44,7 +44,7 @@ export class OwnedProjectGridComponent implements OnChanges {
|
||||
|
||||
@Output() newClicked: EventEmitter<boolean> = new EventEmitter();
|
||||
@Output() changedView: EventEmitter<boolean> = new EventEmitter();
|
||||
@Input() loading: boolean = false;
|
||||
@Input() loading: boolean | null = false;
|
||||
|
||||
public selection: SelectionModel<Project.AsObject> = new SelectionModel<Project.AsObject>(true, []);
|
||||
|
||||
@@ -94,9 +94,11 @@ export class OwnedProjectGridComponent implements OnChanges {
|
||||
this.getPrefixedItem('pinned-projects').then(storageEntry => {
|
||||
if (storageEntry) {
|
||||
const array: string[] = JSON.parse(storageEntry);
|
||||
const toSelect: Project.AsObject[] = this.items.filter((item, index) => {
|
||||
const toSelect: Project.AsObject[] = this.items.filter((item) => {
|
||||
if (array.includes(item.id)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
this.selection.select(...toSelect);
|
||||
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
<app-owned-project-grid [zitadelProjectId]="zitadelProjectId" *ngIf="grid && zitadelProjectId"
|
||||
<cnsl-owned-project-grid [zitadelProjectId]="zitadelProjectId" *ngIf="grid && zitadelProjectId"
|
||||
[loading]="loading$ | async" (changedView)="grid = false" [items]="ownedProjectList || []"
|
||||
(newClicked)="addProject()">
|
||||
</app-owned-project-grid>
|
||||
</cnsl-owned-project-grid>
|
||||
|
||||
<div *ngIf="!grid" class="view-toggle">
|
||||
<button (click)="grid = true" mat-icon-button class="icon-button"
|
||||
@@ -10,10 +10,10 @@
|
||||
</button>
|
||||
</div>
|
||||
<div *ngIf="!grid && ownedProjectList">
|
||||
<app-refresh-table (refreshed)="refreshPage()" [dataSize]="totalResult" [timestamp]="viewTimestamp"
|
||||
<cnsl-refresh-table (refreshed)="refreshPage()" [dataSize]="totalResult" [timestamp]="viewTimestamp"
|
||||
[selection]="selection" [loading]="loading$ | async">
|
||||
|
||||
<ng-template actions appHasRole [appHasRole]="['project.create']">
|
||||
<ng-template actions cnslHasRole [hasRole]="['project.create']">
|
||||
<a [routerLink]="[ '/projects', 'create']" color="primary" mat-raised-button>
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
</a>
|
||||
@@ -36,19 +36,20 @@
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.NAME' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let project"> {{project.name}} </td>
|
||||
<td [routerLink]="['/projects', project.id]" mat-cell *matCellDef="let project"> {{project.name}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="state">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.TABLE.STATE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let project"><span *ngIf="project.state">{{'PROJECT.STATE.'+project.state
|
||||
| translate}}</span></td>
|
||||
<td [routerLink]="['/projects', project.id]" mat-cell *matCellDef="let project">
|
||||
<span class="state" [ngClass]="{'active': project.state === ProjectState.PROJECT_STATE_ACTIVE, 'inactive': project.state === ProjectState.PROJECT_STATE_INACTIVE}" *ngIf="project.state">{{'PROJECT.STATE.'+project.state | translate}}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
<ng-container matColumnDef="creationDate">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.TABLE.CREATIONDATE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let project">
|
||||
<td [routerLink]="['/projects', project.id]" mat-cell *matCellDef="let project">
|
||||
<span *ngIf="project.details.creationDate">{{project.details.creationDate | timestampToDate |
|
||||
localizedDate: 'EEE dd. MMM, HH:mm'}}</span>
|
||||
</td>
|
||||
@@ -57,7 +58,7 @@
|
||||
|
||||
<ng-container matColumnDef="changeDate">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'PROJECT.TABLE.CHANGEDATE' | translate }} </th>
|
||||
<td mat-cell *matCellDef="let project">
|
||||
<td [routerLink]="['/projects', project.id]" mat-cell *matCellDef="let project">
|
||||
<span *ngIf="project.details.changeDate">{{project.details.changeDate | timestampToDate |
|
||||
localizedDate: 'EEE dd. MMM, HH:mm'}}</span>
|
||||
</td>
|
||||
@@ -75,16 +76,15 @@
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns;"
|
||||
[routerLink]="['/projects', row.id]"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
|
||||
</table>
|
||||
<div *ngIf="(loading$ | async) == false && !dataSource?.data?.length" class="no-content-row">
|
||||
<div *ngIf="(loading$ | async) === false && !dataSource?.data?.length" class="no-content-row">
|
||||
<i class="las la-exclamation"></i>
|
||||
<span>{{'PROJECT.TABLE.EMPTY' | translate}}</span>
|
||||
</div>
|
||||
<cnsl-paginator class="paginator" [timestamp]="viewTimestamp" [length]="totalResult" [pageSize]="10" [pageSizeOptions]="[5, 10, 20]"
|
||||
(page)="changePage($event)"></cnsl-paginator>
|
||||
</div>
|
||||
</app-refresh-table>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
+6
-5
@@ -10,12 +10,12 @@ import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { PageEvent, PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
import { Project } from 'src/app/proto/generated/zitadel/project_pb';
|
||||
import { Project, ProjectState } from 'src/app/proto/generated/zitadel/project_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-owned-project-list',
|
||||
selector: 'cnsl-owned-project-list',
|
||||
templateUrl: './owned-project-list.component.html',
|
||||
styleUrls: ['./owned-project-list.component.scss'],
|
||||
animations: [
|
||||
@@ -58,6 +58,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
private subscription?: Subscription;
|
||||
|
||||
public zitadelProjectId: string = '';
|
||||
public ProjectState: any = ProjectState;
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
@@ -162,7 +163,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
this.getData(this.paginator.pageSize, this.paginator.pageIndex * this.paginator.pageSize);
|
||||
}
|
||||
|
||||
public deleteProject(item: Project.AsObject): void {
|
||||
public deleteProject(id: string): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
@@ -174,8 +175,8 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (this.zitadelProjectId && resp && item.id !== this.zitadelProjectId) {
|
||||
this.mgmtService.removeProject(item.id).then(() => {
|
||||
if (this.zitadelProjectId && resp && id !== this.zitadelProjectId) {
|
||||
this.mgmtService.removeProject(id).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.DELETED', true);
|
||||
setTimeout(() => {
|
||||
this.refreshPage();
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<p class="sub">{{ 'PROJECT.PAGES.LISTDESCRIPTION' | translate }}</p>
|
||||
|
||||
<h2>{{'PROJECT.PAGES.TYPE.OWNED' | translate}}</h2>
|
||||
<app-owned-project-list></app-owned-project-list>
|
||||
<cnsl-owned-project-list></cnsl-owned-project-list>
|
||||
</div>
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-owned-projects',
|
||||
templateUrl: './owned-projects.component.html',
|
||||
styleUrls: ['./owned-projects.component.scss'],
|
||||
selector: 'cnsl-owned-projects',
|
||||
templateUrl: './owned-projects.component.html',
|
||||
styleUrls: ['./owned-projects.component.scss'],
|
||||
})
|
||||
export class OwnedProjectsComponent { }
|
||||
|
||||
+10
-10
@@ -1,4 +1,4 @@
|
||||
<app-detail-layout [backRouterLink]="[ '/projects', projectid]" title="{{ 'PROJECT.GRANT.DETAIL.TITLE' | translate }}"
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/projects', projectid]" title="{{ 'PROJECT.GRANT.DETAIL.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.GRANT.DETAIL.DESC' | translate }}">
|
||||
<div class="master-row">
|
||||
<div class="left-col">
|
||||
@@ -22,11 +22,11 @@
|
||||
<span class="fill-space"></span>
|
||||
|
||||
<div>
|
||||
<button mat-stroked-button color="warn" *ngIf="grant?.state === ProjectGrantState.PROJECTGRANTSTATE_ACTIVE"
|
||||
(click)="changeState(ProjectGrantState.PROJECTGRANTSTATE_INACTIVE)">{{'USER.PAGES.DEACTIVATE' |
|
||||
<button mat-stroked-button color="warn" *ngIf="grant?.state === ProjectGrantState.PROJECT_GRANT_STATE_ACTIVE"
|
||||
(click)="changeState(ProjectGrantState.PROJECT_GRANT_STATE_INACTIVE)">{{'USER.PAGES.DEACTIVATE' |
|
||||
translate}}</button>
|
||||
<button mat-stroked-button color="warn" *ngIf="grant?.state === ProjectGrantState.PROJECTGRANTSTATE_INACTIVE"
|
||||
(click)="changeState(ProjectGrantState.PROJECTGRANTSTATE_ACTIVE)">{{'USER.PAGES.REACTIVATE' |
|
||||
<button mat-stroked-button color="warn" *ngIf="grant?.state === ProjectGrantState.PROJECT_GRANT_STATE_INACTIVE"
|
||||
(click)="changeState(ProjectGrantState.PROJECT_GRANT_STATE_ACTIVE)">{{'USER.PAGES.REACTIVATE' |
|
||||
translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -45,20 +45,20 @@
|
||||
<h1 class="h1">{{ 'PROJECT.GRANT.DETAIL.MEMBERTITLE' | translate }}</h1>
|
||||
<p class="desc">{{ 'PROJECT.GRANT.DETAIL.MEMBERDESC' | translate }}</p>
|
||||
|
||||
<app-members-table *ngIf="grant" style="width: 100%;" [dataSource]="dataSource"
|
||||
<cnsl-members-table *ngIf="grant" style="width: 100%;" [dataSource]="dataSource"
|
||||
[canWrite]="['project.grant.member.write','project.grant.member.write:' + grant.grantId] | hasRole | async"
|
||||
[memberRoleOptions]="memberRoleOptions" (updateRoles)="updateMemberRoles($event.member, $event.change)"
|
||||
[factoryLoadFunc]="changePageFactory" (changedSelection)="selection = $event" [refreshTrigger]="changePage">
|
||||
<button selectactions (click)="removeProjectMemberSelection()"
|
||||
[disabled]="(['project.grant.member.delete','project.grant.member.delete:' + grant.grantId] | hasRole | async) == false"
|
||||
[disabled]="(['project.grant.member.delete','project.grant.member.delete:' + grant.grantId] | hasRole | async) === false"
|
||||
matTooltip="{{'ORG_DETAIL.TABLE.DELETE' | translate}}" class="del-button" color="warn" mat-raised-button>
|
||||
<i class="las la-trash"></i>
|
||||
{{'ACTIONS.SELECTIONDELETE' | translate}}
|
||||
</button>
|
||||
<a writeactions color="primary"
|
||||
[disabled]="(['project.grant.member.write','project.grant.member.write:' + grant.grantId] | hasRole | async) == false"
|
||||
[disabled]="(['project.grant.member.write','project.grant.member.write:' + grant.grantId] | hasRole | async) === false"
|
||||
(click)="openAddMember()" color="primary" mat-raised-button>
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
</a>
|
||||
</app-members-table>
|
||||
</app-detail-layout>
|
||||
</cnsl-members-table>
|
||||
</cnsl-detail-layout>
|
||||
+4
@@ -1,3 +1,7 @@
|
||||
.desc {
|
||||
font-size: 14px;
|
||||
color: var(--grey);
|
||||
}
|
||||
|
||||
.del-button {
|
||||
margin-right: .5rem;
|
||||
|
||||
+132
-132
@@ -9,164 +9,164 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import {
|
||||
ProjectGrantMembersCreateDialogComponent,
|
||||
ProjectGrantMembersCreateDialogExportType,
|
||||
ProjectGrantMembersCreateDialogComponent,
|
||||
ProjectGrantMembersCreateDialogExportType,
|
||||
} from './project-grant-members-create-dialog/project-grant-members-create-dialog.component';
|
||||
import { ProjectGrantMembersDataSource } from './project-grant-members-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-grant-detail',
|
||||
templateUrl: './project-grant-detail.component.html',
|
||||
styleUrls: ['./project-grant-detail.component.scss'],
|
||||
selector: 'cnsl-project-grant-detail',
|
||||
templateUrl: './project-grant-detail.component.html',
|
||||
styleUrls: ['./project-grant-detail.component.scss'],
|
||||
})
|
||||
export class ProjectGrantDetailComponent {
|
||||
public INITIALPAGESIZE: number = 25;
|
||||
public INITIALPAGESIZE: number = 25;
|
||||
|
||||
public grant!: GrantedProject.AsObject;
|
||||
public projectid: string = '';
|
||||
public grantid: string = '';
|
||||
public grant!: GrantedProject.AsObject;
|
||||
public projectid: string = '';
|
||||
public grantid: string = '';
|
||||
|
||||
public disabled: boolean = false;
|
||||
public disabled: boolean = false;
|
||||
|
||||
public isZitadel: boolean = false;
|
||||
ProjectGrantState: any = ProjectGrantState;
|
||||
public isZitadel: boolean = false;
|
||||
ProjectGrantState: any = ProjectGrantState;
|
||||
|
||||
public projectRoleOptions: Role.AsObject[] = [];
|
||||
public memberRoleOptions: Array<string> = [];
|
||||
public projectRoleOptions: Role.AsObject[] = [];
|
||||
public memberRoleOptions: Array<string> = [];
|
||||
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
public dataSource!: ProjectGrantMembersDataSource;
|
||||
constructor(
|
||||
private mgmtService: ManagementService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
) {
|
||||
this.route.params.subscribe(params => {
|
||||
this.projectid = params.projectid;
|
||||
this.grantid = params.grantid;
|
||||
public changePageFactory!: Function;
|
||||
public changePage: EventEmitter<void> = new EventEmitter();
|
||||
public selection: Array<Member.AsObject> = [];
|
||||
public dataSource!: ProjectGrantMembersDataSource;
|
||||
constructor(
|
||||
private mgmtService: ManagementService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
) {
|
||||
this.route.params.subscribe(params => {
|
||||
this.projectid = params.projectid;
|
||||
this.grantid = params.grantid;
|
||||
|
||||
this.dataSource = new ProjectGrantMembersDataSource(this.mgmtService);
|
||||
this.dataSource.loadGrantMembers(params.projectid, params.grantid, 0, this.INITIALPAGESIZE);
|
||||
this.dataSource = new ProjectGrantMembersDataSource(this.mgmtService);
|
||||
this.dataSource.loadMembers(params.projectid, params.grantid, 0, this.INITIALPAGESIZE);
|
||||
|
||||
this.getRoleOptions(params.projectid);
|
||||
this.getMemberRoleOptions();
|
||||
this.getRoleOptions(params.projectid);
|
||||
this.getMemberRoleOptions();
|
||||
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
return this.dataSource.loadGrantMembers(
|
||||
params.projectid,
|
||||
params.grantid,
|
||||
event?.pageIndex ?? 0,
|
||||
event?.pageSize ?? this.INITIALPAGESIZE,
|
||||
);
|
||||
};
|
||||
this.changePageFactory = (event?: PageEvent) => {
|
||||
return this.dataSource.loadMembers(
|
||||
params.projectid,
|
||||
params.grantid,
|
||||
event?.pageIndex ?? 0,
|
||||
event?.pageSize ?? this.INITIALPAGESIZE,
|
||||
);
|
||||
};
|
||||
|
||||
this.mgmtService.getProjectGrantByID(this.grantid, this.projectid).then((resp) => {
|
||||
if (resp.projectGrant) {
|
||||
this.grant = resp.projectGrant;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public changeState(newState: ProjectGrantState): void {
|
||||
if (newState === ProjectGrantState.PROJECT_GRANT_STATE_ACTIVE) {
|
||||
this.mgmtService.reactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true);
|
||||
this.grant.state = newState;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (newState === ProjectGrantState.PROJECT_GRANT_STATE_INACTIVE) {
|
||||
this.mgmtService.deactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true);
|
||||
this.grant.state = newState;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
this.mgmtService.getProjectGrantByID(this.grantid, this.projectid).then((resp) => {
|
||||
if (resp.projectGrant) {
|
||||
this.grant = resp.projectGrant;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public getRoleOptions(projectId: string): void {
|
||||
this.mgmtService.listProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.projectRoleOptions = resp.resultList;
|
||||
});
|
||||
public changeState(newState: ProjectGrantState): void {
|
||||
if (newState === ProjectGrantState.PROJECT_GRANT_STATE_ACTIVE) {
|
||||
this.mgmtService.reactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true);
|
||||
this.grant.state = newState;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (newState === ProjectGrantState.PROJECT_GRANT_STATE_INACTIVE) {
|
||||
this.mgmtService.deactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true);
|
||||
this.grant.state = newState;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public getMemberRoleOptions(): void {
|
||||
this.mgmtService.listProjectGrantMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.resultList;
|
||||
public getRoleOptions(projectId: string): void {
|
||||
this.mgmtService.listProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.projectRoleOptions = resp.resultList;
|
||||
});
|
||||
}
|
||||
|
||||
public getMemberRoleOptions(): void {
|
||||
this.mgmtService.listProjectGrantMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.resultList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
updateRoles(selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateProjectGrant(this.grant.grantId, this.grant.projectId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTUPDATED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public removeProjectMemberSelection(): void {
|
||||
Promise.all(this.selection.map(member => {
|
||||
return this.mgmtService.removeProjectGrantMember(this.grant.projectId, this.grant.grantId, member.userId)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERREMOVED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
updateRoles(selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateProjectGrant(this.grant.grantId, this.grant.projectId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTUPDATED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
public async openAddMember(): Promise<any> {
|
||||
const keysList = (await this.mgmtService.listProjectGrantMemberRoles());
|
||||
|
||||
public removeProjectMemberSelection(): void {
|
||||
Promise.all(this.selection.map(member => {
|
||||
return this.mgmtService.removeProjectGrantMember(this.grant.projectId, this.grant.grantId, member.userId)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERREMOVED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 1000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}));
|
||||
}
|
||||
const dialogRef = this.dialog.open(ProjectGrantMembersCreateDialogComponent, {
|
||||
data: {
|
||||
roleKeysList: keysList.resultList,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
public async openAddMember(): Promise<any> {
|
||||
const keysList = (await this.mgmtService.listProjectGrantMemberRoles());
|
||||
|
||||
const dialogRef = this.dialog.open(ProjectGrantMembersCreateDialogComponent, {
|
||||
data: {
|
||||
roleKeysList: keysList.resultList,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((dataToAdd: ProjectGrantMembersCreateDialogExportType) => {
|
||||
if (dataToAdd) {
|
||||
Promise.all(dataToAdd.userIds.map((userid: string) => {
|
||||
return this.mgmtService.addProjectGrantMember(
|
||||
this.grant.projectId,
|
||||
this.grant.grantId,
|
||||
userid,
|
||||
dataToAdd.rolesKeyList,
|
||||
);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 3000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateMemberRoles(member: Member.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateProjectGrantMember(
|
||||
dialogRef.afterClosed().subscribe((dataToAdd: ProjectGrantMembersCreateDialogExportType) => {
|
||||
if (dataToAdd) {
|
||||
Promise.all(dataToAdd.userIds.map((userid: string) => {
|
||||
return this.mgmtService.addProjectGrantMember(
|
||||
this.grant.projectId,
|
||||
this.grant.grantId,
|
||||
member.userId,
|
||||
selectionChange.value,
|
||||
).then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERCHANGED', true);
|
||||
userid,
|
||||
dataToAdd.rolesKeyList,
|
||||
);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERADDED', true);
|
||||
setTimeout(() => {
|
||||
this.changePage.emit();
|
||||
}, 3000);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateMemberRoles(member: Member.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.mgmtService.updateProjectGrantMember(
|
||||
this.grant.projectId,
|
||||
this.grant.grantId,
|
||||
member.userId,
|
||||
selectionChange.value,
|
||||
).then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,8 +3,8 @@
|
||||
</h1>
|
||||
<p class="desc"> {{'ORG_DETAIL.MEMBER.ADDDESCRIPTION' | translate}}</p>
|
||||
<div mat-dialog-content>
|
||||
<app-search-user-autocomplete (selectionChanged)="selectUsers($event)">
|
||||
</app-search-user-autocomplete>
|
||||
<cnsl-search-user-autocomplete (selectionChanged)="selectUsers($event)">
|
||||
</cnsl-search-user-autocomplete>
|
||||
|
||||
<cnsl-form-field class="full-width" appearance="outline">
|
||||
<cnsl-label>{{ 'PROJECT.MEMBER.ROLES' | translate }}</cnsl-label>
|
||||
@@ -20,7 +20,7 @@
|
||||
cancel
|
||||
</button>
|
||||
|
||||
<button [disabled]="userIds.length == 0 || roleKeyList.length == 0" color="primary" mat-raised-button
|
||||
<button [disabled]="userIds.length === 0 || roleKeyList.length === 0" color="primary" mat-raised-button
|
||||
class="ok-button" (click)="closeDialogWithSuccess()">
|
||||
Add
|
||||
</button>
|
||||
|
||||
+26
-24
@@ -4,37 +4,39 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
|
||||
export interface ProjectGrantMembersCreateDialogExportType {
|
||||
userIds: string[];
|
||||
rolesKeyList: string[];
|
||||
userIds: string[];
|
||||
rolesKeyList: string[];
|
||||
}
|
||||
@Component({
|
||||
selector: 'app-project-grant-members-create-dialog',
|
||||
templateUrl: './project-grant-members-create-dialog.component.html',
|
||||
styleUrls: ['./project-grant-members-create-dialog.component.scss'],
|
||||
selector: 'cnsl-project-grant-members-create-dialog',
|
||||
templateUrl: './project-grant-members-create-dialog.component.html',
|
||||
styleUrls: ['./project-grant-members-create-dialog.component.scss'],
|
||||
})
|
||||
export class ProjectGrantMembersCreateDialogComponent {
|
||||
public form!: FormGroup;
|
||||
public userIds: string[] = [];
|
||||
public roleKeyList: string[] = [];
|
||||
public form!: FormGroup;
|
||||
public userIds: string[] = [];
|
||||
public roleKeyList: string[] = [];
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ProjectGrantMembersCreateDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ProjectGrantMembersCreateDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
|
||||
public selectUsers(users: User.AsObject[]): void {
|
||||
this.userIds = users.map(user => user.id);
|
||||
public selectUsers(users: User.AsObject | User.AsObject[]): void {
|
||||
if (Array.isArray(users)) {
|
||||
this.userIds = users.map(user => user.id);
|
||||
}
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
|
||||
public closeDialogWithSuccess(): void {
|
||||
const exportData: ProjectGrantMembersCreateDialogExportType = {
|
||||
userIds: this.userIds,
|
||||
rolesKeyList: this.roleKeyList,
|
||||
};
|
||||
this.dialogRef.close(exportData);
|
||||
}
|
||||
public closeDialogWithSuccess(): void {
|
||||
const exportData: ProjectGrantMembersCreateDialogExportType = {
|
||||
userIds: this.userIds,
|
||||
rolesKeyList: this.roleKeyList,
|
||||
};
|
||||
this.dialogRef.close(exportData);
|
||||
}
|
||||
}
|
||||
|
||||
+42
-44
@@ -11,55 +11,53 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
* (including sorting, pagination, and filtering).
|
||||
*/
|
||||
export class ProjectGrantMembersDataSource extends DataSource<Member.AsObject> {
|
||||
public totalResult: number = 0;
|
||||
public viewTimestamp!: Timestamp.AsObject;
|
||||
public totalResult: number = 0;
|
||||
public viewTimestamp!: Timestamp.AsObject;
|
||||
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
constructor(private service: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
public loadGrantMembers(projectId: string, grantId: string, pageIndex: number,
|
||||
pageSize: number): void {
|
||||
const offset = pageIndex * pageSize;
|
||||
public loadMembers(projectId: string, grantId: string, pageIndex: number, pageSize: number): void {
|
||||
const offset = pageIndex * pageSize;
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
this.loadingSubject.next(true);
|
||||
|
||||
from(this.mgmtService.listProjectGrantMembers(projectId,
|
||||
grantId, pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.details?.totalResult || 0;
|
||||
if (resp.details?.viewTimestamp) {
|
||||
this.viewTimestamp = resp.details?.viewTimestamp;
|
||||
}
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
from(this.service.listProjectGrantMembers(projectId,
|
||||
grantId, pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.details?.totalResult || 0;
|
||||
if (resp.details?.viewTimestamp) {
|
||||
this.viewTimestamp = resp.details?.viewTimestamp;
|
||||
}
|
||||
return resp.resultList;
|
||||
}),
|
||||
catchError(() => of([])),
|
||||
finalize(() => this.loadingSubject.next(false)),
|
||||
).subscribe(members => {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Connect this data source to the table. The table will only update when
|
||||
* the returned stream emits new items.
|
||||
* @returns A stream of the items to be rendered.
|
||||
*/
|
||||
public connect(): Observable<Member.AsObject[]> {
|
||||
return this.membersSubject.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect this data source to the table. The table will only update when
|
||||
* the returned stream emits new items.
|
||||
* @returns A stream of the items to be rendered.
|
||||
*/
|
||||
public connect(): Observable<Member.AsObject[]> {
|
||||
return this.membersSubject.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the table is being destroyed. Use this function, to clean up
|
||||
* any open connections or free any held resources that were set up during connect.
|
||||
*/
|
||||
public disconnect(): void {
|
||||
this.membersSubject.complete();
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
/**
|
||||
* Called when the table is being destroyed. Use this function, to clean up
|
||||
* any open connections or free any held resources that were set up during connect.
|
||||
*/
|
||||
public disconnect(): void {
|
||||
this.membersSubject.complete();
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,40 @@
|
||||
import { Location } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { AddProjectRequest, AddProjectResponse } from 'src/app/proto/generated/zitadel/management_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-create',
|
||||
templateUrl: './project-create.component.html',
|
||||
styleUrls: ['./project-create.component.scss'],
|
||||
selector: 'cnsl-project-create',
|
||||
templateUrl: './project-create.component.html',
|
||||
styleUrls: ['./project-create.component.scss'],
|
||||
})
|
||||
export class ProjectCreateComponent implements OnInit {
|
||||
public project: AddProjectRequest.AsObject = new AddProjectRequest().toObject();
|
||||
export class ProjectCreateComponent {
|
||||
public project: AddProjectRequest.AsObject = new AddProjectRequest().toObject();
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
) { }
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
) { }
|
||||
|
||||
public createSteps: number = 1;
|
||||
public currentCreateStep: number = 1;
|
||||
public ngOnInit(): void { }
|
||||
public createSteps: number = 1;
|
||||
public currentCreateStep: number = 1;
|
||||
|
||||
public saveProject(): void {
|
||||
this.mgmtService
|
||||
.addProject(this.project)
|
||||
.then((resp: AddProjectResponse.AsObject) => {
|
||||
this.router.navigate(['projects', resp.id]);
|
||||
})
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
public saveProject(): void {
|
||||
this.mgmtService
|
||||
.addProject(this.project)
|
||||
.then((resp: AddProjectResponse.AsObject) => {
|
||||
this.router.navigate(['projects', resp.id]);
|
||||
})
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,7 +18,7 @@
|
||||
<input cnslInput #domain />
|
||||
</cnsl-form-field>
|
||||
|
||||
<button [disabled]="domain.value.length == 0" color="primary" type="submit" class="domain-button"
|
||||
<button [disabled]="domain.value.length === 0" color="primary" type="submit" class="domain-button"
|
||||
mat-raised-button>
|
||||
{{'PROJECT.GRANT.CREATE.SEL_ORG_BUTTON' | translate}}
|
||||
</button>
|
||||
@@ -32,9 +32,9 @@
|
||||
<ng-container *ngIf="currentCreateStep === 2">
|
||||
<h1>{{'PROJECT.GRANT.CREATE.SEL_ROLES' | translate}}</h1>
|
||||
|
||||
<app-card *ngIf="projectId">
|
||||
<app-project-roles (changedSelection)="selectRoles($event)" [projectId]="projectId"></app-project-roles>
|
||||
</app-card>
|
||||
<cnsl-card *ngIf="projectId">
|
||||
<cnsl-project-roles (changedSelection)="selectRoles($event)" [projectId]="projectId"></cnsl-project-roles>
|
||||
</cnsl-card>
|
||||
</ng-container>
|
||||
|
||||
<div class="btn-container">
|
||||
|
||||
+63
-63
@@ -9,79 +9,79 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-grant-create',
|
||||
templateUrl: './project-grant-create.component.html',
|
||||
styleUrls: ['./project-grant-create.component.scss'],
|
||||
selector: 'cnsl-project-grant-create',
|
||||
templateUrl: './project-grant-create.component.html',
|
||||
styleUrls: ['./project-grant-create.component.scss'],
|
||||
})
|
||||
export class ProjectGrantCreateComponent implements OnInit, OnDestroy {
|
||||
public org!: Org.AsObject;
|
||||
public projectId: string = '';
|
||||
public grantId: string = '';
|
||||
public rolesKeyList: string[] = [];
|
||||
public org!: Org.AsObject;
|
||||
public projectId: string = '';
|
||||
public grantId: string = '';
|
||||
public rolesKeyList: string[] = [];
|
||||
|
||||
public STEPS: number = 2;
|
||||
public currentCreateStep: number = 1;
|
||||
public STEPS: number = 2;
|
||||
public currentCreateStep: number = 1;
|
||||
|
||||
private routeSubscription: Subscription = new Subscription();
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
private _location: Location,
|
||||
) { }
|
||||
private routeSubscription: Subscription = new Subscription();
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
private _location: Location,
|
||||
) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.routeSubscription = this.route.params.subscribe(params => {
|
||||
this.projectId = params.projectid;
|
||||
public ngOnInit(): void {
|
||||
this.routeSubscription = this.route.params.subscribe(params => {
|
||||
this.projectId = params.projectid;
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.routeSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
public searchOrg(domain: string): void {
|
||||
this.mgmtService.getOrgByDomainGlobal(domain).then((ret) => {
|
||||
if (ret.org) {
|
||||
const tmp = ret.org;
|
||||
this.authService.getActiveOrg().then((org) => {
|
||||
if (tmp !== org) {
|
||||
this.org = tmp;
|
||||
}
|
||||
});
|
||||
}
|
||||
this.org = ret.org;
|
||||
}
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.routeSubscription.unsubscribe();
|
||||
}
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
|
||||
public searchOrg(domain: string): void {
|
||||
this.mgmtService.getOrgByDomainGlobal(domain).then((ret) => {
|
||||
if (ret.org) {
|
||||
const tmp = ret.org;
|
||||
this.authService.getActiveOrg().then((org) => {
|
||||
if (tmp !== org) {
|
||||
this.org = tmp;
|
||||
}
|
||||
});
|
||||
this.org = ret.org;
|
||||
}
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
public addGrant(): void {
|
||||
this.mgmtService
|
||||
.addProjectGrant(this.org.id, this.projectId, this.rolesKeyList)
|
||||
.then(() => {
|
||||
this.close();
|
||||
})
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
public selectRoles(roles: Role.AsObject[]): void {
|
||||
this.rolesKeyList = roles.map(role => role.key);
|
||||
}
|
||||
|
||||
public addGrant(): void {
|
||||
this.mgmtService
|
||||
.addProjectGrant(this.org.id, this.projectId, this.rolesKeyList)
|
||||
.then(() => {
|
||||
this.close();
|
||||
})
|
||||
.catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
public next(): void {
|
||||
this.currentCreateStep++;
|
||||
}
|
||||
|
||||
public selectRoles(roles: Role.AsObject[]): void {
|
||||
this.rolesKeyList = roles.map(role => role.key);
|
||||
}
|
||||
|
||||
public next(): void {
|
||||
this.currentCreateStep++;
|
||||
}
|
||||
|
||||
public previous(): void {
|
||||
this.currentCreateStep--;
|
||||
}
|
||||
public previous(): void {
|
||||
this.currentCreateStep--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
</button>
|
||||
<form @list (ngSubmit)="addRole()">
|
||||
<div @animate *ngFor="let formGroup of formArray.controls; index as i" class="content">
|
||||
<ng-container [formGroup]="formGroup">
|
||||
<ng-container [formGroup]="$any(formGroup)">
|
||||
<cnsl-form-field appearance="outline" class="formfield">
|
||||
<cnsl-label>{{ 'PROJECT.ROLE.KEY' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="key" />
|
||||
|
||||
+80
-81
@@ -1,7 +1,7 @@
|
||||
import { animate, animateChild, query, stagger, style, transition, trigger } from '@angular/animations';
|
||||
import { Location } from '@angular/common';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { BulkAddProjectRolesRequest } from 'src/app/proto/generated/zitadel/management_pb';
|
||||
@@ -9,98 +9,97 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-project-role-create',
|
||||
templateUrl: './project-role-create.component.html',
|
||||
styleUrls: ['./project-role-create.component.scss'],
|
||||
animations: [
|
||||
trigger('list', [
|
||||
transition(':enter', [
|
||||
query('@animate',
|
||||
stagger(80, animateChild()),
|
||||
),
|
||||
]),
|
||||
]),
|
||||
trigger('animate', [
|
||||
transition(':enter', [
|
||||
style({ opacity: 0, transform: 'translateY(-100%)' }),
|
||||
animate('100ms', style({ opacity: 1, transform: 'translateY(0)' })),
|
||||
]),
|
||||
transition(':leave', [
|
||||
style({ opacity: 1, transform: 'translateY(0)' }),
|
||||
animate('100ms', style({ opacity: 0, transform: 'translateY(100%)' })),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
selector: 'cnsl-project-role-create',
|
||||
templateUrl: './project-role-create.component.html',
|
||||
styleUrls: ['./project-role-create.component.scss'],
|
||||
animations: [
|
||||
trigger('list', [
|
||||
transition(':enter', [
|
||||
query('@animate',
|
||||
stagger(80, animateChild()),
|
||||
),
|
||||
]),
|
||||
]),
|
||||
trigger('animate', [
|
||||
transition(':enter', [
|
||||
style({ opacity: 0, transform: 'translateY(-100%)' }),
|
||||
animate('100ms', style({ opacity: 1, transform: 'translateY(0)' })),
|
||||
]),
|
||||
transition(':leave', [
|
||||
style({ opacity: 1, transform: 'translateY(0)' }),
|
||||
animate('100ms', style({ opacity: 0, transform: 'translateY(100%)' })),
|
||||
]),
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class ProjectRoleCreateComponent implements OnInit, OnDestroy {
|
||||
private subscription?: Subscription;
|
||||
public projectId: string = '';
|
||||
private subscription: Subscription = new Subscription();
|
||||
public projectId: string = '';
|
||||
|
||||
public formArray!: FormArray;
|
||||
public formGroup!: FormGroup;
|
||||
public createSteps: number = 1;
|
||||
public currentCreateStep: number = 1;
|
||||
public formArray!: FormArray;
|
||||
public formGroup: FormGroup = this.fb.group({
|
||||
key: new FormControl('', [Validators.required]),
|
||||
displayName: new FormControl(''),
|
||||
group: new FormControl(''),
|
||||
});
|
||||
public createSteps: number = 1;
|
||||
public currentCreateStep: number = 1;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
) {
|
||||
this.formGroup = new FormGroup({
|
||||
key: new FormControl('', [Validators.required]),
|
||||
displayName: new FormControl(''),
|
||||
group: new FormControl(''),
|
||||
});
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private mgmtService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
private _location: Location,
|
||||
) {
|
||||
this.formArray = new FormArray([this.formGroup]);
|
||||
}
|
||||
|
||||
this.formArray = new FormArray([this.formGroup]);
|
||||
}
|
||||
public addEntry(): void {
|
||||
const newGroup = this.fb.group({
|
||||
key: new FormControl('', [Validators.required]),
|
||||
displayName: new FormControl(''),
|
||||
group: new FormControl(''),
|
||||
});
|
||||
|
||||
public addEntry(): void {
|
||||
const newGroup = new FormGroup({
|
||||
key: new FormControl('', [Validators.required]),
|
||||
displayName: new FormControl(''),
|
||||
group: new FormControl(''),
|
||||
});
|
||||
this.formArray.push(newGroup);
|
||||
}
|
||||
|
||||
this.formArray.push(newGroup);
|
||||
}
|
||||
public removeEntry(index: number): void {
|
||||
this.formArray.removeAt(index);
|
||||
}
|
||||
|
||||
public removeEntry(index: number): void {
|
||||
this.formArray.removeAt(index);
|
||||
}
|
||||
public ngOnInit(): void {
|
||||
this.subscription = this.route.params.subscribe(params => this.getData(params));
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.subscription = this.route.params.subscribe(params => this.getData(params));
|
||||
}
|
||||
public ngOnDestroy(): void {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.subscription?.unsubscribe();
|
||||
}
|
||||
private getData({ projectid }: Params): void {
|
||||
this.projectId = projectid;
|
||||
}
|
||||
|
||||
private getData({ projectid }: Params): void {
|
||||
this.projectId = projectid;
|
||||
}
|
||||
public addRole(): void {
|
||||
const rolesToAdd: BulkAddProjectRolesRequest.Role[] = this.formArray.value.map((element: any) => {
|
||||
const role = new BulkAddProjectRolesRequest.Role;
|
||||
role.setKey(element.key);
|
||||
role.setDisplayName(element.displayName);
|
||||
role.setGroup(element.group);
|
||||
return role;
|
||||
});
|
||||
|
||||
public addRole(): void {
|
||||
const rolesToAdd: BulkAddProjectRolesRequest.Role[] = this.formArray.value.map((element: any) => {
|
||||
const role = new BulkAddProjectRolesRequest.Role;
|
||||
role.setKey(element.key);
|
||||
role.setDisplayName(element.displayName);
|
||||
role.setGroup(element.group);
|
||||
return role;
|
||||
});
|
||||
|
||||
this.mgmtService.bulkAddProjectRoles(this.projectId, rolesToAdd).then(() => {
|
||||
this.router.navigate(['projects', this.projectId]);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
this.mgmtService.bulkAddProjectRoles(this.projectId, rolesToAdd).then(() => {
|
||||
this.router.navigate(['projects', this.projectId]);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
public close(): void {
|
||||
this._location.back();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-signedout',
|
||||
templateUrl: './signedout.component.html',
|
||||
styleUrls: ['./signedout.component.scss'],
|
||||
selector: 'cnsl-signedout',
|
||||
templateUrl: './signedout.component.html',
|
||||
styleUrls: ['./signedout.component.scss'],
|
||||
})
|
||||
export class SignedoutComponent {
|
||||
public dark: boolean = true;
|
||||
public dark: boolean = true;
|
||||
|
||||
constructor() {
|
||||
const theme = localStorage.getItem('theme');
|
||||
this.dark = theme === 'dark-theme' ? true : theme === 'light-theme' ? false : true;
|
||||
}
|
||||
constructor() {
|
||||
const theme = localStorage.getItem('theme');
|
||||
this.dark = theme === 'dark-theme' ? true : theme === 'light-theme' ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
<ng-container>
|
||||
<h2>{{'PROJECT.GRANT.CREATE.SEL_USER' | translate}}</h2>
|
||||
|
||||
<app-search-user-autocomplete class="block" singleOutput="true" [users]="user ? [user] : []"
|
||||
<cnsl-search-user-autocomplete class="block" [singleOutput]="true" [users]="user ? [user] : []"
|
||||
(selectionChanged)="selectUser($event)"
|
||||
[target]="context === UserGrantContext.USER ? UserTarget.EXTERNAL : UserTarget.SELF">
|
||||
</app-search-user-autocomplete>
|
||||
</cnsl-search-user-autocomplete>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="context && (context == UserGrantContext.USER || context == UserGrantContext.NONE)">
|
||||
<ng-container *ngIf="context && (context === UserGrantContext.USER || context === UserGrantContext.NONE)">
|
||||
<h2>{{'PROJECT.GRANT.CREATE.SEL_PROJECT' | translate}}</h2>
|
||||
|
||||
<app-search-project-autocomplete class="block" singleOutput="true"
|
||||
<cnsl-search-project-autocomplete class="block" [singleOutput]="true"
|
||||
(selectionChanged)="selectProject($event)">
|
||||
</app-search-project-autocomplete>
|
||||
</cnsl-search-project-autocomplete>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
<h1>{{'PROJECT.GRANT.CREATE.SEL_ROLES' | translate}}</h1>
|
||||
<ng-container
|
||||
*ngIf="$any(project)?.id && (context === UserGrantContext.OWNED_PROJECT || context === UserGrantContext.USER || context === UserGrantContext.NONE)">
|
||||
<app-card>
|
||||
<app-project-roles (changedSelection)="selectRoles($event)" [projectId]="projectId">
|
||||
</app-project-roles>
|
||||
</app-card>
|
||||
<cnsl-card>
|
||||
<cnsl-project-roles (changedSelection)="selectRoles($event)" [projectId]="projectId">
|
||||
</cnsl-project-roles>
|
||||
</cnsl-card>
|
||||
</ng-container>
|
||||
|
||||
<ng-container
|
||||
|
||||
@@ -13,7 +13,7 @@ import { StorageKey, StorageLocation, StorageService } from 'src/app/services/st
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-grant-create',
|
||||
selector: 'cnsl-user-grant-create',
|
||||
templateUrl: './user-grant-create.component.html',
|
||||
styleUrls: ['./user-grant-create.component.scss'],
|
||||
})
|
||||
@@ -179,8 +179,10 @@ export class UserGrantCreateComponent implements OnDestroy {
|
||||
this.grantedRoleKeysList = project.grantedRoleKeysList ?? [];
|
||||
}
|
||||
|
||||
public selectUser(user: User.AsObject): void {
|
||||
this.userId = user.id;
|
||||
public selectUser(user: User.AsObject | User.AsObject[]): void {
|
||||
if (typeof user === 'object') {
|
||||
this.userId = (user as User.AsObject).id;
|
||||
}
|
||||
}
|
||||
|
||||
public selectRoles(roles: Role.AsObject[]): void {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<app-detail-layout [backRouterLink]="[ '/users/list/machines']" title="{{ 'USER.CREATE.TITLE' | translate }}"
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/users/list/machines']" title="{{ 'USER.CREATE.TITLE' | translate }}"
|
||||
description="{{ 'USER.CREATE.DESCRIPTION' | translate }}">
|
||||
<mat-progress-bar *ngIf="loading" color="primary" mode="indeterminate"></mat-progress-bar>
|
||||
|
||||
@@ -31,4 +31,4 @@
|
||||
translate }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</app-detail-layout>
|
||||
</cnsl-detail-layout>
|
||||
@@ -7,76 +7,76 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-create-machine',
|
||||
templateUrl: './user-create-machine.component.html',
|
||||
styleUrls: ['./user-create-machine.component.scss'],
|
||||
selector: 'cnsl-user-create-machine',
|
||||
templateUrl: './user-create-machine.component.html',
|
||||
styleUrls: ['./user-create-machine.component.scss'],
|
||||
})
|
||||
export class UserCreateMachineComponent implements OnDestroy {
|
||||
public user: AddMachineUserRequest.AsObject = new AddMachineUserRequest().toObject();
|
||||
public userForm!: FormGroup;
|
||||
public user: AddMachineUserRequest.AsObject = new AddMachineUserRequest().toObject();
|
||||
public userForm!: FormGroup;
|
||||
|
||||
private sub: Subscription = new Subscription();
|
||||
public loading: boolean = false;
|
||||
private sub: Subscription = new Subscription();
|
||||
public loading: boolean = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
public userService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
this.initForm();
|
||||
}
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
public userService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
this.initForm();
|
||||
}
|
||||
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
userName: ['',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.minLength(2),
|
||||
],
|
||||
],
|
||||
name: ['', [Validators.required]],
|
||||
description: ['', []],
|
||||
});
|
||||
}
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
userName: ['',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.minLength(2),
|
||||
],
|
||||
],
|
||||
name: ['', [Validators.required]],
|
||||
description: ['', []],
|
||||
});
|
||||
}
|
||||
|
||||
public createUser(): void {
|
||||
this.user = this.userForm.value;
|
||||
public createUser(): void {
|
||||
this.user = this.userForm.value;
|
||||
|
||||
this.loading = true;
|
||||
this.loading = true;
|
||||
|
||||
const machineReq = new AddMachineUserRequest();
|
||||
machineReq.setDescription(this.description?.value);
|
||||
machineReq.setName(this.name?.value);
|
||||
machineReq.setUserName(this.userName?.value);
|
||||
const machineReq = new AddMachineUserRequest();
|
||||
machineReq.setDescription(this.description?.value);
|
||||
machineReq.setName(this.name?.value);
|
||||
machineReq.setUserName(this.userName?.value);
|
||||
|
||||
this.userService
|
||||
.addMachineUser(machineReq)
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
this.toast.showInfo('USER.TOAST.CREATED', true);
|
||||
const id = data.userId;
|
||||
if (id) {
|
||||
this.router.navigate(['users', id]);
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
this.userService
|
||||
.addMachineUser(machineReq)
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
this.toast.showInfo('USER.TOAST.CREATED', true);
|
||||
const id = data.userId;
|
||||
if (id) {
|
||||
this.router.navigate(['users', id]);
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
public get name(): AbstractControl | null {
|
||||
return this.userForm.get('name');
|
||||
}
|
||||
public get description(): AbstractControl | null {
|
||||
return this.userForm.get('description');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
public get name(): AbstractControl | null {
|
||||
return this.userForm.get('name');
|
||||
}
|
||||
public get description(): AbstractControl | null {
|
||||
return this.userForm.get('description');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<app-detail-layout [backRouterLink]="[ '/users/list/humans']" title="{{ 'USER.CREATE.TITLE' | translate }}"
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/users/list/humans']" title="{{ 'USER.CREATE.TITLE' | translate }}"
|
||||
description="{{ 'USER.CREATE.DESCRIPTION' | translate }}">
|
||||
<mat-progress-bar *ngIf="loading" color="primary" mode="indeterminate"></mat-progress-bar>
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<cnsl-form-field class="formfield">
|
||||
<cnsl-label>{{ 'USER.PROFILE.EMAIL' | translate }}*</cnsl-label>
|
||||
<input cnslInput matRipple formControlName="email" required />
|
||||
<span cnsl-error *ngIf="email?.invalid && !email?.errors?.required">
|
||||
<span cnslError *ngIf="email?.invalid && !email?.errors?.required">
|
||||
{{ 'USER.VALIDATION.NOTANEMAIL' | translate }}
|
||||
</span>
|
||||
<span cnsl-error *ngIf="email?.invalid && email?.errors?.required">
|
||||
<span cnslError *ngIf="email?.invalid && email?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -21,10 +21,10 @@
|
||||
[ngStyle]="{'padding-right': suffixPadding ? suffixPadding : '10px'}" />
|
||||
<span #suffix *ngIf="envSuffixLabel" cnslSuffix>{{envSuffixLabel}}</span>
|
||||
|
||||
<span cnsl-error *ngIf="userName?.invalid && userName?.errors?.required">
|
||||
<span cnslError *ngIf="userName?.invalid && userName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
<span cnsl-error *ngIf="userName?.invalid && userName?.errors?.noEmailValidator">
|
||||
<span cnslError *ngIf="userName?.invalid && userName?.errors?.noEmailValidator">
|
||||
{{ 'USER.VALIDATION.NOEMAIL' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -33,21 +33,21 @@
|
||||
<cnsl-form-field class="formfield">
|
||||
<cnsl-label>{{ 'USER.PROFILE.FIRSTNAME' | translate }}*</cnsl-label>
|
||||
<input cnslInput formControlName="firstName" required />
|
||||
<span cnsl-error *ngIf="firstName?.invalid && firstName?.errors?.required">
|
||||
<span cnslError *ngIf="firstName?.invalid && firstName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield">
|
||||
<cnsl-label>{{ 'USER.PROFILE.LASTNAME' | translate }}*</cnsl-label>
|
||||
<input cnslInput formControlName="lastName" required />
|
||||
<span cnsl-error *ngIf="lastName?.invalid && lastName?.errors?.required">
|
||||
<span cnslError *ngIf="lastName?.invalid && lastName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield">
|
||||
<cnsl-label>{{ 'USER.PROFILE.NICKNAME' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="nickName" />
|
||||
<span cnsl-error *ngIf="nickName?.invalid && nickName?.errors?.required">
|
||||
<span cnslError *ngIf="nickName?.invalid && nickName?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -61,7 +61,7 @@
|
||||
{{ 'GENDERS.'+gender | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<span cnsl-error *ngIf="gender?.invalid && gender?.errors?.required">
|
||||
<span cnslError *ngIf="gender?.invalid && gender?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -71,7 +71,7 @@
|
||||
<mat-option *ngFor="let language of languages" [value]="language">
|
||||
{{ 'LANGUAGES.'+language | translate }}
|
||||
</mat-option>
|
||||
<span cnsl-error *ngIf="preferredLanguage?.invalid && preferredLanguage?.errors?.required">
|
||||
<span cnslError *ngIf="preferredLanguage?.invalid && preferredLanguage?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</mat-select>
|
||||
@@ -82,7 +82,7 @@
|
||||
<cnsl-form-field class="formfield">
|
||||
<cnsl-label>{{ 'USER.PROFILE.PHONE' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="phone" />
|
||||
<span cnsl-error *ngIf="phone?.invalid && phone?.errors?.required">
|
||||
<span cnslError *ngIf="phone?.invalid && phone?.errors?.required">
|
||||
{{ 'USER.VALIDATION.REQUIRED' | translate }}
|
||||
</span>
|
||||
</cnsl-form-field>
|
||||
@@ -92,4 +92,4 @@
|
||||
translate }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</app-detail-layout>
|
||||
</cnsl-detail-layout>
|
||||
@@ -11,165 +11,167 @@ import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-create',
|
||||
templateUrl: './user-create.component.html',
|
||||
styleUrls: ['./user-create.component.scss'],
|
||||
selector: 'cnsl-user-create',
|
||||
templateUrl: './user-create.component.html',
|
||||
styleUrls: ['./user-create.component.scss'],
|
||||
})
|
||||
export class UserCreateComponent implements OnDestroy {
|
||||
public user: AddHumanUserRequest.AsObject = new AddHumanUserRequest().toObject();
|
||||
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
|
||||
public languages: string[] = ['de', 'en'];
|
||||
public userForm!: FormGroup;
|
||||
public envSuffixLabel: string = '';
|
||||
private destroyed$: Subject<void> = new Subject();
|
||||
public user: AddHumanUserRequest.AsObject = new AddHumanUserRequest().toObject();
|
||||
public genders: Gender[] = [Gender.GENDER_FEMALE, Gender.GENDER_MALE, Gender.GENDER_UNSPECIFIED];
|
||||
public languages: string[] = ['de', 'en'];
|
||||
public userForm!: FormGroup;
|
||||
public envSuffixLabel: string = '';
|
||||
private destroyed$: Subject<void> = new Subject();
|
||||
|
||||
public userLoginMustBeDomain: boolean = false;
|
||||
public loading: boolean = false;
|
||||
public userLoginMustBeDomain: boolean = false;
|
||||
public loading: boolean = false;
|
||||
|
||||
@ViewChild('suffix') public suffix!: any;
|
||||
private primaryDomain!: Domain.AsObject;
|
||||
@ViewChild('suffix') public suffix!: any;
|
||||
private primaryDomain!: Domain.AsObject;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private fb: FormBuilder,
|
||||
private mgmtService: ManagementService,
|
||||
private changeDetRef: ChangeDetectorRef,
|
||||
) {
|
||||
this.loading = true;
|
||||
this.loadOrg();
|
||||
this.mgmtService.getOrgIAMPolicy().then((resp) => {
|
||||
if (resp.policy?.userLoginMustBeDomain) {
|
||||
this.userLoginMustBeDomain = resp.policy.userLoginMustBeDomain;
|
||||
}
|
||||
this.initForm();
|
||||
this.loading = false;
|
||||
this.envSuffixLabel = this.envSuffix();
|
||||
this.changeDetRef.detectChanges();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
this.initForm();
|
||||
this.loading = false;
|
||||
this.envSuffixLabel = this.envSuffix();
|
||||
this.changeDetRef.detectChanges();
|
||||
});
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private fb: FormBuilder,
|
||||
private mgmtService: ManagementService,
|
||||
private changeDetRef: ChangeDetectorRef,
|
||||
) {
|
||||
this.loading = true;
|
||||
this.loadOrg();
|
||||
this.mgmtService.getOrgIAMPolicy().then((resp) => {
|
||||
if (resp.policy?.userLoginMustBeDomain) {
|
||||
this.userLoginMustBeDomain = resp.policy.userLoginMustBeDomain;
|
||||
}
|
||||
this.initForm();
|
||||
this.loading = false;
|
||||
this.envSuffixLabel = this.envSuffix();
|
||||
this.changeDetRef.detectChanges();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
this.initForm();
|
||||
this.loading = false;
|
||||
this.envSuffixLabel = this.envSuffix();
|
||||
this.changeDetRef.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
private async loadOrg(): Promise<void> {
|
||||
const domains = (await this.mgmtService.listOrgDomains());
|
||||
const found = domains.resultList.find(resp => resp.isPrimary);
|
||||
if (found) {
|
||||
this.primaryDomain = found;
|
||||
}
|
||||
}
|
||||
|
||||
private async loadOrg(): Promise<void> {
|
||||
const domains = (await this.mgmtService.listOrgDomains());
|
||||
const found = domains.resultList.find(resp => resp.isPrimary);
|
||||
if (found) {
|
||||
this.primaryDomain = found;
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
email: ['', [Validators.required, Validators.email]],
|
||||
userName: ['',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.minLength(2),
|
||||
],
|
||||
],
|
||||
firstName: ['', Validators.required],
|
||||
lastName: ['', Validators.required],
|
||||
nickName: [''],
|
||||
gender: [],
|
||||
preferredLanguage: [''],
|
||||
phone: [''],
|
||||
});
|
||||
|
||||
this.userForm.controls['phone'].valueChanges.pipe(
|
||||
takeUntil(this.destroyed$),
|
||||
debounceTime(300)).subscribe(value => {
|
||||
const phoneNumber = parsePhoneNumber(value ?? '', 'CH');
|
||||
if (phoneNumber) {
|
||||
const formmatted = phoneNumber.formatInternational();
|
||||
const country = phoneNumber.country;
|
||||
if (this.phone && country && this.phone.value && this.phone.value !== formmatted) {
|
||||
this.phone.setValue(formmatted);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public createUser(): void {
|
||||
this.user = this.userForm.value;
|
||||
|
||||
this.loading = true;
|
||||
|
||||
const profileReq = new AddHumanUserRequest.Profile();
|
||||
profileReq.setFirstName(this.firstName?.value);
|
||||
profileReq.setLastName(this.lastName?.value);
|
||||
profileReq.setNickName(this.nickName?.value);
|
||||
profileReq.setPreferredLanguage(this.preferredLanguage?.value);
|
||||
profileReq.setGender(this.gender?.value);
|
||||
|
||||
const humanReq = new AddHumanUserRequest();
|
||||
humanReq.setUserName(this.userName?.value);
|
||||
humanReq.setProfile(profileReq);
|
||||
|
||||
humanReq.setEmail(new AddHumanUserRequest.Email().setEmail(this.email?.value));
|
||||
|
||||
if (this.phone && this.phone.value) {
|
||||
humanReq.setPhone(new AddHumanUserRequest.Phone().setPhone(this.phone.value));
|
||||
}
|
||||
|
||||
private initForm(): void {
|
||||
this.userForm = this.fb.group({
|
||||
email: ['', [Validators.required, Validators.email]],
|
||||
userName: ['',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.minLength(2),
|
||||
],
|
||||
],
|
||||
firstName: ['', Validators.required],
|
||||
lastName: ['', Validators.required],
|
||||
nickName: [''],
|
||||
gender: [],
|
||||
preferredLanguage: [''],
|
||||
phone: [''],
|
||||
});
|
||||
this.mgmtService
|
||||
.addHumanUser(humanReq)
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
this.toast.showInfo('USER.TOAST.CREATED', true);
|
||||
this.router.navigate(['users', data.userId]);
|
||||
})
|
||||
.catch(error => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
this.userForm.controls['phone'].valueChanges.pipe(
|
||||
takeUntil(this.destroyed$),
|
||||
debounceTime(300)).subscribe(value => {
|
||||
const phoneNumber = parsePhoneNumber(value ?? '', 'CH');
|
||||
if (phoneNumber) {
|
||||
const formmatted = phoneNumber.formatInternational();
|
||||
const country = phoneNumber.country;
|
||||
if (this.phone && country && this.phone.value && this.phone.value !== formmatted) {
|
||||
this.phone.setValue(formmatted);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.destroyed$.next();
|
||||
this.destroyed$.complete();
|
||||
}
|
||||
|
||||
public createUser(): void {
|
||||
this.user = this.userForm.value;
|
||||
public get email(): AbstractControl | null {
|
||||
return this.userForm.get('email');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
public get firstName(): AbstractControl | null {
|
||||
return this.userForm.get('firstName');
|
||||
}
|
||||
public get lastName(): AbstractControl | null {
|
||||
return this.userForm.get('lastName');
|
||||
}
|
||||
public get nickName(): AbstractControl | null {
|
||||
return this.userForm.get('nickName');
|
||||
}
|
||||
public get gender(): AbstractControl | null {
|
||||
return this.userForm.get('gender');
|
||||
}
|
||||
public get preferredLanguage(): AbstractControl | null {
|
||||
return this.userForm.get('preferredLanguage');
|
||||
}
|
||||
public get phone(): AbstractControl | null {
|
||||
return this.userForm.get('phone');
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
private envSuffix(): string {
|
||||
if (this.userLoginMustBeDomain && this.primaryDomain?.domainName) {
|
||||
return `@${this.primaryDomain.domainName}`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
const profileReq = new AddHumanUserRequest.Profile();
|
||||
profileReq.setFirstName(this.firstName?.value);
|
||||
profileReq.setLastName(this.lastName?.value);
|
||||
profileReq.setNickName(this.nickName?.value);
|
||||
profileReq.setPreferredLanguage(this.preferredLanguage?.value);
|
||||
profileReq.setGender(this.gender?.value);
|
||||
|
||||
const humanReq = new AddHumanUserRequest();
|
||||
humanReq.setUserName(this.userName?.value);
|
||||
humanReq.setProfile(profileReq);
|
||||
|
||||
humanReq.setEmail(new AddHumanUserRequest.Email().setEmail(this.email?.value));
|
||||
|
||||
if (this.phone && this.phone.value) {
|
||||
humanReq.setPhone(new AddHumanUserRequest.Phone().setPhone(this.phone.value));
|
||||
}
|
||||
|
||||
this.mgmtService
|
||||
.addHumanUser(humanReq)
|
||||
.then((data) => {
|
||||
this.loading = false;
|
||||
this.toast.showInfo('USER.TOAST.CREATED', true);
|
||||
this.router.navigate(['users', data.userId]);
|
||||
})
|
||||
.catch(error => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroyed$.next();
|
||||
this.destroyed$.complete();
|
||||
}
|
||||
|
||||
public get email(): AbstractControl | null {
|
||||
return this.userForm.get('email');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.userForm.get('userName');
|
||||
}
|
||||
public get firstName(): AbstractControl | null {
|
||||
return this.userForm.get('firstName');
|
||||
}
|
||||
public get lastName(): AbstractControl | null {
|
||||
return this.userForm.get('lastName');
|
||||
}
|
||||
public get nickName(): AbstractControl | null {
|
||||
return this.userForm.get('nickName');
|
||||
}
|
||||
public get gender(): AbstractControl | null {
|
||||
return this.userForm.get('gender');
|
||||
}
|
||||
public get preferredLanguage(): AbstractControl | null {
|
||||
return this.userForm.get('preferredLanguage');
|
||||
}
|
||||
public get phone(): AbstractControl | null {
|
||||
return this.userForm.get('phone');
|
||||
}
|
||||
|
||||
private envSuffix(): string {
|
||||
if (this.userLoginMustBeDomain && this.primaryDomain?.domainName) {
|
||||
return `@${this.primaryDomain.domainName}`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public get suffixPadding(): string | undefined {
|
||||
if (this.suffix?.nativeElement.offsetWidth) {
|
||||
return `${(this.suffix.nativeElement as HTMLElement).offsetWidth + 10}px`;
|
||||
}
|
||||
public get suffixPadding(): string | undefined {
|
||||
if (this.suffix?.nativeElement.offsetWidth) {
|
||||
return `${(this.suffix.nativeElement as HTMLElement).offsetWidth + 10}px`;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
<span class="title">{{'USER.MFA.DIALOG.ADD_MFA_TITLE' | translate}} {{data?.number}}</span>
|
||||
</h1>
|
||||
<div mat-dialog-content>
|
||||
<ng-container *ngIf="selectedType == undefined">
|
||||
<ng-container *ngIf="selectedType === undefined">
|
||||
<p class="desc">{{'USER.MFA.DIALOG.ADD_MFA_DESCRIPTION' | translate}}</p>
|
||||
|
||||
<div class="type-selection">
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<div class="otp" *ngIf="selectedType == AuthFactorType.OTP">
|
||||
<div class="otp" *ngIf="selectedType === AuthFactorType.OTP">
|
||||
<p class="desc">{{'USER.MFA.OTP_DIALOG_DESCRIPTION' | translate}}</p>
|
||||
|
||||
<div class="qrcode-wrapper">
|
||||
@@ -38,7 +38,7 @@
|
||||
</cnsl-form-field>
|
||||
</div>
|
||||
|
||||
<div class="u2f" *ngIf="selectedType == AuthFactorType.U2F">
|
||||
<div class="u2f" *ngIf="selectedType === AuthFactorType.U2F">
|
||||
<p>{{'USER.MFA.U2F_DIALOG_DESCRIPTION' | translate}}</p>
|
||||
|
||||
<cnsl-form-field class="form-field" label="Name" required="true">
|
||||
|
||||
+110
-110
@@ -9,133 +9,133 @@ import { _base64ToArrayBuffer } from '../../u2f-util';
|
||||
import { _arrayBufferToBase64 } from '../u2f_util';
|
||||
|
||||
export enum AuthFactorType {
|
||||
OTP,
|
||||
U2F,
|
||||
OTP,
|
||||
U2F,
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-auth-factor-dialog',
|
||||
templateUrl: './auth-factor-dialog.component.html',
|
||||
styleUrls: ['./auth-factor-dialog.component.scss'],
|
||||
selector: 'cnsl-auth-factor-dialog',
|
||||
templateUrl: './auth-factor-dialog.component.html',
|
||||
styleUrls: ['./auth-factor-dialog.component.scss'],
|
||||
})
|
||||
export class AuthFactorDialogComponent {
|
||||
public otpurl: string = '';
|
||||
public otpcode: string = '';
|
||||
public otpurl: string = '';
|
||||
public otpcode: string = '';
|
||||
|
||||
public u2fname: string = '';
|
||||
public u2fCredentialOptions!: CredentialCreationOptions;
|
||||
public u2fLoading: boolean = false;
|
||||
public u2fError: string = '';
|
||||
public u2fname: string = '';
|
||||
public u2fCredentialOptions!: CredentialCreationOptions;
|
||||
public u2fLoading: boolean = false;
|
||||
public u2fError: string = '';
|
||||
|
||||
AuthFactorType: any = AuthFactorType;
|
||||
selectedType!: AuthFactorType;
|
||||
constructor(
|
||||
private authService: GrpcAuthService,
|
||||
private toast: ToastService,
|
||||
private translate: TranslateService,
|
||||
public dialogRef: MatDialogRef<AuthFactorDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
AuthFactorType: any = AuthFactorType;
|
||||
selectedType!: AuthFactorType;
|
||||
constructor(
|
||||
private authService: GrpcAuthService,
|
||||
private toast: ToastService,
|
||||
private translate: TranslateService,
|
||||
public dialogRef: MatDialogRef<AuthFactorDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) { }
|
||||
|
||||
closeDialog(code: string = ''): void {
|
||||
this.dialogRef.close(code);
|
||||
}
|
||||
closeDialog(code: string = ''): void {
|
||||
this.dialogRef.close(code);
|
||||
}
|
||||
|
||||
public selectType(type: AuthFactorType): void {
|
||||
this.selectedType = type;
|
||||
public selectType(type: AuthFactorType): void {
|
||||
this.selectedType = type;
|
||||
|
||||
if (type === AuthFactorType.OTP) {
|
||||
this.authService.addMyMultiFactorOTP().then((otpresp) => {
|
||||
this.otpurl = otpresp.url;
|
||||
}, error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (type === AuthFactorType.U2F) {
|
||||
this.authService.addMyMultiFactorU2F().then((u2fresp) => {
|
||||
if (u2fresp.key) {
|
||||
const credOptions: CredentialCreationOptions = JSON.parse(atob(u2fresp.key?.publicKey as string));
|
||||
if (type === AuthFactorType.OTP) {
|
||||
this.authService.addMyMultiFactorOTP().then((otpresp) => {
|
||||
this.otpurl = otpresp.url;
|
||||
}, error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (type === AuthFactorType.U2F) {
|
||||
this.authService.addMyMultiFactorU2F().then((u2fresp) => {
|
||||
if (u2fresp.key) {
|
||||
const credOptions: CredentialCreationOptions = JSON.parse(atob(u2fresp.key?.publicKey as string));
|
||||
|
||||
if (credOptions.publicKey?.challenge) {
|
||||
credOptions.publicKey.challenge = _base64ToArrayBuffer(credOptions.publicKey.challenge as any);
|
||||
credOptions.publicKey.user.id = _base64ToArrayBuffer(credOptions.publicKey.user.id as any);
|
||||
if (credOptions.publicKey.excludeCredentials) {
|
||||
credOptions.publicKey.excludeCredentials.map(cred => {
|
||||
cred.id = _base64ToArrayBuffer(cred.id as any);
|
||||
return cred;
|
||||
});
|
||||
}
|
||||
this.u2fCredentialOptions = credOptions;
|
||||
}
|
||||
}
|
||||
}, error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
if (credOptions.publicKey?.challenge) {
|
||||
credOptions.publicKey.challenge = _base64ToArrayBuffer(credOptions.publicKey.challenge as any);
|
||||
credOptions.publicKey.user.id = _base64ToArrayBuffer(credOptions.publicKey.user.id as any);
|
||||
if (credOptions.publicKey.excludeCredentials) {
|
||||
credOptions.publicKey.excludeCredentials.map(cred => {
|
||||
cred.id = _base64ToArrayBuffer(cred.id as any);
|
||||
return cred;
|
||||
});
|
||||
}
|
||||
this.u2fCredentialOptions = credOptions;
|
||||
}
|
||||
}
|
||||
}, error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public submitAuth(): void {
|
||||
if (this.selectedType === AuthFactorType.OTP) {
|
||||
this.submitOTP();
|
||||
} else if (this.selectedType === AuthFactorType.U2F) {
|
||||
this.submitU2F();
|
||||
}
|
||||
public submitAuth(): void {
|
||||
if (this.selectedType === AuthFactorType.OTP) {
|
||||
this.submitOTP();
|
||||
} else if (this.selectedType === AuthFactorType.U2F) {
|
||||
this.submitU2F();
|
||||
}
|
||||
}
|
||||
|
||||
public submitOTP(): void {
|
||||
this.authService.verifyMyMultiFactorOTP(this.otpcode).then(() => {
|
||||
public submitOTP(): void {
|
||||
this.authService.verifyMyMultiFactorOTP(this.otpcode).then(() => {
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
this.dialogRef.close(false);
|
||||
});
|
||||
}
|
||||
|
||||
public submitU2F(): void {
|
||||
if (this.u2fname && this.u2fCredentialOptions.publicKey) {
|
||||
// this.data.credOptions.publicKey.rp.id = 'localhost';
|
||||
navigator.credentials.create(this.u2fCredentialOptions).then((resp) => {
|
||||
if (resp &&
|
||||
(resp as any).response.attestationObject &&
|
||||
(resp as any).response.clientDataJSON &&
|
||||
(resp as any).rawId) {
|
||||
|
||||
const attestationObject = (resp as any).response.attestationObject;
|
||||
const clientDataJSON = (resp as any).response.clientDataJSON;
|
||||
const rawId = (resp as any).rawId;
|
||||
|
||||
const data = JSON.stringify({
|
||||
id: resp.id,
|
||||
rawId: _arrayBufferToBase64(rawId),
|
||||
type: resp.type,
|
||||
response: {
|
||||
attestationObject: _arrayBufferToBase64(attestationObject),
|
||||
clientDataJSON: _arrayBufferToBase64(clientDataJSON),
|
||||
},
|
||||
});
|
||||
|
||||
const base64 = btoa(data);
|
||||
|
||||
this.authService.verifyMyMultiFactorU2F(base64, this.u2fname).then(() => {
|
||||
this.translate.get('USER.MFA.U2F_SUCCESS').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
}, error => {
|
||||
this.dialogRef.close(false);
|
||||
});
|
||||
}
|
||||
|
||||
public submitU2F(): void {
|
||||
if (this.u2fname && this.u2fCredentialOptions.publicKey) {
|
||||
// this.data.credOptions.publicKey.rp.id = 'localhost';
|
||||
navigator.credentials.create(this.u2fCredentialOptions).then((resp) => {
|
||||
if (resp &&
|
||||
(resp as any).response.attestationObject &&
|
||||
(resp as any).response.clientDataJSON &&
|
||||
(resp as any).rawId) {
|
||||
|
||||
const attestationObject = (resp as any).response.attestationObject;
|
||||
const clientDataJSON = (resp as any).response.clientDataJSON;
|
||||
const rawId = (resp as any).rawId;
|
||||
|
||||
const data = JSON.stringify({
|
||||
id: resp.id,
|
||||
rawId: _arrayBufferToBase64(rawId),
|
||||
type: resp.type,
|
||||
response: {
|
||||
attestationObject: _arrayBufferToBase64(attestationObject),
|
||||
clientDataJSON: _arrayBufferToBase64(clientDataJSON),
|
||||
},
|
||||
});
|
||||
|
||||
const base64 = btoa(data);
|
||||
|
||||
this.authService.verifyMyMultiFactorU2F(base64, this.u2fname).then(() => {
|
||||
this.translate.get('USER.MFA.U2F_SUCCESS').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
this.u2fLoading = false;
|
||||
}).catch(error => {
|
||||
this.u2fLoading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else {
|
||||
this.u2fLoading = false;
|
||||
this.translate.get('USER.MFA.U2F_ERROR').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.u2fLoading = false;
|
||||
this.u2fError = error;
|
||||
this.toast.showInfo(error.message);
|
||||
});
|
||||
this.u2fLoading = false;
|
||||
}).catch(error => {
|
||||
this.u2fLoading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else {
|
||||
this.u2fLoading = false;
|
||||
this.translate.get('USER.MFA.U2F_ERROR').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
}).catch(error => {
|
||||
this.u2fLoading = false;
|
||||
this.u2fError = error;
|
||||
this.toast.showInfo(error.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
<app-card title="{{'USER.PASSWORDLESS.TITLE' | translate}}"
|
||||
<cnsl-card title="{{'USER.PASSWORDLESS.TITLE' | translate}}"
|
||||
description="{{'USER.PASSWORDLESS.DESCRIPTION' | translate}}">
|
||||
<button card-actions mat-icon-button (click)="getPasswordless()" class="icon-button" matTooltip="{{'ACTIONS.REFRESH' | translate}}">
|
||||
<mat-icon class="icon">refresh</mat-icon>
|
||||
</button>
|
||||
<app-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getPasswordless()"
|
||||
[dataSize]="dataSource?.data?.length">
|
||||
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getPasswordless()"
|
||||
[dataSize]="dataSource?.data?.length ?? 0">
|
||||
<table class="table" mat-table [dataSource]="dataSource">
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'USER.PASSWORDLESS.NAME' | translate }} </th>
|
||||
@@ -37,7 +37,7 @@
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</app-refresh-table>
|
||||
</cnsl-refresh-table>
|
||||
<div class="add-row">
|
||||
<button class="button" (click)="addPasswordless()" mat-raised-button color="primary"
|
||||
matTooltip="{{'ACTIONS.NEW' | translate}}">
|
||||
@@ -50,4 +50,4 @@
|
||||
<mat-spinner diameter="50"></mat-spinner>
|
||||
</div>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
+1
-1
@@ -23,7 +23,7 @@ export interface WebAuthNOptions {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-auth-passwordless',
|
||||
selector: 'cnsl-auth-passwordless',
|
||||
templateUrl: './auth-passwordless.component.html',
|
||||
styleUrls: ['./auth-passwordless.component.scss'],
|
||||
})
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ export enum U2FComponentDestination {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-dialog-passwordless',
|
||||
selector: 'cnsl-dialog-passwordless',
|
||||
templateUrl: './dialog-passwordless.component.html',
|
||||
styleUrls: ['./dialog-passwordless.component.scss'],
|
||||
})
|
||||
|
||||
+26
-26
@@ -1,4 +1,4 @@
|
||||
<app-meta-layout>
|
||||
<cnsl-meta-layout>
|
||||
<div class="max-width-container">
|
||||
<div class="header-row">
|
||||
<div class="text">
|
||||
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
|
||||
<div class="theme">
|
||||
<app-theme-setting></app-theme-setting>
|
||||
<cnsl-theme-setting></cnsl-theme-setting>
|
||||
</div>
|
||||
</div>
|
||||
<mat-progress-bar *ngIf="loading" color="primary" mode="indeterminate"></mat-progress-bar>
|
||||
@@ -16,40 +16,40 @@
|
||||
|
||||
<cnsl-info-row *ngIf="user" [user]="user"></cnsl-info-row>
|
||||
|
||||
<app-card *ngIf="user && user.human?.profile" class=" app-card" title="{{ 'USER.PROFILE.TITLE' | translate }}">
|
||||
<app-detail-form [showEditImage]="true" [preferredLoginName]="user.preferredLoginName" [genders]="genders" [languages]="languages" [username]="user.userName" [user]="user.human"
|
||||
<cnsl-card *ngIf="user && user.human && user.human.profile" class=" app-card" title="{{ 'USER.PROFILE.TITLE' | translate }}">
|
||||
<cnsl-detail-form [showEditImage]="true" [preferredLoginName]="user.preferredLoginName" [genders]="genders" [languages]="languages" [username]="user.userName" [user]="user.human"
|
||||
(changedLanguage)="changedLanguage($event)" (submitData)="saveProfile($event)">
|
||||
</app-detail-form>
|
||||
</app-card>
|
||||
</cnsl-detail-form>
|
||||
</cnsl-card>
|
||||
|
||||
<app-card *ngIf="user" title="{{ 'USER.LOGINMETHODS.TITLE' | translate }}"
|
||||
<cnsl-card *ngIf="user" title="{{ 'USER.LOGINMETHODS.TITLE' | translate }}"
|
||||
description="{{ 'USER.LOGINMETHODS.DESCRIPTION' | translate }}">
|
||||
<button class="icon-button" card-actions mat-icon-button (click)="refreshUser()" matTooltip="{{'ACTIONS.REFRESH' | translate}}">
|
||||
<mat-icon class="icon">refresh</mat-icon>
|
||||
</button>
|
||||
<app-contact *ngIf="user?.human" [human]="user.human" [state]="user.state" canWrite="true"
|
||||
<cnsl-contact *ngIf="user.human" [human]="user.human" [state]="user.state" [canWrite]="true"
|
||||
(editType)="openEditDialog($event)" (enteredPhoneCode)="enteredPhoneCode($event)"
|
||||
(deletedPhone)="deletePhone()" (resendEmailVerification)="resendEmailVerification()"
|
||||
(resendPhoneVerification)="resendPhoneVerification()">
|
||||
</app-contact>
|
||||
</app-card>
|
||||
</cnsl-contact>
|
||||
</cnsl-card>
|
||||
|
||||
<app-external-idps [userId]="user?.id" [service]="userService"></app-external-idps>
|
||||
<cnsl-external-idps *ngIf="user && user.id" [userId]="user.id" [service]="userService"></cnsl-external-idps>
|
||||
|
||||
<app-auth-passwordless *ngIf="user" #mfaComponent></app-auth-passwordless>
|
||||
<cnsl-auth-passwordless *ngIf="user" #mfaComponent></cnsl-auth-passwordless>
|
||||
|
||||
<app-auth-user-mfa *ngIf="user" #mfaComponent></app-auth-user-mfa>
|
||||
<cnsl-auth-user-mfa *ngIf="user" #mfaComponent></cnsl-auth-user-mfa>
|
||||
|
||||
<app-card *ngIf="user?.id" title="{{ 'GRANTS.USER.TITLE' | translate }}"
|
||||
<cnsl-card *ngIf="user?.id" title="{{ 'GRANTS.USER.TITLE' | translate }}"
|
||||
description="{{'GRANTS.USER.DESCRIPTION' | translate }}">
|
||||
<app-user-grants [userId]="user.id" [context]="USERGRANTCONTEXT"
|
||||
<cnsl-user-grants [userId]="user.id" [context]="USERGRANTCONTEXT"
|
||||
[displayedColumns]="['select', 'projectId', 'dates', 'roleNamesList']"
|
||||
[disableWrite]="((['user.grant.write$'] | hasRole) | async) == false"
|
||||
[disableDelete]="((['user.grant.delete$'] | hasRole) | async) == false">
|
||||
</app-user-grants>
|
||||
</app-card>
|
||||
[disableWrite]="((['user.grant.write$'] | hasRole) | async) === false"
|
||||
[disableDelete]="((['user.grant.delete$'] | hasRole) | async) === false">
|
||||
</cnsl-user-grants>
|
||||
</cnsl-card>
|
||||
|
||||
<ng-template appHasFeature [appHasFeature]="['metadata.user']">
|
||||
<ng-template cnslHasFeature [hasFeature]="['metadata.user']">
|
||||
<cnsl-metadata *ngIf="user?.id" [userId]="user.id"></cnsl-metadata>
|
||||
</ng-template>
|
||||
</div>
|
||||
@@ -65,18 +65,18 @@
|
||||
<span class="second"><span style="display: block;">{{user.preferredLoginName}}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" disablePagination="true">
|
||||
<mat-tab-group mat-stretch-tabs class="tab-group" [disablePagination]="true">
|
||||
<mat-tab label="Details">
|
||||
<div class="side-padding">
|
||||
<ng-template appHasRole [appHasRole]="['user.membership.read']">
|
||||
<app-memberships [auth]="true" [user]="user"></app-memberships>
|
||||
<ng-template cnslHasRole [hasRole]="['user.membership.read']">
|
||||
<cnsl-memberships [auth]="true" [user]="user"></cnsl-memberships>
|
||||
</ng-template>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="{{ 'CHANGES.PROJECT.TITLE' | translate }}" class="meta-flex-col">
|
||||
<app-changes class="changes" [refresh]="refreshChanges$" [changeType]="ChangeType.MYUSER" [id]="user.id">
|
||||
</app-changes>
|
||||
<cnsl-changes class="changes" [refresh]="refreshChanges$" [changeType]="ChangeType.MYUSER" [id]="user.id">
|
||||
</cnsl-changes>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
</div>
|
||||
</app-meta-layout>
|
||||
</cnsl-meta-layout>
|
||||
+1
-1
@@ -11,7 +11,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { EditDialogComponent, EditDialogType } from './edit-dialog/edit-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-auth-user-detail',
|
||||
selector: 'cnsl-auth-user-detail',
|
||||
templateUrl: './auth-user-detail.component.html',
|
||||
styleUrls: ['./auth-user-detail.component.scss'],
|
||||
})
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<app-card title="{{'USER.MFA.TITLE' | translate}}" description="{{'USER.MFA.DESCRIPTION' | translate}}">
|
||||
<cnsl-card title="{{'USER.MFA.TITLE' | translate}}" description="{{'USER.MFA.DESCRIPTION' | translate}}">
|
||||
<button card-actions mat-icon-button (click)="getMFAs()" class="icon-button" matTooltip="{{'ACTIONS.REFRESH' | translate}}">
|
||||
<mat-icon class="icon">refresh</mat-icon>
|
||||
</button>
|
||||
<app-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getMFAs()" [dataSize]="dataSource?.data?.length">
|
||||
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" (refreshed)="getMFAs()" [dataSize]="dataSource?.data?.length ?? 0">
|
||||
<table class="table" mat-table [dataSource]="dataSource">
|
||||
<ng-container matColumnDef="type">
|
||||
<th mat-header-cell *matHeaderCellDef> {{ 'USER.MFA.TABLETYPE' | translate }} </th>
|
||||
@@ -44,7 +44,7 @@
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
</table>
|
||||
</app-refresh-table>
|
||||
</cnsl-refresh-table>
|
||||
<div class="add-row">
|
||||
<button class="button" (click)="addAuthFactor()" mat-raised-button color="primary"
|
||||
matTooltip="{{'ACTIONS.NEW' | translate}}">
|
||||
@@ -57,4 +57,4 @@
|
||||
<mat-spinner diameter="50"></mat-spinner>
|
||||
</div>
|
||||
</div>
|
||||
</app-card>
|
||||
</cnsl-card>
|
||||
+99
-99
@@ -11,121 +11,121 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { AuthFactorDialogComponent } from '../auth-factor-dialog/auth-factor-dialog.component';
|
||||
|
||||
export interface WebAuthNOptions {
|
||||
challenge: string;
|
||||
rp: { name: string, id: string; };
|
||||
user: { name: string, id: string, displayName: string; };
|
||||
pubKeyCredParams: any;
|
||||
authenticatorSelection: { userVerification: string; };
|
||||
timeout: number;
|
||||
attestation: string;
|
||||
challenge: string;
|
||||
rp: { name: string, id: string; };
|
||||
user: { name: string, id: string, displayName: string; };
|
||||
pubKeyCredParams: any;
|
||||
authenticatorSelection: { userVerification: string; };
|
||||
timeout: number;
|
||||
attestation: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-auth-user-mfa',
|
||||
templateUrl: './auth-user-mfa.component.html',
|
||||
styleUrls: ['./auth-user-mfa.component.scss'],
|
||||
selector: 'cnsl-auth-user-mfa',
|
||||
templateUrl: './auth-user-mfa.component.html',
|
||||
styleUrls: ['./auth-user-mfa.component.scss'],
|
||||
})
|
||||
export class AuthUserMfaComponent implements OnInit, OnDestroy {
|
||||
public displayedColumns: string[] = ['type', 'name', 'state', 'actions'];
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
public displayedColumns: string[] = ['type', 'name', 'state', 'actions'];
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
@ViewChild(MatTable) public table!: MatTable<AuthFactor.AsObject>;
|
||||
@ViewChild(MatSort) public sort!: MatSort;
|
||||
public dataSource!: MatTableDataSource<AuthFactor.AsObject>;
|
||||
@ViewChild(MatTable) public table!: MatTable<AuthFactor.AsObject>;
|
||||
@ViewChild(MatSort) public sort!: MatSort;
|
||||
public dataSource!: MatTableDataSource<AuthFactor.AsObject>;
|
||||
|
||||
public AuthFactorState: any = AuthFactorState;
|
||||
public AuthFactorState: any = AuthFactorState;
|
||||
|
||||
public error: string = '';
|
||||
public otpAvailable: boolean = false;
|
||||
public error: string = '';
|
||||
public otpAvailable: boolean = false;
|
||||
|
||||
constructor(
|
||||
private service: GrpcAuthService,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
) { }
|
||||
constructor(
|
||||
private service: GrpcAuthService,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.getMFAs();
|
||||
}
|
||||
public ngOnInit(): void {
|
||||
this.getMFAs();
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
public ngOnDestroy(): void {
|
||||
this.loadingSubject.complete();
|
||||
}
|
||||
|
||||
public addAuthFactor(): void {
|
||||
const dialogRef = this.dialog.open(AuthFactorDialogComponent, {
|
||||
data: {
|
||||
otpDisabled: !this.otpAvailable,
|
||||
},
|
||||
public addAuthFactor(): void {
|
||||
const dialogRef = this.dialog.open(AuthFactorDialogComponent, {
|
||||
data: {
|
||||
otpDisabled: !this.otpAvailable,
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe((code) => {
|
||||
if (code) {
|
||||
this.service.verifyMyMultiFactorOTP(code).then(() => {
|
||||
this.getMFAs();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialogRef.afterClosed().subscribe((code) => {
|
||||
if (code) {
|
||||
this.service.verifyMyMultiFactorOTP(code).then(() => {
|
||||
this.getMFAs();
|
||||
});
|
||||
public getMFAs(): void {
|
||||
this.service.listMyMultiFactors().then(mfas => {
|
||||
const list = mfas.resultList;
|
||||
this.dataSource = new MatTableDataSource(list);
|
||||
this.dataSource.sort = this.sort;
|
||||
|
||||
const index = list.findIndex(mfa => mfa.otp);
|
||||
if (index === -1) {
|
||||
this.otpAvailable = true;
|
||||
}
|
||||
}).catch(error => {
|
||||
this.error = error.message;
|
||||
});
|
||||
}
|
||||
|
||||
public deleteMFA(factor: AuthFactor.AsObject): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'USER.MFA.DIALOG.MFA_DELETE_TITLE',
|
||||
descriptionKey: 'USER.MFA.DIALOG.MFA_DELETE_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
if (factor.otp) {
|
||||
this.service.removeMyMultiFactorOTP().then(() => {
|
||||
this.toast.showInfo('USER.TOAST.OTPREMOVED', true);
|
||||
|
||||
const index = this.dataSource.data.findIndex(mfa => !!mfa.otp);
|
||||
if (index > -1) {
|
||||
this.dataSource.data.splice(index, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.getMFAs();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else
|
||||
if (factor.u2f) {
|
||||
this.service.removeMyMultiFactorU2F(factor.u2f.id).then(() => {
|
||||
this.toast.showInfo('USER.TOAST.U2FREMOVED', true);
|
||||
|
||||
public getMFAs(): void {
|
||||
this.service.listMyMultiFactors().then(mfas => {
|
||||
const list = mfas.resultList;
|
||||
this.dataSource = new MatTableDataSource(list);
|
||||
this.dataSource.sort = this.sort;
|
||||
|
||||
const index = list.findIndex(mfa => mfa.otp);
|
||||
if (index === -1) {
|
||||
this.otpAvailable = true;
|
||||
}
|
||||
}).catch(error => {
|
||||
this.error = error.message;
|
||||
});
|
||||
}
|
||||
|
||||
public deleteMFA(factor: AuthFactor.AsObject): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'USER.MFA.DIALOG.MFA_DELETE_TITLE',
|
||||
descriptionKey: 'USER.MFA.DIALOG.MFA_DELETE_DESCRIPTION',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
if (factor.otp) {
|
||||
this.service.removeMyMultiFactorOTP().then(() => {
|
||||
this.toast.showInfo('USER.TOAST.OTPREMOVED', true);
|
||||
|
||||
const index = this.dataSource.data.findIndex(mfa => !!mfa.otp);
|
||||
if (index > -1) {
|
||||
this.dataSource.data.splice(index, 1);
|
||||
}
|
||||
this.getMFAs();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else
|
||||
if (factor.u2f) {
|
||||
this.service.removeMyMultiFactorU2F(factor.u2f.id).then(() => {
|
||||
this.toast.showInfo('USER.TOAST.U2FREMOVED', true);
|
||||
|
||||
const index = this.dataSource.data.findIndex(mfa => !!mfa.u2f);
|
||||
if (index > -1) {
|
||||
this.dataSource.data.splice(index, 1);
|
||||
}
|
||||
this.getMFAs();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const index = this.dataSource.data.findIndex(mfa => !!mfa.u2f);
|
||||
if (index > -1) {
|
||||
this.dataSource.data.splice(index, 1);
|
||||
}
|
||||
this.getMFAs();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+9
-9
@@ -2,17 +2,17 @@ import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-code-dialog',
|
||||
templateUrl: './code-dialog.component.html',
|
||||
styleUrls: ['./code-dialog.component.scss'],
|
||||
selector: 'cnsl-code-dialog',
|
||||
templateUrl: './code-dialog.component.html',
|
||||
styleUrls: ['./code-dialog.component.scss'],
|
||||
})
|
||||
export class CodeDialogComponent {
|
||||
public code: string = '';
|
||||
constructor(public dialogRef: MatDialogRef<CodeDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
public code: string = '';
|
||||
constructor(public dialogRef: MatDialogRef<CodeDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
closeDialog(code: string = ''): void {
|
||||
this.dialogRef.close(code);
|
||||
}
|
||||
closeDialog(code: string = ''): void {
|
||||
this.dialogRef.close(code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+74
-74
@@ -8,93 +8,93 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { _arrayBufferToBase64 } from '../u2f_util';
|
||||
|
||||
export enum U2FComponentDestination {
|
||||
MFA = 'mfa',
|
||||
PASSWORDLESS = 'passwordless',
|
||||
MFA = 'mfa',
|
||||
PASSWORDLESS = 'passwordless',
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-dialog-u2f',
|
||||
templateUrl: './dialog-u2f.component.html',
|
||||
styleUrls: ['./dialog-u2f.component.scss'],
|
||||
selector: 'cnsl-dialog-u2f',
|
||||
templateUrl: './dialog-u2f.component.html',
|
||||
styleUrls: ['./dialog-u2f.component.scss'],
|
||||
})
|
||||
export class DialogU2FComponent {
|
||||
private type!: U2FComponentDestination;
|
||||
public name: string = '';
|
||||
public error: string = '';
|
||||
public loading: boolean = false;
|
||||
private type!: U2FComponentDestination;
|
||||
public name: string = '';
|
||||
public error: string = '';
|
||||
public loading: boolean = false;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<DialogU2FComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { credOptions: any; type: U2FComponentDestination; },
|
||||
private service: GrpcAuthService, private translate: TranslateService, private toast: ToastService) {
|
||||
this.type = data.type;
|
||||
}
|
||||
constructor(public dialogRef: MatDialogRef<DialogU2FComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: { credOptions: any; type: U2FComponentDestination; },
|
||||
private service: GrpcAuthService, private translate: TranslateService, private toast: ToastService) {
|
||||
this.type = data.type;
|
||||
}
|
||||
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
public closeDialog(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
public closeDialogWithCode(): void {
|
||||
this.error = '';
|
||||
this.loading = true;
|
||||
if (this.name && this.data.credOptions.publicKey) {
|
||||
// this.data.credOptions.publicKey.rp.id = 'localhost';
|
||||
navigator.credentials.create(this.data.credOptions).then((resp) => {
|
||||
if (resp &&
|
||||
(resp as any).response.attestationObject &&
|
||||
(resp as any).response.clientDataJSON &&
|
||||
(resp as any).rawId) {
|
||||
public closeDialogWithCode(): void {
|
||||
this.error = '';
|
||||
this.loading = true;
|
||||
if (this.name && this.data.credOptions.publicKey) {
|
||||
// this.data.credOptions.publicKey.rp.id = 'localhost';
|
||||
navigator.credentials.create(this.data.credOptions).then((resp) => {
|
||||
if (resp &&
|
||||
(resp as any).response.attestationObject &&
|
||||
(resp as any).response.clientDataJSON &&
|
||||
(resp as any).rawId) {
|
||||
|
||||
const attestationObject = (resp as any).response.attestationObject;
|
||||
const clientDataJSON = (resp as any).response.clientDataJSON;
|
||||
const rawId = (resp as any).rawId;
|
||||
const attestationObject = (resp as any).response.attestationObject;
|
||||
const clientDataJSON = (resp as any).response.clientDataJSON;
|
||||
const rawId = (resp as any).rawId;
|
||||
|
||||
const data = JSON.stringify({
|
||||
id: resp.id,
|
||||
rawId: _arrayBufferToBase64(rawId),
|
||||
type: resp.type,
|
||||
response: {
|
||||
attestationObject: _arrayBufferToBase64(attestationObject),
|
||||
clientDataJSON: _arrayBufferToBase64(clientDataJSON),
|
||||
},
|
||||
});
|
||||
const data = JSON.stringify({
|
||||
id: resp.id,
|
||||
rawId: _arrayBufferToBase64(rawId),
|
||||
type: resp.type,
|
||||
response: {
|
||||
attestationObject: _arrayBufferToBase64(attestationObject),
|
||||
clientDataJSON: _arrayBufferToBase64(clientDataJSON),
|
||||
},
|
||||
});
|
||||
|
||||
const base64 = btoa(data);
|
||||
if (this.type === U2FComponentDestination.MFA) {
|
||||
this.service.verifyMyMultiFactorU2F(base64, this.name).then(() => {
|
||||
this.translate.get('USER.MFA.U2F_SUCCESS').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (this.type === U2FComponentDestination.PASSWORDLESS) {
|
||||
this.service.verifyMyPasswordless(base64, this.name).then(() => {
|
||||
this.translate.get('USER.PASSWORDLESS.U2F_SUCCESS').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.translate.get('USER.MFA.U2F_ERROR').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
const base64 = btoa(data);
|
||||
if (this.type === U2FComponentDestination.MFA) {
|
||||
this.service.verifyMyMultiFactorU2F(base64, this.name).then(() => {
|
||||
this.translate.get('USER.MFA.U2F_SUCCESS').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.error = error;
|
||||
this.toast.showInfo(error.message);
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (this.type === U2FComponentDestination.PASSWORDLESS) {
|
||||
this.service.verifyMyPasswordless(base64, this.name).then(() => {
|
||||
this.translate.get('USER.PASSWORDLESS.U2F_SUCCESS').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
this.loading = false;
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.toast.showError(error);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.loading = false;
|
||||
this.translate.get('USER.MFA.U2F_ERROR').pipe(take(1)).subscribe(msg => {
|
||||
this.toast.showInfo(msg);
|
||||
});
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
this.loading = false;
|
||||
this.error = error;
|
||||
this.toast.showInfo(error.message);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+42
-42
@@ -4,55 +4,55 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { parsePhoneNumber } from 'libphonenumber-js';
|
||||
|
||||
export enum EditDialogType {
|
||||
PHONE = 1,
|
||||
EMAIL = 2,
|
||||
PHONE = 1,
|
||||
EMAIL = 2,
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-email-dialog',
|
||||
templateUrl: './edit-dialog.component.html',
|
||||
styleUrls: ['./edit-dialog.component.scss'],
|
||||
selector: 'cnsl-edit-email-dialog',
|
||||
templateUrl: './edit-dialog.component.html',
|
||||
styleUrls: ['./edit-dialog.component.scss'],
|
||||
})
|
||||
export class EditDialogComponent {
|
||||
public isPhone: boolean = false;
|
||||
public phoneCountry: string = 'CH';
|
||||
public valueControl: FormControl = new FormControl(['', [Validators.required]]);
|
||||
constructor(public dialogRef: MatDialogRef<EditDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
this.valueControl.setValue(data.value);
|
||||
if (data.type === EditDialogType.PHONE) {
|
||||
this.isPhone = true;
|
||||
public isPhone: boolean = false;
|
||||
public phoneCountry: string = 'CH';
|
||||
public valueControl: FormControl = new FormControl(['', [Validators.required]]);
|
||||
constructor(public dialogRef: MatDialogRef<EditDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
this.valueControl.setValue(data.value);
|
||||
if (data.type === EditDialogType.PHONE) {
|
||||
this.isPhone = true;
|
||||
}
|
||||
|
||||
this.valueControl.valueChanges.subscribe(value => {
|
||||
if (value && value.length > 1) {
|
||||
this.changeValue(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private changeValue(changedValue: string): void {
|
||||
if (this.isPhone && changedValue) {
|
||||
try {
|
||||
const phoneNumber = parsePhoneNumber(changedValue ?? '', 'CH');
|
||||
if (phoneNumber) {
|
||||
const formmatted = phoneNumber.formatInternational();
|
||||
this.phoneCountry = phoneNumber.country || '';
|
||||
if (formmatted !== this.valueControl.value) {
|
||||
this.valueControl.setValue(formmatted);
|
||||
}
|
||||
}
|
||||
|
||||
this.valueControl.valueChanges.subscribe(value => {
|
||||
if (value && value.length > 1) {
|
||||
this.changeValue(value);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private changeValue(changedValue: string): void {
|
||||
if (this.isPhone && changedValue) {
|
||||
try {
|
||||
const phoneNumber = parsePhoneNumber(changedValue ?? '', 'CH');
|
||||
if (phoneNumber) {
|
||||
const formmatted = phoneNumber.formatInternational();
|
||||
this.phoneCountry = phoneNumber.country || '';
|
||||
if (formmatted !== this.valueControl.value) {
|
||||
this.valueControl.setValue(formmatted);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
closeDialog(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
closeDialog(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
closeDialogWithValue(): void {
|
||||
this.dialogRef.close(this.valueControl.value);
|
||||
}
|
||||
closeDialogWithValue(): void {
|
||||
this.dialogRef.close(this.valueControl.value);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -2,20 +2,20 @@ import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-resend-email-dialog',
|
||||
templateUrl: './resend-email-dialog.component.html',
|
||||
styleUrls: ['./resend-email-dialog.component.scss'],
|
||||
selector: 'cnsl-resend-email-dialog',
|
||||
templateUrl: './resend-email-dialog.component.html',
|
||||
styleUrls: ['./resend-email-dialog.component.scss'],
|
||||
})
|
||||
export class ResendEmailDialogComponent {
|
||||
public email: string = '';
|
||||
constructor(public dialogRef: MatDialogRef<ResendEmailDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
public email: string = '';
|
||||
constructor(public dialogRef: MatDialogRef<ResendEmailDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
closeDialog(email: string = ''): void {
|
||||
this.dialogRef.close(email);
|
||||
}
|
||||
closeDialog(email: string = ''): void {
|
||||
this.dialogRef.close(email);
|
||||
}
|
||||
|
||||
closeDialogWithSend(email: string = ''): void {
|
||||
this.dialogRef.close({ send: true, email });
|
||||
}
|
||||
closeDialogWithSend(email: string = ''): void {
|
||||
this.dialogRef.close({ send: true, email });
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<input type="checkbox" id="switch" (change)="change($event.target.checked)" [(checked)]="isDarkTheme">
|
||||
<input type="checkbox" id="switch" (change)="change($event)" [checked]="isDarkTheme"/>
|
||||
<div class="theme-app">
|
||||
<div class="theme-content">
|
||||
<label for="switch">
|
||||
|
||||
+20
-17
@@ -3,27 +3,30 @@ import { Subscription } from 'rxjs';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-theme-setting',
|
||||
templateUrl: './theme-setting.component.html',
|
||||
styleUrls: ['./theme-setting.component.scss'],
|
||||
selector: 'cnsl-theme-setting',
|
||||
templateUrl: './theme-setting.component.html',
|
||||
styleUrls: ['./theme-setting.component.scss'],
|
||||
})
|
||||
export class ThemeSettingComponent implements OnInit, OnDestroy {
|
||||
public isDarkTheme: boolean = true;
|
||||
private sub: Subscription = new Subscription();
|
||||
constructor(private themeService: ThemeService) {
|
||||
const theme = localStorage.getItem('theme');
|
||||
this.isDarkTheme = theme === 'dark-theme' ? true : theme === 'light-theme' ? false : true;
|
||||
}
|
||||
public isDarkTheme: boolean = true;
|
||||
private sub: Subscription = new Subscription();
|
||||
constructor(private themeService: ThemeService) {
|
||||
const theme = localStorage.getItem('theme');
|
||||
this.isDarkTheme = theme === 'dark-theme' ? true : theme === 'light-theme' ? false : true;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.sub = this.themeService.isDarkTheme.subscribe(d => this.isDarkTheme = d);
|
||||
}
|
||||
ngOnInit(): void {
|
||||
this.sub = this.themeService.isDarkTheme.subscribe(d => this.isDarkTheme = d);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
public change(checked: boolean): void {
|
||||
this.themeService.setDarkTheme(checked);
|
||||
public change(event: any): void {
|
||||
if (event.target) {
|
||||
const checked = event.target.checked;
|
||||
this.themeService.setDarkTheme(checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<span class="name">{{human?.email?.email}}</span>
|
||||
<span *ngIf="human?.email?.isEmailVerified" class="contact-state verified">{{'USER.EMAILVERIFIED' |
|
||||
translate}}</span>
|
||||
<div *ngIf="!human?.email.isEmailVerified" class="block">
|
||||
<div *ngIf="!human?.email?.isEmailVerified" class="block">
|
||||
<span class="contact-state notverified">{{'USER.NOTVERIFIED' | translate}}</span>
|
||||
|
||||
<ng-container *ngIf="human?.email">
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<div class="right">
|
||||
<button matTooltip="{{'ACTIONS.EDIT' | translate}}"
|
||||
[disabled]="!canWrite || state == UserState.USER_STATE_INITIAL"
|
||||
[disabled]="!canWrite || state === UserState.USER_STATE_INITIAL"
|
||||
(click)="openEditDialog(EditDialogType.EMAIL)" mat-icon-button>
|
||||
<i class="las la-edit"></i>
|
||||
</button>
|
||||
@@ -46,9 +46,9 @@
|
||||
<div class="left">
|
||||
<span class="label">{{ 'USER.PHONE' | translate }}</span>
|
||||
<span class="name">{{human?.phone?.phone ? human.phone?.phone : ('USER.PHONEEMPTY' | translate)}}</span>
|
||||
<span *ngIf="human?.phone.isPhoneVerified" class="contact-state verified">{{'USER.PHONEVERIFIED' |
|
||||
<span *ngIf="human?.phone?.isPhoneVerified" class="contact-state verified">{{'USER.PHONEVERIFIED' |
|
||||
translate}}</span>
|
||||
<div *ngIf="human.phone?.phone && !human?.phone.isPhoneVerified" class="block">
|
||||
<div *ngIf="human.phone?.phone && !human?.phone?.isPhoneVerified" class="block">
|
||||
<span class="contact-state notverified">{{'USER.NOTVERIFIED' | translate}}</span>
|
||||
|
||||
<ng-container *ngIf="human?.phone?.phone">
|
||||
|
||||
@@ -7,69 +7,69 @@ import { CodeDialogComponent } from '../auth-user-detail/code-dialog/code-dialog
|
||||
import { EditDialogType } from '../auth-user-detail/edit-dialog/edit-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-contact',
|
||||
templateUrl: './contact.component.html',
|
||||
styleUrls: ['./contact.component.scss'],
|
||||
selector: 'cnsl-contact',
|
||||
templateUrl: './contact.component.html',
|
||||
styleUrls: ['./contact.component.scss'],
|
||||
})
|
||||
export class ContactComponent {
|
||||
@Input() disablePhoneCode: boolean = false;
|
||||
@Input() canWrite: boolean = false;
|
||||
@Input() human!: Human.AsObject;
|
||||
@Input() state!: UserState;
|
||||
@Output() editType: EventEmitter<EditDialogType> = new EventEmitter();
|
||||
@Output() resendEmailVerification: EventEmitter<void> = new EventEmitter();
|
||||
@Output() resendPhoneVerification: EventEmitter<void> = new EventEmitter();
|
||||
@Output() enteredPhoneCode: EventEmitter<string> = new EventEmitter();
|
||||
@Output() deletedPhone: EventEmitter<void> = new EventEmitter();
|
||||
public UserState: any = UserState;
|
||||
@Input() disablePhoneCode: boolean = false;
|
||||
@Input() canWrite: boolean | null = false;
|
||||
@Input() human!: Human.AsObject;
|
||||
@Input() state!: UserState;
|
||||
@Output() editType: EventEmitter<EditDialogType> = new EventEmitter();
|
||||
@Output() resendEmailVerification: EventEmitter<void> = new EventEmitter();
|
||||
@Output() resendPhoneVerification: EventEmitter<void> = new EventEmitter();
|
||||
@Output() enteredPhoneCode: EventEmitter<string> = new EventEmitter();
|
||||
@Output() deletedPhone: EventEmitter<void> = new EventEmitter();
|
||||
public UserState: any = UserState;
|
||||
|
||||
public EditDialogType: any = EditDialogType;
|
||||
constructor(private dialog: MatDialog) { }
|
||||
public EditDialogType: any = EditDialogType;
|
||||
constructor(private dialog: MatDialog) { }
|
||||
|
||||
emitDeletePhone(): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'USER.LOGINMETHODS.PHONE.DELETETITLE',
|
||||
descriptionKey: 'USER.LOGINMETHODS.PHONE.DELETEDESC',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
emitDeletePhone(): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
confirmKey: 'ACTIONS.DELETE',
|
||||
cancelKey: 'ACTIONS.CANCEL',
|
||||
titleKey: 'USER.LOGINMETHODS.PHONE.DELETETITLE',
|
||||
descriptionKey: 'USER.LOGINMETHODS.PHONE.DELETEDESC',
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.deletedPhone.emit();
|
||||
}
|
||||
});
|
||||
}
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.deletedPhone.emit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
emitEmailVerification(): void {
|
||||
this.resendEmailVerification.emit();
|
||||
}
|
||||
emitEmailVerification(): void {
|
||||
this.resendEmailVerification.emit();
|
||||
}
|
||||
|
||||
emitPhoneVerification(): void {
|
||||
this.resendPhoneVerification.emit();
|
||||
}
|
||||
emitPhoneVerification(): void {
|
||||
this.resendPhoneVerification.emit();
|
||||
}
|
||||
|
||||
public enterCode(): void {
|
||||
if (this.human) {
|
||||
const dialogRef = this.dialog.open(CodeDialogComponent, {
|
||||
data: {
|
||||
number: this.human.phone,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
public enterCode(): void {
|
||||
if (this.human) {
|
||||
const dialogRef = this.dialog.open(CodeDialogComponent, {
|
||||
data: {
|
||||
number: this.human.phone,
|
||||
},
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(code => {
|
||||
if (code) {
|
||||
this.enteredPhoneCode.emit(code);
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(code => {
|
||||
if (code) {
|
||||
this.enteredPhoneCode.emit(code);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public openEditDialog(type: EditDialogType): void {
|
||||
this.editType.emit(type);
|
||||
}
|
||||
public openEditDialog(type: EditDialogType): void {
|
||||
this.editType.emit(type);
|
||||
}
|
||||
}
|
||||
|
||||
+37
-37
@@ -1,54 +1,54 @@
|
||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { Human, Machine } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
|
||||
@Component({
|
||||
selector: 'app-detail-form-machine',
|
||||
templateUrl: './detail-form-machine.component.html',
|
||||
styleUrls: ['./detail-form-machine.component.scss'],
|
||||
selector: 'cnsl-detail-form-machine',
|
||||
templateUrl: './detail-form-machine.component.html',
|
||||
styleUrls: ['./detail-form-machine.component.scss'],
|
||||
})
|
||||
export class DetailFormMachineComponent implements OnInit, OnDestroy {
|
||||
@Input() public username!: string;
|
||||
@Input() public user!: User;
|
||||
@Input() public disabled: boolean = false;
|
||||
@Output() public submitData: EventEmitter<any> = new EventEmitter<any>();
|
||||
@Input() public username!: string;
|
||||
@Input() public user!: Human.AsObject | Machine.AsObject;
|
||||
@Input() public disabled: boolean = false;
|
||||
@Output() public submitData: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
public machineForm!: FormGroup;
|
||||
public machineForm!: FormGroup;
|
||||
|
||||
private sub: Subscription = new Subscription();
|
||||
private sub: Subscription = new Subscription();
|
||||
|
||||
constructor(private fb: FormBuilder) {
|
||||
this.machineForm = this.fb.group({
|
||||
userName: [{ value: '', disabled: true }, [
|
||||
Validators.required,
|
||||
]],
|
||||
name: [{ value: '', disabled: this.disabled }, Validators.required],
|
||||
description: [{ value: '', disabled: this.disabled }],
|
||||
});
|
||||
}
|
||||
constructor(private fb: FormBuilder) {
|
||||
this.machineForm = this.fb.group({
|
||||
userName: [{ value: '', disabled: true }, [
|
||||
Validators.required,
|
||||
]],
|
||||
name: [{ value: '', disabled: this.disabled }, Validators.required],
|
||||
description: [{ value: '', disabled: this.disabled }],
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.machineForm.patchValue({ userName: this.username, ...this.user });
|
||||
}
|
||||
public ngOnInit(): void {
|
||||
this.machineForm.patchValue({ ...this.user, userName: this.username });
|
||||
}
|
||||
|
||||
public ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
public ngOnDestroy(): void {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
|
||||
public submitForm(): void {
|
||||
this.submitData.emit(this.machineForm.value);
|
||||
}
|
||||
public submitForm(): void {
|
||||
this.submitData.emit(this.machineForm.value);
|
||||
}
|
||||
|
||||
public get name(): AbstractControl | null {
|
||||
return this.machineForm.get('name');
|
||||
}
|
||||
public get name(): AbstractControl | null {
|
||||
return this.machineForm.get('name');
|
||||
}
|
||||
|
||||
public get description(): AbstractControl | null {
|
||||
return this.machineForm.get('description');
|
||||
}
|
||||
public get description(): AbstractControl | null {
|
||||
return this.machineForm.get('description');
|
||||
}
|
||||
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.machineForm.get('userName');
|
||||
}
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.machineForm.get('userName');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<div class="i-wrapper" *ngIf="showEditImage">
|
||||
<i class="las la-camera"></i>
|
||||
</div>
|
||||
<app-avatar
|
||||
*ngIf="user && user.profile?.displayName && user.profile?.firstName && user?.profile.lastName"
|
||||
class="avatar" [name]="user.profile?.displayName" [avatarUrl]="user?.profile?.avatarUrl || ''" [forColor]="preferredLoginName" [size]="80">
|
||||
</app-avatar>
|
||||
<cnsl-avatar
|
||||
*ngIf="user && user.profile?.displayName && user.profile?.firstName && user.profile?.lastName"
|
||||
class="avatar" [name]="user.profile?.displayName ?? ''" [avatarUrl]="user?.profile?.avatarUrl || ''" [forColor]="preferredLoginName" [size]="80">
|
||||
</cnsl-avatar>
|
||||
</button>
|
||||
|
||||
<cnsl-form-field class="formfield">
|
||||
|
||||
@@ -2,12 +2,12 @@ import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output } from '@a
|
||||
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Gender, Human, User } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { Gender, Human, Profile } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
|
||||
import { ProfilePictureComponent } from './profile-picture/profile-picture.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-detail-form',
|
||||
selector: 'cnsl-detail-form',
|
||||
templateUrl: './detail-form.component.html',
|
||||
styleUrls: ['./detail-form.component.scss'],
|
||||
})
|
||||
@@ -19,7 +19,7 @@ export class DetailFormComponent implements OnDestroy, OnChanges {
|
||||
@Input() public disabled: boolean = false;
|
||||
@Input() public genders: Gender[] = [];
|
||||
@Input() public languages: string[] = ['de', 'en'];
|
||||
@Output() public submitData: EventEmitter<User> = new EventEmitter<User>();
|
||||
@Output() public submitData: EventEmitter<Profile.AsObject> = new EventEmitter<Profile.AsObject>();
|
||||
@Output() public changedLanguage: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
||||
public profileForm!: FormGroup;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<app-card title="{{ 'USER.EXTERNALIDP.TITLE' | translate }}" description="{{ 'USER.EXTERNALIDP.DESC' | translate }}">
|
||||
<cnsl-card title="{{ 'USER.EXTERNALIDP.TITLE' | translate }}" description="{{ 'USER.EXTERNALIDP.DESC' | translate }}">
|
||||
<button card-actions mat-icon-button (click)="refreshPage()" class="icon-button" matTooltip="{{'ACTIONS.REFRESH' | translate}}">
|
||||
<mat-icon class="icon">refresh</mat-icon>
|
||||
</button>
|
||||
<app-refresh-table [hideRefresh]="true" [loading]="loading$ | async" [dataSize]="dataSource.data.length"
|
||||
<cnsl-refresh-table [hideRefresh]="true" [loading]="loading$ | async" [dataSize]="dataSource.data.length"
|
||||
[timestamp]="viewTimestamp" [selection]="selection">
|
||||
|
||||
<div class="table-wrapper">
|
||||
@@ -59,6 +59,5 @@
|
||||
<cnsl-paginator #paginator class="paginator" [timestamp]="viewTimestamp" [length]="totalResult || 0" [pageSize]="10"
|
||||
[pageSizeOptions]="[5, 10, 20]" (page)="changePage($event)"></cnsl-paginator>
|
||||
</div>
|
||||
|
||||
</app-refresh-table>
|
||||
</app-card>
|
||||
</cnsl-refresh-table>
|
||||
</cnsl-card>
|
||||
@@ -13,7 +13,7 @@ import { ManagementService } from '../../../../services/mgmt.service';
|
||||
import { ToastService } from '../../../../services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-external-idps',
|
||||
selector: 'cnsl-external-idps',
|
||||
templateUrl: './external-idps.component.html',
|
||||
styleUrls: ['./external-idps.component.scss'],
|
||||
})
|
||||
|
||||
+6
-6
@@ -1,12 +1,12 @@
|
||||
<app-detail-layout [backRouterLink]="[ '/users', user?.id]"
|
||||
title="{{user?.human?.displayName}} {{ 'USER.MEMBERSHIPS.TITLE' | translate }}"
|
||||
<cnsl-detail-layout [backRouterLink]="[ '/users', user?.id]"
|
||||
title="{{ 'USER.MEMBERSHIPS.TITLE' | translate }}"
|
||||
description="{{ 'USER.MEMBERSHIPS.DESCRIPTION' | translate }}">
|
||||
<cnsl-info-section class="context-wrapper">
|
||||
<span *ngIf="isMe">{{'USER.MEMBERSHIPS.USERCONTEXT' | translate}}</span>
|
||||
<span *ngIf="!isMe">{{'USER.MEMBERSHIPS.ORGCONTEXT' | translate}}</span>
|
||||
</cnsl-info-section>
|
||||
|
||||
<app-refresh-table class="refresh-table" (refreshed)="refreshPage()" [dataSize]="dataSource?.totalResult"
|
||||
<cnsl-refresh-table class="refresh-table" (refreshed)="refreshPage()" [dataSize]="dataSource?.totalResult ?? 0"
|
||||
[timestamp]="dataSource?.viewTimestamp" [selection]="selection" [loading]="dataSource?.loading$ | async">
|
||||
|
||||
<a actions color="primary" (click)="addMember()" color="primary" mat-raised-button>
|
||||
@@ -70,7 +70,7 @@
|
||||
<ng-container matColumnDef="actions" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let member">
|
||||
<button [disabled]="member.projectId && member.projectGrantId ? (['project.grant.member.delete:' + member.projectGrantId, 'project.grant.member.delete'] | hasRole | async) == false : member.projectId ? (['project.member.delete:' + member.projectGrantId, 'project.member.delete'] | hasRole | async) == false : member.orgId ? (['org.member.delete:' + member.orgId, 'org.member.delete'] | hasRole | async) == false : (['iam.member.delete'] | hasRole | async) == false"
|
||||
<button [disabled]="member.projectId && member.projectGrantId ? (['project.grant.member.delete:' + member.projectGrantId, 'project.grant.member.delete'] | hasRole | async) === false : member.projectId ? (['project.member.delete:' + member.projectGrantId, 'project.member.delete'] | hasRole | async) === false : member.orgId ? (['org.member.delete:' + member.orgId, 'org.member.delete'] | hasRole | async) === false : (['iam.member.delete'] | hasRole | async) === false"
|
||||
mat-icon-button color="warn" matTooltip="{{'ACTIONS.REMOVE' | translate}}"
|
||||
(click)="removeMembership(member)">
|
||||
<i class="las la-minus-circle"></i>
|
||||
@@ -86,5 +86,5 @@
|
||||
<cnsl-paginator class="paginator" #paginator [timestamp]="dataSource?.viewTimestamp" [pageSize]="50" [pageSizeOptions]="[25, 50, 100, 250]">
|
||||
</cnsl-paginator>
|
||||
</div>
|
||||
</app-refresh-table>
|
||||
</app-detail-layout>
|
||||
</cnsl-refresh-table>
|
||||
</cnsl-detail-layout>
|
||||
+1
-1
@@ -15,7 +15,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { MembershipDetailDataSource } from './membership-detail-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-membership-detail',
|
||||
selector: 'cnsl-membership-detail',
|
||||
templateUrl: './membership-detail.component.html',
|
||||
styleUrls: ['./membership-detail.component.scss'],
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="people" *ngIf="memberships">
|
||||
<div class="img-list" [@cardAnimation]="totalResult">
|
||||
<mat-spinner class="spinner" diameter="20" *ngIf="loading"></mat-spinner>
|
||||
<ng-container *ngIf="totalResult < 8; else compact">
|
||||
<ng-container *ngIf="totalResult < 8 && memberships && memberships.length; else compact">
|
||||
<ng-container *ngFor="let membership of memberships; index as i">
|
||||
<div @animate class="avatar-circle" (click)="navigateToObject()"
|
||||
matTooltip="{{ membership.displayName }} | {{membership.rolesList?.join(' ')}}"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user