From 4ddb5a890fa9a0aaf22cef82dac5dc9b4b9a55ba Mon Sep 17 00:00:00 2001 From: Senyoret1 <34079003+Senyoret1@users.noreply.github.com> Date: Mon, 18 Jul 2022 19:48:03 -0400 Subject: [PATCH 1/2] Several improvements for the UI --- .../layout/button/button.component.ts | 7 +++ .../confirmation/confirmation.component.html | 2 +- .../confirmation/confirmation.component.ts | 2 +- .../layout/dialog/dialog.component.ts | 31 +++++++++- .../edit-label/edit-label.component.html | 2 +- .../layout/edit-label/edit-label.component.ts | 2 +- .../filters-selection.component.html | 2 +- .../filters-selection.component.ts | 2 +- .../select-language.component.html | 2 +- .../select-language.component.ts | 2 +- .../select-option.component.html | 2 +- .../select-option/select-option.component.ts | 2 +- .../layout/top-bar/top-bar.component.scss | 2 +- .../update-all/update-all.component.html | 2 +- .../layout/update-all/update-all.component.ts | 2 +- .../layout/update/update.component.html | 2 +- .../layout/update/update.component.ts | 2 +- .../initial-setup.component.html | 2 +- .../initial-setup/initial-setup.component.ts | 4 ++ .../pages/login/login.component.html | 2 +- .../pages/node-list/node-list.component.html | 26 +++++---- .../pages/node-list/node-list.component.scss | 4 ++ .../pages/node-list/node-list.component.ts | 9 --- .../basic-terminal.component.html | 1 + .../basic-terminal.component.ts | 1 + .../log/log-filter/log-filter.component.html | 2 +- .../log/log-filter/log-filter.component.ts | 2 +- .../node-apps-list/log/log.component.html | 2 +- .../apps/node-apps-list/log/log.component.ts | 1 + .../edit-skysocks-client-note.component.html | 2 +- .../edit-skysocks-client-note.component.ts | 2 +- .../skysocks-client-filter.component.html | 2 +- .../skysocks-client-filter.component.ts | 2 +- .../skysocks-client-password.component.html | 2 +- .../skysocks-client-password.component.ts | 2 +- .../skysocks-client-settings.component.html | 10 +++- .../skysocks-client-settings.component.ts | 9 ++- .../skysocks-settings.component.html | 9 ++- .../skysocks-settings.component.ts | 9 ++- .../router-config.component.html | 4 +- .../router-config/router-config.component.ts | 9 ++- .../route-details.component.html | 2 +- .../route-details/route-details.component.ts | 2 +- .../create-transport.component.html | 9 +-- .../create-transport.component.ts | 9 ++- .../transport-details.component.html | 2 +- .../transport-details.component.ts | 1 + .../settings/password/password.component.html | 6 +- .../settings/password/password.component.ts | 7 +++ .../pages/settings/settings.component.html | 9 ++- .../pages/settings/settings.component.scss | 9 +++ .../pages/settings/settings.component.ts | 56 +++++++++++++++++-- .../add-vpn-server.component.html | 2 +- .../add-vpn-server.component.ts | 2 +- .../edit-vpn-server-value.component.html | 2 +- .../edit-vpn-server-value.component.ts | 2 +- .../enter-vpn-server-password.component.html | 2 +- .../enter-vpn-server-password.component.ts | 2 +- .../src/app/utils/generalUtils.ts | 2 +- .../src/assets/i18n/en.json | 1 + .../src/assets/i18n/es.json | 1 + .../src/assets/i18n/es_base.json | 1 + .../src/assets/scss/_forms.scss | 6 ++ .../src/assets/scss/_responsive_tables.scss | 10 +++- static/skywire-manager-src/src/styles.scss | 4 ++ 65 files changed, 252 insertions(+), 83 deletions(-) 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 e2016e91cf..8d602a4de2 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 @@ -91,4 +91,11 @@ export class ButtonComponent implements OnDestroy { this.disabled = false; } } + + /** + * Returns true if the button is showing the loading animation. + */ + get isLoading(): boolean { + return this.state === ButtonStates.Loading; + } } 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 20f5edb545..651ddbb3b7 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 @@ -1,4 +1,4 @@ - +
{{ (state !== confirmationStates.Done ? data.text : doneText) | translate }}
diff --git a/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.ts b/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.ts index da76fb5c27..7ceadf1aab 100644 --- a/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.ts +++ b/static/skywire-manager-src/src/app/components/layout/confirmation/confirmation.component.ts @@ -79,7 +79,7 @@ export class ConfirmationComponent implements AfterViewInit, OnDestroy { @Output() operationAccepted = new EventEmitter(); constructor( - private dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: ConfirmationData, ) { this.disableDismiss = !!data.disableDismiss; 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 ab17e114b6..527ee7f909 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 @@ -1,4 +1,5 @@ -import { Component, Input } from '@angular/core'; +import { Component, HostListener, Input } from '@angular/core'; +import { MatDialog, MatDialogRef } from '@angular/material/dialog'; /** * Base component for all the modal windows. Its main function is to show the title bar. @@ -11,7 +12,7 @@ import { Component, Input } from '@angular/core'; export class DialogComponent { @Input() headline: string; /** - * Hides the close button. + * Disables all the ways provided by default by the UI for closing the modal window. */ @Input() disableDismiss: boolean; /** @@ -23,4 +24,30 @@ export class DialogComponent { * If true, vertical margins will be added to the content. */ @Input() includeVerticalMargins = true; + + // MatDialogRef of the modal window component which is using this component for wrapping + // the contents. + private dialogInternal: MatDialogRef; + @Input() set dialog(val: MatDialogRef) { + val.disableClose = true; + this.dialogInternal = val; + } + + constructor( + private matDialog: MatDialog, + ) { } + + @HostListener('window:keyup.esc') + onKeyUp() { + this.closePopup(); + } + + closePopup() { + if (!this.disableDismiss) { + // Continue only if the current modal window is the topmost one. + if (this.matDialog.openDialogs[this.matDialog.openDialogs.length - 1].id === this.dialogInternal.id) { + this.dialogInternal.close(); + } + } + } } diff --git a/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.html b/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.html index 3ee6fb0bf7..dd35dca8a8 100644 --- a/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.html +++ b/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.html @@ -1,4 +1,4 @@ - +
diff --git a/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.ts b/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.ts index 19853770ca..359348ec5c 100644 --- a/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.ts +++ b/static/skywire-manager-src/src/app/components/layout/edit-label/edit-label.component.ts @@ -33,7 +33,7 @@ export class EditLabelComponent implements OnInit, AfterViewInit { } constructor( - private dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) private data: LabelInfo, private formBuilder: FormBuilder, private storageService: StorageService, diff --git a/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.html b/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.html index 1885ef4e37..9468229d4e 100644 --- a/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.html +++ b/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.html @@ -1,4 +1,4 @@ - + diff --git a/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.ts b/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.ts index 99f14e2146..cc7a92e902 100644 --- a/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.ts +++ b/static/skywire-manager-src/src/app/components/layout/filters-selection/filters-selection.component.ts @@ -51,7 +51,7 @@ export class FiltersSelectionComponent implements OnInit { constructor( @Inject(MAT_DIALOG_DATA) public data: FiltersSelectiondParams, - private dialogRef: MatDialogRef, + public dialogRef: MatDialogRef, private formBuilder: FormBuilder, ) { } diff --git a/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.html b/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.html index 5ff09bf055..53f935019b 100644 --- a/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.html +++ b/static/skywire-manager-src/src/app/components/layout/select-language/select-language.component.html @@ -1,4 +1,4 @@ - +
- + @@ -185,7 +189,7 @@ cellspacing="0" cellpadding="0" > - +
{{ 'tables.sorting-title' | translate }}
@@ -200,7 +204,7 @@
- + diff --git a/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.scss b/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.scss index ce07e8576f..c08156023f 100644 --- a/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.scss +++ b/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.scss @@ -26,3 +26,7 @@ .small-column { width: 1px; } + +.non-selectable { + cursor: not-allowed; +} diff --git a/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.ts b/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.ts index f3b8d13ead..2e53d47d02 100644 --- a/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.ts +++ b/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.ts @@ -677,13 +677,4 @@ export class NodeListComponent implements OnInit, OnDestroy { } }); } - - /** - * Opens the page with the details of the node. - */ - open(node: Node) { - if (node.online) { - this.router.navigate(['nodes', node.localPk]); - } - } } diff --git a/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.html b/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.html index 187eb2cdde..d2199e52ae 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.html +++ b/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.html @@ -2,6 +2,7 @@ [headline]="('actions.terminal.title' | translate) + ' - ' + this.data.label + ' (' + this.data.pk + ')'" [includeScrollableArea]="false" [includeVerticalMargins]="false" + [dialog]="dialogRef" >
diff --git a/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.ts b/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.ts index 08c5cb42fa..9b514a65c0 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.ts +++ b/static/skywire-manager-src/src/app/components/pages/node/actions/basic-terminal/basic-terminal.component.ts @@ -64,6 +64,7 @@ export class BasicTerminalComponent implements AfterViewInit, OnDestroy { constructor( @Inject(MAT_DIALOG_DATA) public data: BasicTerminalData, + public dialogRef: MatDialogRef, private renderer: Renderer2, private apiService: ApiService, private translate: TranslateService, diff --git a/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log-filter/log-filter.component.html b/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log-filter/log-filter.component.html index 8fa8d73c28..a01b91f7af 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log-filter/log-filter.component.html +++ b/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log-filter/log-filter.component.html @@ -1,4 +1,4 @@ - + , + public dialogRef: MatDialogRef, private formBuilder: FormBuilder, ) { } diff --git a/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log.component.html b/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log.component.html index 850245116d..feeff43238 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log.component.html +++ b/static/skywire-manager-src/src/app/components/pages/node/apps/node-apps-list/log/log.component.html @@ -1,4 +1,4 @@ - +