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,9 @@
<div class="project-role-chip"
[style.background]="(themeService.isDarkTheme | async) ? (role.color.hex+'40') :(role.color.hex+'40')"
[style.color]="(themeService.isDarkTheme | async) ? role.color.lighter : role.color.darker"
[style.borderColor]="role.color.hex+'30'">
<ng-content></ng-content>
<button class="role-rm" mat-icon-button *ngIf="showRemove" (click)="emitRemove()">
<mat-icon class="role-rm-icon">clear</mat-icon>
</button>
</div>
@@ -0,0 +1,50 @@
@use '@angular/material' as mat;
@mixin project-role-chips-theme($theme) {
$primary: map-get($theme, primary);
$warn: map-get($theme, warn);
$background: map-get($theme, background);
$accent: map-get($theme, accent);
$primary-color: mat.get-color-from-palette($primary, 500);
$warn-color: mat.get-color-from-palette($warn, 500);
$accent-color: mat.get-color-from-palette($accent, 500);
$foreground: map-get($theme, foreground);
$is-dark-theme: map-get($theme, is-dark);
$back: map-get($background, background);
$list-background-color: mat.get-color-from-palette($background, 300);
$card-background-color: mat.get-color-from-palette($background, cards);
$border-color: if($is-dark-theme, rgba(#8795a1, 0.2), rgba(#8795a1, 0.2));
$border-selected-color: if($is-dark-theme, #fff, #000);
.project-role-chip {
display: flex;
align-items: center;
justify-content: center;
padding: 3px 1rem;
margin: 3px 0;
margin-right: 0.5rem;
border-radius: 50vw;
border: 1px solid $border-color;
box-sizing: border-box;
font-size: 13px;
font-weight: 600;
.role-rm {
height: 1rem;
width: 1rem;
line-height: 1rem;
margin-left: 4px;
margin-right: -0.5rem;
.role-rm-icon {
font-size: 1rem;
height: 1rem;
width: 1rem;
line-height: 1rem;
transform: translateY(-2px);
}
}
}
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectRoleChipComponent } from './project-role-chip.component';
describe('ProjectRoleChipComponent', () => {
let component: ProjectRoleChipComponent;
let fixture: ComponentFixture<ProjectRoleChipComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ProjectRoleChipComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectRoleChipComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,46 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ThemeService } from 'src/app/services/theme.service';
import { getColorHash } from 'src/app/utils/color';
declare const tinycolor: any;
export class CnslProjectRole {
private roleName: string = '';
constructor(roleName: string) {
this.roleName = roleName;
}
public get color(): { hex: string; isLight: boolean; lighter: string; darker: string } {
const color = getColorHash(this.roleName);
const hex = color[500];
const c = tinycolor(hex);
return {
hex: c.toHexString(),
isLight: c.isLight(),
lighter: color[300],
darker: color[600],
};
}
}
@Component({
selector: 'cnsl-project-role-chip',
templateUrl: './project-role-chip.component.html',
styleUrls: ['./project-role-chip.component.scss'],
})
export class ProjectRoleChipComponent implements OnInit {
@Input() roleName: string = '';
@Output() removed: EventEmitter<void> = new EventEmitter();
@Input() showRemove: boolean = false;
public role!: CnslProjectRole;
constructor(public themeService: ThemeService) {}
public ngOnInit(): void {
this.role = new CnslProjectRole(this.roleName);
}
public emitRemove(): void {
this.removed.emit();
}
}
@@ -0,0 +1,14 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { ProjectRoleChipComponent } from './project-role-chip.component';
@NgModule({
declarations: [ProjectRoleChipComponent],
imports: [CommonModule, MatIconModule, FormsModule, MatButtonModule],
exports: [ProjectRoleChipComponent],
})
export class ProjectRoleChipModule {}