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:
Max Peintner
2022-04-28 10:35:02 +00:00
committed by GitHub
co-authored by Livio Amstutz
parent 00f7dbe875
commit 08ae39ae19
668 changed files with 47746 additions and 19117 deletions
@@ -0,0 +1,21 @@
<span class="title" mat-dialog-title>{{'MEMBER.EDITROLE' | translate}}</span>
<div mat-dialog-content>
<p class="desc"> {{'MEMBER.EDITFOR' | translate: ({value: data.user})}}</p>
<div class="roles-selection">
<mat-checkbox class="role-cb" *ngFor="let role of allRoles" color="primary" (change)="toggleRole(role)"
[checked]="selectedRoles.includes(role)">
<div class="role-cb-content">
<div class="cnsl-chip-dot" [style.background]="getColor(role)"></div>
<span>{{role | roletransform}}</span>
</div>
</mat-checkbox>
</div>
</div>
<div mat-dialog-actions class="action">
<button color="primary" mat-stroked-button class="close-button" (click)="closeDialog()">
{{'ACTIONS.CLOSE' | translate}}
</button>
<button color="primary" mat-raised-button class="ok-button" (click)="closeDialogWithRoles()">
{{'ACTIONS.CHANGE' | translate}}
</button>
</div>
@@ -0,0 +1,29 @@
.title {
font-size: 1.2rem;
margin-top: 0;
}
.desc {
font-size: 0.9rem;
}
.roles-selection {
display: flex;
flex-direction: column;
.role-cb {
padding: 0.25rem 0;
.role-cb-content {
padding-left: 0.5rem;
display: flex;
flex-direction: row;
align-items: center;
}
}
}
.action {
display: flex;
justify-content: space-between;
}
@@ -0,0 +1,26 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { AddMemberRolesDialogComponent } from './add-member-roles-dialog.component';
describe('AddMemberRolesDialogComponent', () => {
let component: AddMemberRolesDialogComponent;
let fixture: ComponentFixture<AddMemberRolesDialogComponent>;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AddMemberRolesDialogComponent],
}).compileComponents();
}),
);
beforeEach(() => {
fixture = TestBed.createComponent(AddMemberRolesDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,39 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { getMembershipColor } from 'src/app/utils/color';
@Component({
selector: 'cnsl-add-member-roles-dialog',
templateUrl: './add-member-roles-dialog.component.html',
styleUrls: ['./add-member-roles-dialog.component.scss'],
})
export class AddMemberRolesDialogComponent {
public allRoles: string[] = [];
public selectedRoles: string[] = [];
constructor(public dialogRef: MatDialogRef<AddMemberRolesDialogComponent>, @Inject(MAT_DIALOG_DATA) public data: any) {
this.allRoles = Object.assign([], data.allRoles);
this.selectedRoles = Object.assign([], data.selectedRoles);
}
public closeDialogWithRoles(): void {
this.dialogRef.close(this.selectedRoles);
}
public closeDialog(): void {
this.dialogRef.close(false);
}
public toggleRole(role: string): void {
const index = this.selectedRoles.findIndex((r) => r === role);
if (index > -1) {
this.selectedRoles.splice(index, 1);
} else {
this.selectedRoles.push(role);
}
}
public getColor(role: string) {
return getMembershipColor(role)[500];
}
}
@@ -0,0 +1,24 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { TranslateModule } from '@ngx-translate/core';
import { LocalizedDatePipeModule } from 'src/app/pipes/localized-date-pipe/localized-date-pipe.module';
import { RoleTransformPipeModule } from 'src/app/pipes/role-transform/role-transform.module';
import { TimestampToDatePipeModule } from 'src/app/pipes/timestamp-to-date-pipe/timestamp-to-date-pipe.module';
import { AddMemberRolesDialogComponent } from './add-member-roles-dialog.component';
@NgModule({
declarations: [AddMemberRolesDialogComponent],
imports: [
CommonModule,
TranslateModule,
MatCheckboxModule,
MatButtonModule,
LocalizedDatePipeModule,
RoleTransformPipeModule,
TimestampToDatePipeModule,
],
})
export class AddMemberRolesDialogModule {}