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 @@ - +