diff --git a/static/skywire-manager-src/src/app/app.module.ts b/static/skywire-manager-src/src/app/app.module.ts index 43958695a5..b11f16f7d5 100644 --- a/static/skywire-manager-src/src/app/app.module.ts +++ b/static/skywire-manager-src/src/app/app.module.ts @@ -93,17 +93,15 @@ import { InitialSetupComponent } from './components/pages/login/initial-setup/in import { SelectLanguageComponent } from './components/layout/select-language/select-language.component'; import { LangButtonComponent } from './components/layout/lang-button/lang-button.component'; import { TruncatedTextComponent } from './components/layout/truncated-text/truncated-text.component'; -import { SelectTabComponent } from './components/layout/tab-bar/select-tab/select-tab.component'; import { NodeInfoContentComponent } from './components/pages/node/node-info/node-info-content/node-info-content.component'; import { NodeInfoComponent } from './components/pages/node/node-info/node-info.component'; -import { SelectColumnComponent } from './components/layout/select-column/select-column.component'; import { SelectOptionComponent } from './components/layout/select-option/select-option.component'; -import { SelectPageComponent } from './components/layout/paginator/select-page/select-page.component'; import { TerminalComponent } from './components/pages/node/actions/terminal/terminal.component'; import { SkysocksSettingsComponent } from './components/pages/node/apps/node-apps/skysocks-settings/skysocks-settings.component'; import { SkysocksClientSettingsComponent } from './components/pages/node/apps/node-apps/skysocks-client-settings/skysocks-client-settings.component'; +import { MenuButtonComponent } from './components/layout/sidenav/menu-button/menu-button.component'; const globalRippleConfig: RippleGlobalOptions = { disabled: true, @@ -176,15 +174,13 @@ const globalRippleConfig: RippleGlobalOptions = { SelectLanguageComponent, LangButtonComponent, TruncatedTextComponent, - SelectTabComponent, NodeInfoContentComponent, NodeInfoComponent, - SelectColumnComponent, SelectOptionComponent, - SelectPageComponent, TerminalComponent, SkysocksSettingsComponent, SkysocksClientSettingsComponent, + MenuButtonComponent, ], entryComponents: [ ConfigurationComponent, @@ -208,10 +204,7 @@ const globalRippleConfig: RippleGlobalOptions = { SnackbarComponent, InitialSetupComponent, SelectLanguageComponent, - SelectTabComponent, - SelectColumnComponent, SelectOptionComponent, - SelectPageComponent, TerminalComponent, SkysocksSettingsComponent, SkysocksClientSettingsComponent, diff --git a/static/skywire-manager-src/src/app/components/layout/button/button.component.html b/static/skywire-manager-src/src/app/components/layout/button/button.component.html index d41767f041..634aaa995b 100644 --- a/static/skywire-manager-src/src/app/components/layout/button/button.component.html +++ b/static/skywire-manager-src/src/app/components/layout/button/button.component.html @@ -2,7 +2,6 @@ done error_outline - {{ icon }} diff --git a/static/skywire-manager-src/src/app/components/layout/button/button.component.scss b/static/skywire-manager-src/src/app/components/layout/button/button.component.scss index e457ee6c2b..ef13aae758 100644 --- a/static/skywire-manager-src/src/app/components/layout/button/button.component.scss +++ b/static/skywire-manager-src/src/app/components/layout/button/button.component.scss @@ -15,6 +15,12 @@ button { } } +::ng-deep .mat-raised-button[disabled] { + background-color: $blue-medium !important; + color: $white !important; + opacity: 0.5; +} + mat-icon, mat-spinner { display: inline-block; margin-right: 20px; diff --git a/static/skywire-manager-src/src/app/components/layout/button/button.component.ts b/static/skywire-manager-src/src/app/components/layout/button/button.component.ts index 5bf8869131..5f1979c81a 100644 --- a/static/skywire-manager-src/src/app/components/layout/button/button.component.ts +++ b/static/skywire-manager-src/src/app/components/layout/button/button.component.ts @@ -20,7 +20,6 @@ export class ButtonComponent implements OnDestroy { // Should be be 'mat-button' or 'mat-raised-button'. @Input() type = 'mat-button'; @Input() disabled = false; - @Input() icon: string; // Must be one of the colors defined on the default theme. @Input() color = ''; @Input() loadingSize = 24; diff --git a/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.html b/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.html index 8c94d7e135..c8f39b529e 100644 --- a/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.html +++ b/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.html @@ -2,6 +2,14 @@
{{ (state !== confirmationStates.Done ? data.text : doneText) | translate }}
+
+
+ - {{ element | translate }} +
+
+
+ {{ data.lowerText | translate }} +
this.confirmButton.focus()); diff --git a/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.html b/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.html index 277acc00a7..8515f9307b 100644 --- a/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.html +++ b/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.html @@ -5,10 +5,12 @@
- +
+ + - +
- +
diff --git a/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.scss b/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.scss index de583d930f..9ec68779a5 100644 --- a/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.scss +++ b/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.scss @@ -3,15 +3,20 @@ @import 'utilities/utilities'; @import 'text'; +:host { + color: $black; +} + .header { margin-top: -$mat-dialog-padding; margin-left: -$mat-dialog-padding; margin-right: -$mat-dialog-padding; margin-bottom: 0; - color: $blue-dark; + color: $blue-medium; padding: 0px ($mat-dialog-padding - 10) 0px $mat-dialog-padding; font-size: $font-size-base; text-transform: uppercase; + font-weight: bold; display: flex; justify-content: space-between; align-items: center; @@ -29,7 +34,7 @@ span { @extend .reactivate-mouse; line-height: $font-size-base; - margin: 17px 0; + margin: 18px 0; } .mat-icon-button { @@ -48,3 +53,15 @@ } } } + +.header-separator { + height: 1px; + background-color: $modal-separator; + margin-left: -12px; + margin-right: -12px; +} + +.content-margin { + padding-top: 18px; + padding-bottom: $mat-dialog-padding !important; +} diff --git a/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.ts b/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.ts index 987b3e36c8..ab17e114b6 100644 --- a/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.ts +++ b/static/skywire-manager-src/src/app/components/layout/dialog/dialog.component.ts @@ -19,4 +19,8 @@ export class DialogComponent { * If false, the contents must include its own scrollable container. */ @Input() includeScrollableArea = true; + /** + * If true, vertical margins will be added to the content. + */ + @Input() includeVerticalMargins = true; } diff --git a/static/skywire-manager-src/src/app/components/layout/lang-button/lang-button.component.html b/static/skywire-manager-src/src/app/components/layout/lang-button/lang-button.component.html index a940411ffe..ae4adbf909 100644 --- a/static/skywire-manager-src/src/app/components/layout/lang-button/lang-button.component.html +++ b/static/skywire-manager-src/src/app/components/layout/lang-button/lang-button.component.html @@ -1,6 +1,6 @@ - - diff --git a/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.scss b/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.spec.ts b/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.spec.ts deleted file mode 100644 index 60525f670f..0000000000 --- a/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SelectPageComponent } from './select-page.component'; - -describe('SelectPageComponent', () => { - let component: SelectPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SelectPageComponent ], - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SelectPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should be created', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.ts b/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.ts deleted file mode 100644 index ae8c1d28ea..0000000000 --- a/static/skywire-manager-src/src/app/components/layout/paginator/select-page/select-page.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogConfig } from '@angular/material/dialog'; - -import { AppConfig } from 'src/app/app.config'; - -/** - * Modal window for selecting what page to show in a multipage list. When the user selects a page, - * the modal window is closed and the number of the selected page is returned in the "afterClosed" envent. - */ -@Component({ - selector: 'app-select-page', - templateUrl: './select-page.component.html', - styleUrls: ['./select-page.component.scss'], -}) -export class SelectPageComponent { - options: number[] = []; - - /** - * Opens the modal window. Please use this function instead of opening the window "by hand". - */ - public static openDialog(dialog: MatDialog, pagesToSelectFrom: number): MatDialogRef { - const config = new MatDialogConfig(); - config.data = pagesToSelectFrom; - config.autoFocus = false; - config.width = AppConfig.smallModalWidth; - - return dialog.open(SelectPageComponent, config); - } - - constructor( - @Inject(MAT_DIALOG_DATA) public data: any, - private dialogRef: MatDialogRef, - ) { - for (let i = 0; i < data; i++) { - this.options.push(i + 1); - } - } - - closePopup(page: string) { - this.dialogRef.close(page); - } -} diff --git a/static/skywire-manager-src/src/app/components/layout/refresh-button/refresh-button.component.html b/static/skywire-manager-src/src/app/components/layout/refresh-button/refresh-button.component.html index 6cfaabb3a3..3bc4c9ac92 100644 --- a/static/skywire-manager-src/src/app/components/layout/refresh-button/refresh-button.component.html +++ b/static/skywire-manager-src/src/app/components/layout/refresh-button/refresh-button.component.html @@ -1,6 +1,6 @@ -
- - diff --git a/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.scss b/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.spec.ts b/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.spec.ts deleted file mode 100644 index ead94b47d0..0000000000 --- a/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SelectColumnComponent } from './select-column.component'; - -describe('SelectColumnComponent', () => { - let component: SelectColumnComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SelectColumnComponent ], - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SelectColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should be created', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.ts b/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.ts deleted file mode 100644 index e6025ab94c..0000000000 --- a/static/skywire-manager-src/src/app/components/layout/select-column/select-column.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogConfig } from '@angular/material/dialog'; - -import { AppConfig } from 'src/app/app.config'; - -/** - * Result returned when a column is selected with SelectColumnComponent. - */ -export interface SelectedColumn { - /** - * Label of the selected column. Is the value of the element in the data array used for opening - * the modal window. - */ - label: string; - /** - * If the user selected the ascending (false) or descending (true) order. - */ - sortReverse: boolean; -} - -/** - * Modal window shown on small screens for allowing the user to select which column use to sort - * a table/list. It shows an ascending and a descending option for each column. When the user - * selects a column, the modal window is closed and a "SelectedColumn" object is returned in - * the "afterClosed" envent. - */ -@Component({ - selector: 'app-select-column', - templateUrl: './select-column.component.html', - styleUrls: ['./select-column.component.scss'], -}) -export class SelectColumnComponent { - /** - * Opens the modal window. Please use this function instead of opening the window "by hand". - */ - public static openDialog(dialog: MatDialog, columnNames: string[]): MatDialogRef { - const config = new MatDialogConfig(); - config.data = columnNames; - config.autoFocus = false; - config.width = AppConfig.smallModalWidth; - - return dialog.open(SelectColumnComponent, config); - } - - constructor( - @Inject(MAT_DIALOG_DATA) public data: string[], - private dialogRef: MatDialogRef, - ) { } - - closePopup(label: string, reverse: boolean) { - const response: SelectedColumn = { - label: label, - sortReverse: reverse, - }; - - this.dialogRef.close(response); - } -} diff --git a/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.scss b/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.scss index 91e9cf712c..a2a64fe48f 100644 --- a/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.scss +++ b/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.scss @@ -2,7 +2,7 @@ @import 'variables'; @import 'text'; -$label-background: #eeeeee; +$label-background: rgba(255, 255, 255, 0.25); .options-container { display: flex; diff --git a/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.html b/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.html index af0ad07467..a258000b85 100644 --- a/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.html +++ b/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.html @@ -1,12 +1,12 @@ - -
+ +
diff --git a/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.ts b/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.ts index 3a33b539f8..bcc77b7268 100644 --- a/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.ts +++ b/static/skywire-manager-src/src/app/components/layout/select-option/select-option.component.ts @@ -9,16 +9,21 @@ export interface SelectableOption { /** * Name of the material icon to show. */ - icon: string; + icon?: string; /** * Label to show. */ label: string; } +// Data received by SelectOptionComponent. +interface ComponentData { + options: SelectableOption[]; + title: string; +} + /** - * Modal window for allowing the user to select an option. It is used mainly for the options - * of the elements of the tables when the screen is too small. When the user selects an option, + * Modal window for allowing the user to select an option. When the user selects an option, * the modal window is closed and the number of the selected option (counting from 1) is * returned in the "afterClosed" envent. */ @@ -31,9 +36,12 @@ export class SelectOptionComponent { /** * Opens the modal window. Please use this function instead of opening the window "by hand". */ - public static openDialog(dialog: MatDialog, optionsToShow: SelectableOption[]): MatDialogRef { + public static openDialog(dialog: MatDialog, optionsToShow: SelectableOption[], title: string): MatDialogRef { const config = new MatDialogConfig(); - config.data = optionsToShow; + config.data = { + options: optionsToShow, + title: title, + }; config.autoFocus = false; config.width = AppConfig.smallModalWidth; @@ -41,7 +49,7 @@ export class SelectOptionComponent { } constructor( - @Inject(MAT_DIALOG_DATA) public data: SelectableOption[], + @Inject(MAT_DIALOG_DATA) public data: ComponentData, private dialogRef: MatDialogRef, ) { } diff --git a/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.html b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.html new file mode 100644 index 0000000000..c45f264bb0 --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.html @@ -0,0 +1,11 @@ +
+ +
diff --git a/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.scss b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.scss new file mode 100644 index 0000000000..731d92d9f8 --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.scss @@ -0,0 +1,47 @@ +@import 'variables'; +@import 'utilities/utilities'; +@import 'text'; +@import "~bootstrap/scss/functions"; + +:host { + width: 100%; + display: block; +} + +.external-border { + height: 1px; + background-color: $separator; + margin: 0 15px; +} + +.enabled { + opacity: 1; + @extend .cursor-pointer; + + &:hover { + background-color: theme-color(translucid-hover) !important; + } +} + +button { + width: 100%; + color: $white; + background-color: transparent !important; + border: 0; + text-align: left; + height: 55px; + font-size: $font-size-sm; + display: flex; + align-items: center; + opacity: 0.35; + + .separator { + margin: 0 10px; + } + + mat-icon { + display: inline-block; + margin-left: 25px; + opacity: 0.75; + } +} diff --git a/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.spec.ts b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.spec.ts new file mode 100644 index 0000000000..f1d563dee7 --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { MenuButtonComponent } from './menu-button.component'; + +describe('MenuButtonComponent', () => { + let component: MenuButtonComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ MenuButtonComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MenuButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.ts b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.ts new file mode 100644 index 0000000000..65bb6d45fb --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/sidenav/menu-button/menu-button.component.ts @@ -0,0 +1,38 @@ +import { Component, EventEmitter, Input, Output, OnDestroy } from '@angular/core'; + +/** + * Buttons shown in the left menu. + */ +@Component({ + selector: 'app-menu-button', + templateUrl: './menu-button.component.html', + styleUrls: ['./menu-button.component.scss'] +}) +export class MenuButtonComponent implements OnDestroy { + @Input() disabled = false; + @Input() icon: string; + @Input() text: string; + // If true, only the separator at the top will be shown. If false, only the separator at + // the bottom will be shown. + @Input() showUpperSeparator = false; + // Click event. + @Output() action = new EventEmitter(); + + ngOnDestroy() { + this.action.complete(); + } + + click() { + if (!this.disabled) { + this.action.emit(); + } + } + + showEnabled() { + this.disabled = false; + } + + showDisabled() { + this.disabled = true; + } +} diff --git a/static/skywire-manager-src/src/app/components/layout/sidenav/sidenav.component.html b/static/skywire-manager-src/src/app/components/layout/sidenav/sidenav.component.html index 243e399361..7bbea942a5 100644 --- a/static/skywire-manager-src/src/app/components/layout/sidenav/sidenav.component.html +++ b/static/skywire-manager-src/src/app/components/layout/sidenav/sidenav.component.html @@ -8,6 +8,7 @@ @@ -48,7 +49,7 @@
-