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,47 @@
<h1 class="title" mat-dialog-title>{{'KEYBOARDSHORTCUTS.TITLE' | translate}}</h1>
<div mat-dialog-content>
<div *ngIf="isNotOnSystem" class="keyboard-shortcuts-group">
<h2>{{'KEYBOARDSHORTCUTS.UNDERORGCONTEXT' | translate}}</h2>
<div class="keyboard-shortcuts-wrapper">
<div class="keyboard-shortcut" *ngFor="let shortcut of orgShortcuts">
<span class="keyboard-shortcut-name cnsl-secondary-text" [innerHTML]="shortcut.i18nKey | translate"></span>
<span class="fill-space"></span>
<template *ngFor="let key of shortcut.keyboardKeys; index as i" [ngTemplateOutlet]="actionkey"
[ngTemplateOutletContext]="{key: key, last: i === shortcut.keyboardKeys.length-1}"></template>
</div>
</div>
</div>
<div class="keyboard-shortcuts-group">
<h2>{{'KEYBOARDSHORTCUTS.SIDEWIDE' | translate}}</h2>
<div class="keyboard-shortcuts-wrapper">
<ng-container *ngFor="let shortcut of shortcuts">
<ng-template cnslHasRole [hasRole]="shortcut.permissions">
<ng-template cnslHasFeature [hasFeature]="shortcut.features">
<div class="keyboard-shortcut">
<span class="keyboard-shortcut-name cnsl-secondary-text"
[innerHTML]="shortcut.i18nKey | translate"></span>
<span class="fill-space"></span>
<template *ngFor="let key of shortcut.keyboardKeys; index as i" [ngTemplateOutlet]="actionkey"
[ngTemplateOutletContext]="{key: key, last: i === shortcut.keyboardKeys.length-1}"></template>
</div>
</ng-template>
</ng-template>
</ng-container>
</div>
</div>
</div>
<div mat-dialog-actions class="action">
<button mat-stroked-button (click)="closeDialog()">
{{'ACTIONS.CLOSE' | translate}}
</button>
<span class="fill-space"></span>
</div>
<ng-template #actionkey let-key="key" let-last="last">
<div class="keyboard-shortcuts-action-key">
<div class="keyboard-shortcuts-key-overlay"></div>
<span class="keyboard-shortcuts-span">{{key}}</span>
</div>
<!-- <span *ngIf="!last" class="keyboard-shortcuts-plus cnsl-secondary-text">+</span> -->
</ng-template>
@@ -0,0 +1,107 @@
@use '@angular/material' as mat;
@mixin keyboard-shortcuts-theme($theme) {
$primary: map-get($theme, primary);
$background: map-get($theme, background);
$foreground: map-get($theme, foreground);
$text-color: map-get($foreground, text);
$accent: map-get($theme, accent);
$is-dark-theme: map-get($theme, is-dark);
$accent-color: mat.get-color-from-palette($primary, 500);
$back: map-get($background, background);
$card-background-color: mat.get-color-from-palette($background, cards);
.keyboard-shortcuts-group {
$border-color: if($is-dark-theme, rgba(#8795a1, 0.2), rgba(#8795a1, 0.2));
border: 1px solid $border-color;
background-color: $card-background-color;
padding: 1rem;
border-radius: 0.5rem;
margin: 0.5rem 0 0 0;
h2 {
font-size: 1rem;
margin: 0 0 1rem 0;
}
.keyboard-shortcuts-wrapper {
display: flex;
flex-direction: column;
.keyboard-shortcut {
display: flex;
align-items: center;
padding: 0.5rem 0;
.keyboard-shortcut-name {
font-size: 14px;
strong {
color: $text-color;
}
}
&:not(:last-child) {
border-bottom: 1px solid map-get($foreground, dividers);
}
.fill-space {
flex: 1;
}
}
}
}
.keyboard-shortcuts-action-key {
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
height: 20px;
width: 20px;
position: relative;
margin: 0 4px;
.keyboard-shortcuts-key-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: if($is-dark-theme, #fff, #000);
opacity: 0.15;
border-radius: 4px;
}
.keyboard-shortcuts-span {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
opacity: 1;
text-transform: uppercase;
}
}
.keyboard-shortcuts-plus {
font-size: 14px;
}
}
.title {
font-size: 1.2rem;
margin-top: 0;
}
.action {
display: flex;
button {
border-radius: 0.5rem;
}
.fill-space {
flex: 1;
}
}
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { KeyboardShortcutsComponent } from './keyboard-shortcuts.component';
describe('KeyboardShortcutsComponent', () => {
let component: KeyboardShortcutsComponent;
let fixture: ComponentFixture<KeyboardShortcutsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ KeyboardShortcutsComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(KeyboardShortcutsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,30 @@
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Router } from '@angular/router';
import { KeyboardShortcut, ORGSHORTCUTS, SIDEWIDESHORTCUTS } from 'src/app/services/keyboard-shortcuts/keyboard-shortcuts';
@Component({
selector: 'cnsl-keyboard-shortcuts',
templateUrl: './keyboard-shortcuts.component.html',
styleUrls: ['./keyboard-shortcuts.component.scss'],
})
export class KeyboardShortcutsComponent {
public orgShortcuts: KeyboardShortcut[] = ORGSHORTCUTS;
public shortcuts: KeyboardShortcut[] = SIDEWIDESHORTCUTS;
constructor(
public dialogRef: MatDialogRef<KeyboardShortcutsComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private router: Router,
) {}
public closeDialog(): void {
this.dialogRef.close(false);
}
public get isNotOnSystem(): boolean {
return !(
['/system', '/views', '/failed-events'].includes(this.router.url) ||
new RegExp('/system/policy/*').test(this.router.url)
);
}
}
@@ -0,0 +1,16 @@
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 { TranslateModule } from '@ngx-translate/core';
import { HasFeatureModule } from 'src/app/directives/has-feature/has-feature.module';
import { HasRoleModule } from 'src/app/directives/has-role/has-role.module';
import { KeyboardShortcutsComponent } from './keyboard-shortcuts.component';
@NgModule({
declarations: [KeyboardShortcutsComponent],
imports: [CommonModule, FormsModule, TranslateModule, HasFeatureModule, HasRoleModule, MatButtonModule, MatIconModule],
})
export class KeyboardShortcutsModule {}