mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-27 14:48:45 +00:00
fix(console): simplify instance page (#7274)
* move settings, rm nav for single org * move instance pages to settings * i18n * revalidate orgs on create * Update bg.json * show custome portal link * Update console/src/app/modules/settings-list/settings.ts Co-authored-by: Livio Spring <[email protected]> * Update console/src/app/modules/settings-list/settings.ts Co-authored-by: Livio Spring <[email protected]> * Update console/src/app/modules/settings-list/settings.ts Co-authored-by: Livio Spring <[email protected]> * add org page to instance settings * iam.read for org list * i18n * instance imgs, cleanup * rm unused imgs * remove unused imgs, replace default settings imgs * event image * e2e url * instance url --------- Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
7f7fb55f34
commit
ca49e0f532
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { EventsComponent } from './events.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: EventsComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class EventsRoutingModule {}
|
||||
@@ -1,131 +0,0 @@
|
||||
<div class="max-width-container">
|
||||
<h1 class="events-title">{{ 'IAM.EVENTS.TITLE' | translate }}</h1>
|
||||
<p class="events-desc cnsl-secondary-text">{{ 'IAM.EVENTS.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<cnsl-refresh-table
|
||||
[hideRefresh]="true"
|
||||
(refreshed)="refresh()"
|
||||
[dataSize]="dataSource.data.length"
|
||||
[loading]="_loading | async"
|
||||
>
|
||||
<div actions>
|
||||
<cnsl-filter-events (requestChanged)="filterChanged($event)"></cnsl-filter-events>
|
||||
</div>
|
||||
|
||||
<table
|
||||
[dataSource]="dataSource"
|
||||
mat-table
|
||||
class="table views-table"
|
||||
aria-label="Views"
|
||||
matSort
|
||||
(matSortChange)="sortChange($event)"
|
||||
>
|
||||
<ng-container matColumnDef="editor">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.EVENTS.EDITOR' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<ng-container *ngIf="event | toobject as event">
|
||||
<div class="editor-row" *ngIf="event.editor as editor">
|
||||
<!-- <cnsl-avatar
|
||||
*ngIf="editor && editor.displayName; else cog"
|
||||
class="avatar"
|
||||
[name]="editor.displayName"
|
||||
[avatarUrl]="editor.avatarUrl || ''"
|
||||
[forColor]="editor.preferredLoginName ?? editor.displayName"
|
||||
[size]="32"
|
||||
>
|
||||
</cnsl-avatar>
|
||||
<ng-template #cog>
|
||||
<cnsl-avatar [forColor]="editor?.preferredLoginName ?? 'franz'" [isMachine]="true">
|
||||
<i class="las la-robot"></i>
|
||||
</cnsl-avatar> </ng-template
|
||||
> -->
|
||||
<span class="name" *ngIf="editor.displayName">{{ editor.displayName }}</span>
|
||||
<span class="state" *ngIf="editor.service">{{ editor.service }}</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="aggregate">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.EVENTS.AGGREGATE' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<ng-container *ngIf="event | toobject as event">
|
||||
<div class="aggregate-row">
|
||||
<span class="id">{{ event.aggregate.id }}</span
|
||||
><span class="state" *ngIf="event.aggregate?.type?.localized?.localizedMessage">{{
|
||||
event.aggregate.type.localized.localizedMessage
|
||||
}}</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="resourceOwner">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.EVENTS.RESOURCEOWNER' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<ng-container *ngIf="event | toobject as event">
|
||||
<span *ngIf="event.aggregate.resourceOwner">{{ event.aggregate.resourceOwner }}</span>
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="sequence">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ 'IAM.EVENTS.SEQUENCE' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<ng-container *ngIf="event | toobject as event">
|
||||
{{ event.sequence }}
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="creationDate">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header [start]="'desc'" [disableClear]="true">
|
||||
{{ 'IAM.EVENTS.CREATIONDATE' | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<ng-container *ngIf="event | toobject as event">
|
||||
<span>{{ event?.creationDate | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm:ss' }}</span>
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="type">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.EVENTS.TYPE' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event" data-e2e="event-type-cell">
|
||||
<ng-container *ngIf="event | toobject as event">
|
||||
<span *ngIf="event.type?.localized?.localizedMessage">{{ event.type.localized.localizedMessage }}</span>
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="payload">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.EVENTS.PAYLOAD' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<ng-container *ngIf="event | topayload as payload">
|
||||
<span>{{ payload | json }}</span>
|
||||
<div class="btn-wrapper">
|
||||
<button class="open-in-dialog-btn" mat-icon-button (click)="openDialog(event)">
|
||||
<mat-icon svgIcon="mdi_arrow_expand"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</ng-container>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
<cnsl-paginator
|
||||
#paginator
|
||||
class="paginator"
|
||||
[hidePagination]="true"
|
||||
[showMoreButton]="true"
|
||||
[disableShowMore]="_done | async"
|
||||
(moreRequested)="more()"
|
||||
[length]="dataSource.data.length"
|
||||
>
|
||||
</cnsl-paginator>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
@@ -1,95 +0,0 @@
|
||||
@mixin events-theme($theme) {
|
||||
$background: map-get($theme, background);
|
||||
$foreground: map-get($theme, foreground);
|
||||
$is-dark-theme: map-get($theme, is-dark);
|
||||
$card-background-color: map-get($background, cards);
|
||||
$border-color: if($is-dark-theme, rgba(#8795a1, 0.2), rgba(#8795a1, 0.2));
|
||||
$primary: map-get($theme, primary);
|
||||
$primary-color: map-get($primary, 500);
|
||||
|
||||
.mat-column-payload {
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: hidden;
|
||||
|
||||
.btn-wrapper {
|
||||
background-color: $card-background-color;
|
||||
transition: background-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||
border: 1px solid $border-color;
|
||||
box-sizing: border-box;
|
||||
border-radius: 0.5rem;
|
||||
outline: none;
|
||||
box-shadow: 0 0 3px #0000001a;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
position: absolute;
|
||||
display: none;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
right: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
|
||||
.open-in-dialog-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.btn-wrapper {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-button-wrapper {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
user-select: none;
|
||||
margin-left: 1rem;
|
||||
|
||||
.filter-count {
|
||||
font-size: 14px;
|
||||
color: $primary-color;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.events-title {
|
||||
margin: 2rem 0 0 0;
|
||||
}
|
||||
|
||||
.events-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.editor-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 2px 0;
|
||||
|
||||
.name,
|
||||
.id {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.state {
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.aggregate-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
|
||||
.id {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { EventsComponent } from './events.component';
|
||||
|
||||
describe('EventsComponent', () => {
|
||||
let component: EventsComponent;
|
||||
let fixture: ComponentFixture<EventsComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [EventsComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EventsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,198 +0,0 @@
|
||||
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
||||
import { Component, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatSort, Sort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { BehaviorSubject, Observable, Subject, takeUntil } from 'rxjs';
|
||||
import { DisplayJsonDialogComponent } from 'src/app/modules/display-json-dialog/display-json-dialog.component';
|
||||
import { PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
||||
import { ListEventsRequest, ListEventsResponse } from 'src/app/proto/generated/zitadel/admin_pb';
|
||||
import { Event } from 'src/app/proto/generated/zitadel/event_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
enum EventFieldName {
|
||||
EDITOR = 'editor',
|
||||
AGGREGATE = 'aggregate',
|
||||
RESOURCEOWNER = 'resourceOwner',
|
||||
SEQUENCE = 'sequence',
|
||||
CREATIONDATE = 'creationDate',
|
||||
TYPE = 'type',
|
||||
PAYLOAD = 'payload',
|
||||
}
|
||||
|
||||
type LoadRequest = {
|
||||
req: ListEventsRequest;
|
||||
override: boolean;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-events',
|
||||
templateUrl: './events.component.html',
|
||||
styleUrls: ['./events.component.scss'],
|
||||
})
|
||||
export class EventsComponent implements OnDestroy {
|
||||
public INITPAGESIZE = 20;
|
||||
public sortAsc = false;
|
||||
private destroy$: Subject<void> = new Subject();
|
||||
|
||||
public displayedColumns: string[] = [
|
||||
EventFieldName.TYPE,
|
||||
EventFieldName.AGGREGATE,
|
||||
EventFieldName.RESOURCEOWNER,
|
||||
EventFieldName.EDITOR,
|
||||
EventFieldName.SEQUENCE,
|
||||
EventFieldName.CREATIONDATE,
|
||||
EventFieldName.PAYLOAD,
|
||||
];
|
||||
|
||||
public currentRequest$: BehaviorSubject<LoadRequest> = new BehaviorSubject<LoadRequest>({
|
||||
req: new ListEventsRequest().setLimit(this.INITPAGESIZE),
|
||||
override: true,
|
||||
});
|
||||
|
||||
@ViewChild(MatSort) public sort!: MatSort;
|
||||
@ViewChild(PaginatorComponent) public paginator!: PaginatorComponent;
|
||||
public dataSource: MatTableDataSource<Event> = new MatTableDataSource<Event>([]);
|
||||
|
||||
public _done: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public done: Observable<boolean> = this._done.asObservable();
|
||||
|
||||
public _loading: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
private _data: BehaviorSubject<Event[]> = new BehaviorSubject<Event[]>([]);
|
||||
|
||||
constructor(
|
||||
private adminService: AdminService,
|
||||
private breadcrumbService: BreadcrumbService,
|
||||
private _liveAnnouncer: LiveAnnouncer,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
) {
|
||||
const breadcrumbs = [
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.INSTANCE,
|
||||
name: 'Instance',
|
||||
routerLink: ['/instance'],
|
||||
}),
|
||||
];
|
||||
this.breadcrumbService.setBreadcrumb(breadcrumbs);
|
||||
|
||||
this.currentRequest$
|
||||
.pipe(
|
||||
// this would compare the requests if a duplicate and redundant request would be made
|
||||
// distinctUntilChanged(({ req: prev }, { req: next }) => {
|
||||
// return JSON.stringify(prev.toObject()) === JSON.stringify(next.toObject());
|
||||
// }),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe(({ req, override }) => {
|
||||
this._loading.next(true);
|
||||
this.adminService
|
||||
.listEvents(req)
|
||||
.then((res: ListEventsResponse) => {
|
||||
if (override) {
|
||||
this._data = new BehaviorSubject<Event[]>([]);
|
||||
this.dataSource = new MatTableDataSource<Event>([]);
|
||||
}
|
||||
|
||||
const eventList = res.getEventsList();
|
||||
this._data.next(eventList);
|
||||
|
||||
const concat = this.dataSource.data.concat(eventList);
|
||||
this.dataSource = new MatTableDataSource<Event>(concat);
|
||||
|
||||
this._loading.next(false);
|
||||
|
||||
if (eventList.length === 0) {
|
||||
this._done.next(true);
|
||||
} else {
|
||||
this._done.next(false);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
this._loading.next(false);
|
||||
this._data.next([]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
|
||||
public loadEvents(filteredRequest: ListEventsRequest, override: boolean = false): void {
|
||||
this.currentRequest$.next({ req: filteredRequest, override });
|
||||
}
|
||||
|
||||
public refresh(): void {
|
||||
const req = new ListEventsRequest();
|
||||
req.setLimit(this.paginator.pageSize);
|
||||
}
|
||||
|
||||
public sortChange(sortState: Sort) {
|
||||
if (sortState.direction && sortState.active) {
|
||||
this._liveAnnouncer.announce(`Sorted ${sortState.direction}ending`);
|
||||
this.sortAsc = sortState.direction === 'asc';
|
||||
|
||||
const { req } = this.currentRequest$.value;
|
||||
|
||||
req.setLimit(this.INITPAGESIZE);
|
||||
req.setAsc(this.sortAsc ? true : false);
|
||||
|
||||
this.loadEvents(req, true);
|
||||
} else {
|
||||
this._liveAnnouncer.announce('Sorting cleared');
|
||||
}
|
||||
}
|
||||
|
||||
public openDialog(event: Event): void {
|
||||
this.dialog.open(DisplayJsonDialogComponent, {
|
||||
data: {
|
||||
event: event,
|
||||
},
|
||||
width: '450px',
|
||||
});
|
||||
}
|
||||
|
||||
public more(): void {
|
||||
const sequence = this.getCursor();
|
||||
const { req } = this.currentRequest$.value;
|
||||
req.setSequence(sequence);
|
||||
this.loadEvents(req);
|
||||
}
|
||||
|
||||
public filterChanged(filterRequest: ListEventsRequest) {
|
||||
const req = new ListEventsRequest();
|
||||
req.setLimit(this.INITPAGESIZE);
|
||||
req.setAsc(this.sortAsc ? true : false);
|
||||
|
||||
req.setAggregateTypesList(filterRequest.getAggregateTypesList());
|
||||
req.setAggregateId(filterRequest.getAggregateId());
|
||||
req.setEventTypesList(filterRequest.getEventTypesList());
|
||||
req.setEditorUserId(filterRequest.getEditorUserId());
|
||||
req.setResourceOwner(filterRequest.getResourceOwner());
|
||||
req.setSequence(filterRequest.getSequence());
|
||||
req.setRange(filterRequest.getRange());
|
||||
req.setFrom(filterRequest.getFrom());
|
||||
const isAsc: boolean = filterRequest.getAsc();
|
||||
req.setAsc(isAsc);
|
||||
if (this.sortAsc !== isAsc) {
|
||||
this.sort.sort({ id: 'creationDate', start: isAsc ? 'asc' : 'desc', disableClear: true });
|
||||
}
|
||||
this.loadEvents(req, true);
|
||||
}
|
||||
|
||||
private getCursor(): number {
|
||||
const current = this._data.value;
|
||||
|
||||
if (current.length) {
|
||||
const sequence = current[current.length - 1].toObject().sequence;
|
||||
return sequence;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CopyToClipboardModule } from 'src/app/directives/copy-to-clipboard/copy-to-clipboard.module';
|
||||
import { CardModule } from 'src/app/modules/card/card.module';
|
||||
import { InfoSectionModule } from 'src/app/modules/info-section/info-section.module';
|
||||
import { InputModule } from 'src/app/modules/input/input.module';
|
||||
import { PaginatorModule } from 'src/app/modules/paginator/paginator.module';
|
||||
import { RefreshTableModule } from 'src/app/modules/refresh-table/refresh-table.module';
|
||||
import { TableActionsModule } from 'src/app/modules/table-actions/table-actions.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
import { LocalizedDatePipeModule } from 'src/app/pipes/localized-date-pipe/localized-date-pipe.module';
|
||||
import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/timestamp-to-date-pipe.module';
|
||||
|
||||
import { OverlayModule } from '@angular/cdk/overlay';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { ActionKeysModule } from 'src/app/modules/action-keys/action-keys.module';
|
||||
import { AvatarModule } from 'src/app/modules/avatar/avatar.module';
|
||||
import { DisplayJsonDialogModule } from 'src/app/modules/display-json-dialog/display-json-dialog.module';
|
||||
import { FilterEventsModule } from 'src/app/modules/filter-events/filter-events.module';
|
||||
import { ToObjectPipeModule } from 'src/app/pipes/to-object/to-object.module';
|
||||
import { ToPayloadPipeModule } from 'src/app/pipes/to-payload/to-payload.module';
|
||||
import { EventsRoutingModule } from './events-routing.module';
|
||||
import { EventsComponent } from './events.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [EventsComponent],
|
||||
imports: [
|
||||
EventsRoutingModule,
|
||||
CommonModule,
|
||||
TableActionsModule,
|
||||
MatIconModule,
|
||||
CardModule,
|
||||
FilterEventsModule,
|
||||
ToObjectPipeModule,
|
||||
ToPayloadPipeModule,
|
||||
HasRolePipeModule,
|
||||
MatDialogModule,
|
||||
MatButtonModule,
|
||||
CopyToClipboardModule,
|
||||
InputModule,
|
||||
TranslateModule,
|
||||
InfoSectionModule,
|
||||
AvatarModule,
|
||||
MatTooltipModule,
|
||||
MatProgressSpinnerModule,
|
||||
RefreshTableModule,
|
||||
ActionKeysModule,
|
||||
PaginatorModule,
|
||||
TimestampToDatePipeModule,
|
||||
LocalizedDatePipeModule,
|
||||
DisplayJsonDialogModule,
|
||||
MatTableModule,
|
||||
MatSortModule,
|
||||
OverlayModule,
|
||||
],
|
||||
exports: [],
|
||||
})
|
||||
export default class IamViewsModule {}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { FailedEventsComponent } from './failed-events.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: FailedEventsComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class FailedEventsRoutingModule {}
|
||||
@@ -1,70 +0,0 @@
|
||||
<div class="max-width-container">
|
||||
<h1 class="failed-events-title">{{ 'IAM.FAILEDEVENTS.TITLE' | translate }}</h1>
|
||||
<p class="failed-events-desc cnsl-secondary-text">{{ 'IAM.FAILEDEVENTS.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<div class="table-wrapper">
|
||||
<cnsl-refresh-table (refreshed)="loadEvents()" [dataSize]="eventDataSource.data.length" [loading]="loading$ | async">
|
||||
<table [dataSource]="eventDataSource" mat-table class="table" aria-label="Elements">
|
||||
<ng-container matColumnDef="viewName">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.FAILEDEVENTS.VIEWNAME' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">{{ event.viewName }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="database">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.FAILEDEVENTS.DATABASE' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">{{ event.database }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="failedSequence">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.FAILEDEVENTS.FAILEDSEQUENCE' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<span>{{ event?.failedSequence }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="failureCount">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.FAILEDEVENTS.FAILURECOUNT' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<span>{{ event?.failureCount }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="lastFailed">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.FAILEDEVENTS.LASTFAILED' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<span>{{ event?.lastFailed | timestampToDate | localizedDate: 'EEE dd. MMM, HH:mm' }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="errorMessage">
|
||||
<th mat-header-cell *matHeaderCellDef>{{ 'IAM.FAILEDEVENTS.ERRORMESSAGE' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let event">
|
||||
<span class="failed-event-error-message">{{ event?.errorMessage }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions" stickyEnd>
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td class="back" mat-cell *matCellDef="let event">
|
||||
<cnsl-table-actions>
|
||||
<button
|
||||
actions
|
||||
color="warn"
|
||||
mat-icon-button
|
||||
matTooltip="{{ 'IAM.FAILEDEVENTS.DELETE' | translate }}"
|
||||
(click)="cancelEvent(event.viewName, event.database, event.failedSequence)"
|
||||
>
|
||||
<i class="las la-minus-circle"></i>
|
||||
</button>
|
||||
</cnsl-table-actions>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="eventDisplayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: eventDisplayedColumns"></tr>
|
||||
</table>
|
||||
<cnsl-paginator #paginator class="paginator" [hidePagination]="true" [length]="eventDataSource.data.length || 0">
|
||||
</cnsl-paginator>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,12 +0,0 @@
|
||||
.failed-events-title {
|
||||
margin: 2rem 0 0 0;
|
||||
}
|
||||
|
||||
.failed-events-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.failed-event-error-message {
|
||||
padding: 0.5rem 0;
|
||||
display: block;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { FailedEventsComponent } from './failed-events.component';
|
||||
|
||||
describe('FailedEventsComponent', () => {
|
||||
let component: FailedEventsComponent;
|
||||
let fixture: ComponentFixture<FailedEventsComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [FailedEventsComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FailedEventsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,74 +0,0 @@
|
||||
import { AfterViewInit, Component, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { FailedEvent } from 'src/app/proto/generated/zitadel/admin_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-iam-failed-events',
|
||||
templateUrl: './failed-events.component.html',
|
||||
styleUrls: ['./failed-events.component.scss'],
|
||||
})
|
||||
export class FailedEventsComponent implements AfterViewInit {
|
||||
@ViewChild(MatPaginator) public eventPaginator!: MatPaginator;
|
||||
public eventDataSource: MatTableDataSource<FailedEvent.AsObject> = new MatTableDataSource<FailedEvent.AsObject>([]);
|
||||
|
||||
public eventDisplayedColumns: string[] = [
|
||||
'viewName',
|
||||
'database',
|
||||
'failedSequence',
|
||||
'failureCount',
|
||||
'lastFailed',
|
||||
'errorMessage',
|
||||
'actions',
|
||||
];
|
||||
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
constructor(
|
||||
private adminService: AdminService,
|
||||
private breadcrumbService: BreadcrumbService,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.loadEvents();
|
||||
|
||||
const breadcrumbs = [
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.INSTANCE,
|
||||
name: 'Instance',
|
||||
routerLink: ['/instance'],
|
||||
}),
|
||||
];
|
||||
this.breadcrumbService.setBreadcrumb(breadcrumbs);
|
||||
}
|
||||
|
||||
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((events) => {
|
||||
this.eventDataSource = new MatTableDataSource<FailedEvent.AsObject>(events);
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CopyToClipboardModule } from 'src/app/directives/copy-to-clipboard/copy-to-clipboard.module';
|
||||
import { CardModule } from 'src/app/modules/card/card.module';
|
||||
import { InfoSectionModule } from 'src/app/modules/info-section/info-section.module';
|
||||
import { InputModule } from 'src/app/modules/input/input.module';
|
||||
import { PaginatorModule } from 'src/app/modules/paginator/paginator.module';
|
||||
import { RefreshTableModule } from 'src/app/modules/refresh-table/refresh-table.module';
|
||||
import { TableActionsModule } from 'src/app/modules/table-actions/table-actions.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
import { LocalizedDatePipeModule } from 'src/app/pipes/localized-date-pipe/localized-date-pipe.module';
|
||||
import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/timestamp-to-date-pipe.module';
|
||||
|
||||
import { FailedEventsRoutingModule } from './failed-events-routing.module';
|
||||
import { FailedEventsComponent } from './failed-events.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [FailedEventsComponent],
|
||||
imports: [
|
||||
FailedEventsRoutingModule,
|
||||
CommonModule,
|
||||
TableActionsModule,
|
||||
MatIconModule,
|
||||
CardModule,
|
||||
HasRolePipeModule,
|
||||
PaginatorModule,
|
||||
MatButtonModule,
|
||||
CopyToClipboardModule,
|
||||
InputModule,
|
||||
TranslateModule,
|
||||
InfoSectionModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTooltipModule,
|
||||
RefreshTableModule,
|
||||
LocalizedDatePipeModule,
|
||||
TimestampToDatePipeModule,
|
||||
MatTableModule,
|
||||
MatSortModule,
|
||||
],
|
||||
})
|
||||
export default class FailedEventsModule {}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { IamViewsComponent } from './iam-views.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: IamViewsComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class IamViewsRoutingModule {}
|
||||
@@ -1,42 +0,0 @@
|
||||
<div class="max-width-container">
|
||||
<h1 class="views-title">{{ 'IAM.VIEWS.TITLE' | translate }}</h1>
|
||||
<p class="views-desc cnsl-secondary-text">{{ 'IAM.VIEWS.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<cnsl-refresh-table (refreshed)="loadViews()" [dataSize]="dataSource.data.length" [loading]="loading$ | async">
|
||||
<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="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="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>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr class="highlight" mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
<cnsl-paginator #paginator class="paginator" [hidePagination]="true" [length]="dataSource.data.length || 0">
|
||||
</cnsl-paginator>
|
||||
</cnsl-refresh-table>
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
.views-title {
|
||||
margin: 2rem 0 0 0;
|
||||
}
|
||||
|
||||
.views-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { IamViewsComponent } from './iam-views.component';
|
||||
|
||||
describe('IamViewsComponent', () => {
|
||||
let component: IamViewsComponent;
|
||||
let fixture: ComponentFixture<IamViewsComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [IamViewsComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(IamViewsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,62 +0,0 @@
|
||||
import { AfterViewInit, Component, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { View } from 'src/app/proto/generated/zitadel/admin_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-iam-views',
|
||||
templateUrl: './iam-views.component.html',
|
||||
styleUrls: ['./iam-views.component.scss'],
|
||||
})
|
||||
export class IamViewsComponent implements AfterViewInit {
|
||||
@ViewChild(MatSort) sort!: MatSort;
|
||||
|
||||
@ViewChild(MatPaginator) public paginator!: MatPaginator;
|
||||
public dataSource: MatTableDataSource<View.AsObject> = new MatTableDataSource<View.AsObject>([]);
|
||||
|
||||
public displayedColumns: string[] = ['viewName', 'database', 'sequence', 'eventTimestamp', 'lastSuccessfulSpoolerRun'];
|
||||
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
constructor(
|
||||
private adminService: AdminService,
|
||||
private breadcrumbService: BreadcrumbService,
|
||||
) {
|
||||
this.loadViews();
|
||||
|
||||
const breadcrumbs = [
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.INSTANCE,
|
||||
name: 'Instance',
|
||||
routerLink: ['/instance'],
|
||||
}),
|
||||
];
|
||||
this.breadcrumbService.setBreadcrumb(breadcrumbs);
|
||||
}
|
||||
|
||||
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<View.AsObject>(views);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CopyToClipboardModule } from 'src/app/directives/copy-to-clipboard/copy-to-clipboard.module';
|
||||
import { CardModule } from 'src/app/modules/card/card.module';
|
||||
import { InfoSectionModule } from 'src/app/modules/info-section/info-section.module';
|
||||
import { InputModule } from 'src/app/modules/input/input.module';
|
||||
import { PaginatorModule } from 'src/app/modules/paginator/paginator.module';
|
||||
import { RefreshTableModule } from 'src/app/modules/refresh-table/refresh-table.module';
|
||||
import { TableActionsModule } from 'src/app/modules/table-actions/table-actions.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
import { LocalizedDatePipeModule } from 'src/app/pipes/localized-date-pipe/localized-date-pipe.module';
|
||||
import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/timestamp-to-date-pipe.module';
|
||||
|
||||
import { IamViewsRoutingModule } from './iam-views-routing.module';
|
||||
import { IamViewsComponent } from './iam-views.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [IamViewsComponent],
|
||||
imports: [
|
||||
IamViewsRoutingModule,
|
||||
CommonModule,
|
||||
TableActionsModule,
|
||||
MatIconModule,
|
||||
CardModule,
|
||||
HasRolePipeModule,
|
||||
MatButtonModule,
|
||||
CopyToClipboardModule,
|
||||
InputModule,
|
||||
TranslateModule,
|
||||
InfoSectionModule,
|
||||
MatTooltipModule,
|
||||
MatProgressSpinnerModule,
|
||||
RefreshTableModule,
|
||||
PaginatorModule,
|
||||
TimestampToDatePipeModule,
|
||||
LocalizedDatePipeModule,
|
||||
MatTableModule,
|
||||
MatSortModule,
|
||||
],
|
||||
exports: [],
|
||||
})
|
||||
export default class IamViewsModule {}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { InstanceSettingsComponent } from './instance-settings.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: InstanceSettingsComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class InstanceSettingsRoutingModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
<div class="max-width-container">
|
||||
<div class="settings-top-view">
|
||||
<div>
|
||||
<div class="settings-title-row">
|
||||
<h1>{{ 'SETTINGS.INSTANCE.TITLE' | translate }}</h1>
|
||||
</div>
|
||||
<p class="desc cnsl-secondary-text">{{ 'SETTINGS.INSTANCE.DESCRIPTION' | translate }}</p>
|
||||
</div>
|
||||
<span class="fill-space"></span>
|
||||
</div>
|
||||
<ng-container *ngIf="settingsList | async as list">
|
||||
<cnsl-settings-list
|
||||
[selectedId]="id"
|
||||
[serviceType]="PolicyComponentServiceType.ADMIN"
|
||||
[settingsList]="list"
|
||||
></cnsl-settings-list>
|
||||
</ng-container>
|
||||
</div>
|
||||
@@ -1,34 +0,0 @@
|
||||
.settings-top-view {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding-top: 2rem;
|
||||
|
||||
.settings-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a i {
|
||||
font-size: 1.2rem;
|
||||
height: 1.2rem;
|
||||
line-height: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.fill-space {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin-bottom: 2rem;
|
||||
font-size: 14px;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { InstanceSettingsComponent } from './instance-settings.component';
|
||||
|
||||
describe('InstanceSettingsComponent', () => {
|
||||
let component: InstanceSettingsComponent;
|
||||
let fixture: ComponentFixture<InstanceSettingsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [InstanceSettingsComponent],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InstanceSettingsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,97 +0,0 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Observable, of, Subject, takeUntil } from 'rxjs';
|
||||
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
|
||||
import { SidenavSetting } from 'src/app/modules/sidenav/sidenav.component';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import {
|
||||
BRANDING,
|
||||
COMPLEXITY,
|
||||
DOMAIN,
|
||||
LANGUAGES,
|
||||
IDP,
|
||||
LOCKOUT,
|
||||
LOGIN,
|
||||
LOGINTEXTS,
|
||||
MESSAGETEXTS,
|
||||
NOTIFICATIONS,
|
||||
OIDC,
|
||||
PRIVACYPOLICY,
|
||||
SECRETS,
|
||||
SECURITY,
|
||||
SMS_PROVIDER,
|
||||
SMTP_PROVIDER,
|
||||
} from '../../modules/settings-list/settings';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-instance-settings',
|
||||
templateUrl: './instance-settings.component.html',
|
||||
styleUrls: ['./instance-settings.component.scss'],
|
||||
})
|
||||
export class InstanceSettingsComponent implements OnInit, OnDestroy {
|
||||
public id: string = '';
|
||||
public PolicyComponentServiceType: any = PolicyComponentServiceType;
|
||||
public defaultSettingsList: SidenavSetting[] = [
|
||||
// notifications
|
||||
// { showWarn: true, ...NOTIFICATIONS },
|
||||
NOTIFICATIONS,
|
||||
SMTP_PROVIDER,
|
||||
SMS_PROVIDER,
|
||||
// login
|
||||
LOGIN,
|
||||
IDP,
|
||||
COMPLEXITY,
|
||||
LOCKOUT,
|
||||
|
||||
DOMAIN,
|
||||
// appearance
|
||||
BRANDING,
|
||||
MESSAGETEXTS,
|
||||
LOGINTEXTS,
|
||||
// others
|
||||
PRIVACYPOLICY,
|
||||
LANGUAGES,
|
||||
OIDC,
|
||||
SECRETS,
|
||||
SECURITY,
|
||||
];
|
||||
|
||||
public settingsList: Observable<SidenavSetting[]> = of([]);
|
||||
|
||||
private destroy$: Subject<void> = new Subject();
|
||||
constructor(
|
||||
breadcrumbService: BreadcrumbService,
|
||||
activatedRoute: ActivatedRoute,
|
||||
public authService: GrpcAuthService,
|
||||
) {
|
||||
const breadcrumbs = [
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.INSTANCE,
|
||||
name: 'Instance',
|
||||
routerLink: ['/instance'],
|
||||
}),
|
||||
];
|
||||
breadcrumbService.setBreadcrumb(breadcrumbs);
|
||||
|
||||
activatedRoute.queryParams.pipe(takeUntil(this.destroy$)).subscribe((params: Params) => {
|
||||
const { id } = params;
|
||||
if (id) {
|
||||
this.id = id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.settingsList = this.authService.isAllowedMapper(
|
||||
this.defaultSettingsList,
|
||||
(setting) => setting.requiredRoles.admin || [],
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { SettingsListModule } from 'src/app/modules/settings-list/settings-list.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
|
||||
import { InstanceSettingsRoutingModule } from './instance-settings-routing.module';
|
||||
import { InstanceSettingsComponent } from './instance-settings.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [InstanceSettingsComponent],
|
||||
imports: [CommonModule, InstanceSettingsRoutingModule, SettingsListModule, HasRolePipeModule, TranslateModule],
|
||||
})
|
||||
export default class InstanceSettingsModule {}
|
||||
@@ -7,29 +7,45 @@
|
||||
[hasContributors]="true"
|
||||
stateTooltip="{{ 'INSTANCE.STATE.' + instance?.state | translate }}"
|
||||
>
|
||||
<cnsl-contributors
|
||||
topContributors
|
||||
[totalResult]="totalMemberResult"
|
||||
[loading]="loading$ | async"
|
||||
[membersSubject]="membersSubject"
|
||||
title="{{ 'PROJECT.MEMBER.TITLE' | translate }}"
|
||||
description="{{ 'PROJECT.MEMBER.TITLEDESC' | translate }}"
|
||||
(addClicked)="openAddMember()"
|
||||
(showDetailClicked)="showDetail()"
|
||||
(refreshClicked)="loadMembers()"
|
||||
[disabled]="(['iam.member.write'] | hasRole | async) === false"
|
||||
>
|
||||
</cnsl-contributors>
|
||||
|
||||
<div topContributors class="instance-action-wrapper">
|
||||
<a
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
*ngIf="customerPortalLink$ | async as customerPortalLink"
|
||||
class="portal-link external-link"
|
||||
[href]="customerPortalLink"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<div class="cnsl-action-button">
|
||||
<span class="portal-span">{{ 'MENU.CUSTOMERPORTAL' | translate }}</span>
|
||||
<i class="las la-external-link-alt"></i>
|
||||
</div>
|
||||
</a>
|
||||
<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]="(['iam.member.write'] | hasRole | async) === false"
|
||||
>
|
||||
</cnsl-contributors>
|
||||
</div>
|
||||
<cnsl-info-row topContent *ngIf="instance" [instance]="instance"></cnsl-info-row>
|
||||
</cnsl-top-view>
|
||||
|
||||
<div class="max-width-container">
|
||||
<h2 class="instance-table-title">{{ 'ORG.LIST.TITLE' | translate }}</h2>
|
||||
|
||||
<p class="instance-table-desc cnsl-secondary-text">{{ 'ORG.LIST.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<cnsl-org-table></cnsl-org-table>
|
||||
|
||||
<cnsl-settings-grid [type]="PolicyComponentServiceType.ADMIN"></cnsl-settings-grid>
|
||||
<div class="instance-settings-wrapper">
|
||||
<ng-container *ngIf="settingsList | async as list">
|
||||
<cnsl-settings-list
|
||||
[selectedId]="id"
|
||||
[serviceType]="PolicyComponentServiceType.ADMIN"
|
||||
[settingsList]="list"
|
||||
></cnsl-settings-list>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,23 @@
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.instance-action-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.portal-link {
|
||||
margin-right: 1rem;
|
||||
|
||||
.portal-span {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.instance-table-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.instance-settings-wrapper {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { BehaviorSubject, from, Observable, of, Subject } from 'rxjs';
|
||||
import { catchError, finalize, map, takeUntil } from 'rxjs/operators';
|
||||
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
||||
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
|
||||
import { InstanceDetail, State } from 'src/app/proto/generated/zitadel/instance_pb';
|
||||
@@ -11,7 +11,31 @@ import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import {
|
||||
BRANDING,
|
||||
COMPLEXITY,
|
||||
DOMAIN,
|
||||
LANGUAGES,
|
||||
IDP,
|
||||
LOCKOUT,
|
||||
LOGIN,
|
||||
LOGINTEXTS,
|
||||
MESSAGETEXTS,
|
||||
NOTIFICATIONS,
|
||||
OIDC,
|
||||
PRIVACYPOLICY,
|
||||
SECRETS,
|
||||
SECURITY,
|
||||
SMS_PROVIDER,
|
||||
SMTP_PROVIDER,
|
||||
VIEWS,
|
||||
FAILEDEVENTS,
|
||||
EVENTS,
|
||||
ORGANIZATIONS,
|
||||
} from '../../modules/settings-list/settings';
|
||||
import { SidenavSetting } from 'src/app/modules/sidenav/sidenav.component';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { EnvironmentService } from 'src/app/services/environment.service';
|
||||
@Component({
|
||||
selector: 'cnsl-instance',
|
||||
templateUrl: './instance.component.html',
|
||||
@@ -25,12 +49,51 @@ export class InstanceComponent {
|
||||
public totalMemberResult: number = 0;
|
||||
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
||||
public State: any = State;
|
||||
|
||||
public id: string = '';
|
||||
public defaultSettingsList: SidenavSetting[] = [
|
||||
ORGANIZATIONS,
|
||||
// notifications
|
||||
// { showWarn: true, ...NOTIFICATIONS },
|
||||
NOTIFICATIONS,
|
||||
SMTP_PROVIDER,
|
||||
SMS_PROVIDER,
|
||||
// login
|
||||
LOGIN,
|
||||
IDP,
|
||||
COMPLEXITY,
|
||||
LOCKOUT,
|
||||
|
||||
DOMAIN,
|
||||
// appearance
|
||||
BRANDING,
|
||||
MESSAGETEXTS,
|
||||
LOGINTEXTS,
|
||||
// storage
|
||||
VIEWS,
|
||||
EVENTS,
|
||||
FAILEDEVENTS,
|
||||
// others
|
||||
PRIVACYPOLICY,
|
||||
LANGUAGES,
|
||||
OIDC,
|
||||
SECRETS,
|
||||
SECURITY,
|
||||
];
|
||||
|
||||
public settingsList: Observable<SidenavSetting[]> = of([]);
|
||||
public customerPortalLink$ = this.envService.env.pipe(map((env) => env.customer_portal));
|
||||
|
||||
private destroy$: Subject<void> = new Subject();
|
||||
constructor(
|
||||
public adminService: AdminService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
private router: Router,
|
||||
private authService: GrpcAuthService,
|
||||
private envService: EnvironmentService,
|
||||
activatedRoute: ActivatedRoute,
|
||||
) {
|
||||
this.loadMembers();
|
||||
|
||||
@@ -52,6 +115,13 @@ export class InstanceComponent {
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
activatedRoute.queryParams.pipe(takeUntil(this.destroy$)).subscribe((params: Params) => {
|
||||
const { id } = params;
|
||||
if (id) {
|
||||
this.id = id;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public loadMembers(): void {
|
||||
@@ -113,4 +183,16 @@ export class InstanceComponent {
|
||||
public showDetail(): void {
|
||||
this.router.navigate(['/instance', 'members']);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.settingsList = this.authService.isAllowedMapper(
|
||||
this.defaultSettingsList,
|
||||
(setting) => setting.requiredRoles.admin || [],
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.destroy$.next();
|
||||
this.destroy$.complete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/
|
||||
|
||||
import { IamRoutingModule } from './instance-routing.module';
|
||||
import { InstanceComponent } from './instance.component';
|
||||
import { SettingsListModule } from 'src/app/modules/settings-list/settings-list.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [InstanceComponent],
|
||||
@@ -61,6 +62,7 @@ import { InstanceComponent } from './instance.component';
|
||||
TimestampToDatePipeModule,
|
||||
RefreshTableModule,
|
||||
HasRolePipeModule,
|
||||
SettingsListModule,
|
||||
MatSortModule,
|
||||
SettingsGridModule,
|
||||
],
|
||||
|
||||
@@ -21,6 +21,7 @@ import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { LanguagesService } from '../../services/languages.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-org-create',
|
||||
@@ -59,6 +60,7 @@ export class OrgCreateComponent {
|
||||
private _location: Location,
|
||||
private fb: UntypedFormBuilder,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
public langSvc: LanguagesService,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
) {
|
||||
@@ -101,6 +103,7 @@ export class OrgCreateComponent {
|
||||
this.adminService
|
||||
.SetUpOrg(createOrgRequest, humanRequest)
|
||||
.then(() => {
|
||||
this.authService.revalidateOrgs();
|
||||
this.router.navigate(['/orgs']);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -191,6 +194,7 @@ export class OrgCreateComponent {
|
||||
this.mgmtService
|
||||
.addOrg(this.name.value)
|
||||
.then(() => {
|
||||
this.authService.revalidateOrgs();
|
||||
this.router.navigate(['/orgs']);
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -9,5 +9,6 @@ import { OrgListComponent } from './org-list.component';
|
||||
@NgModule({
|
||||
declarations: [OrgListComponent],
|
||||
imports: [CommonModule, OrgListRoutingModule, OrgTableModule, TranslateModule],
|
||||
exports: [OrgListComponent],
|
||||
})
|
||||
export default class OrgListModule {}
|
||||
|
||||
Reference in New Issue
Block a user