mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-26 22:38:45 +00:00
feat: rehauled console (#3525)
* new console * move npm ci to angular build * rel path for assets * local grpc copy * login policy, rm clear views, features rel path * lock Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
co-authored by
Livio Amstutz
parent
00f7dbe875
commit
08ae39ae19
@@ -0,0 +1,17 @@
|
||||
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 {}
|
||||
@@ -0,0 +1,60 @@
|
||||
<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 *ngIf="eventDataSource" (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="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>
|
||||
@@ -0,0 +1,12 @@
|
||||
.failed-events-title {
|
||||
margin: 2rem 0 0 0;
|
||||
}
|
||||
|
||||
.failed-events-desc {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.failed-event-error-message {
|
||||
padding: 0.5rem 0;
|
||||
display: block;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
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>;
|
||||
|
||||
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 breadcrumbService: BreadcrumbService,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.loadEvents();
|
||||
|
||||
const breadcrumbs = [
|
||||
new Breadcrumb({
|
||||
type: BreadcrumbType.IAM,
|
||||
name: 'System',
|
||||
routerLink: ['/system'],
|
||||
}),
|
||||
];
|
||||
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((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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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 { SharedModule } from 'src/app/modules/shared/shared.module';
|
||||
import { TableActionsModule } from 'src/app/modules/table-actions/table-actions.module';
|
||||
import { HasFeaturePipeModule } from 'src/app/pipes/has-feature-pipe/has-feature-pipe.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe/has-role-pipe.module';
|
||||
import { 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,
|
||||
SharedModule,
|
||||
CommonModule,
|
||||
TableActionsModule,
|
||||
MatIconModule,
|
||||
CardModule,
|
||||
HasFeaturePipeModule,
|
||||
HasRolePipeModule,
|
||||
PaginatorModule,
|
||||
MatButtonModule,
|
||||
CopyToClipboardModule,
|
||||
InputModule,
|
||||
TranslateModule,
|
||||
InfoSectionModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTooltipModule,
|
||||
RefreshTableModule,
|
||||
LocalizedDatePipeModule,
|
||||
TimestampToDatePipeModule,
|
||||
MatTableModule,
|
||||
MatSortModule,
|
||||
],
|
||||
})
|
||||
export class FailedEventsModule {}
|
||||
Reference in New Issue
Block a user