diff --git a/static/skywire-manager-src/src/app/app.module.ts b/static/skywire-manager-src/src/app/app.module.ts index 36fc082746..f03105cd29 100644 --- a/static/skywire-manager-src/src/app/app.module.ts +++ b/static/skywire-manager-src/src/app/app.module.ts @@ -101,6 +101,7 @@ import { RewardsAddressComponent } from './components/pages/node/node-info/node- import { BulkRewardAddressChangerComponent } from './components/layout/bulk-reward-address-changer/bulk-reward-address-changer.component'; import { UserAppSettingsComponent } from './components/pages/node/apps/node-apps/user-app-settings/user-app-settings.component'; import { NodeLogsComponent } from './components/pages/node/actions/node-logs/node-logs.component'; +import { TabSelectorComponent } from './components/layout/tab-selector/tab-selector.component'; const globalRippleConfig: RippleGlobalOptions = { disabled: true, @@ -178,6 +179,7 @@ const globalRippleConfig: RippleGlobalOptions = { BulkRewardAddressChangerComponent, UserAppSettingsComponent, NodeLogsComponent, + TabSelectorComponent, ], imports: [ BrowserModule, diff --git a/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.html b/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.html new file mode 100644 index 0000000000..a1a4b1348f --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.html @@ -0,0 +1,9 @@ +
+
+
+ {{ tabNames[selectedTab] | translate }} +
+ expand_more +
+
+
diff --git a/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.scss b/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.scss new file mode 100644 index 0000000000..93db0b5af2 --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.scss @@ -0,0 +1,17 @@ +.top-dialog-button{ + .top-dialog-button-content { + display: flex; + + .tab-name { + flex-grow: 1; + margin-right: 10px; + align-self: center; + } + + .icon { + font-size: 20px; + flex-shrink: 0; + align-self: center; + } + } +} diff --git a/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.ts b/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.ts new file mode 100644 index 0000000000..b029719a9a --- /dev/null +++ b/static/skywire-manager-src/src/app/components/layout/tab-selector/tab-selector.component.ts @@ -0,0 +1,43 @@ +import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core'; +import { SelectOptionComponent, SelectableOption } from '../select-option/select-option.component'; +import { MatDialog } from '@angular/material/dialog'; + +/** + * Button for changing the selected tab of an app-tab-selector component in small screens. + */ +@Component({ + selector: 'app-tab-selector', + templateUrl: './tab-selector.component.html', + styleUrls: ['./tab-selector.component.scss'] +}) +export class TabSelectorComponent implements OnDestroy { + // Name of the available tabs, for the translation pipe. + @Input() tabNames: string[] = ['']; + // Index of the currently selected tab. + @Input() selectedTab = 0; + // Event emited if the user selects a different tab. The selectedTab var is not + // updated automatically when this event is sent. + @Output() tabChanged = new EventEmitter(); + + constructor( + private dialog: MatDialog + ) { } + + ngOnDestroy() { + this.tabChanged.complete(); + } + + showTabSelector() { + const options: SelectableOption[] = []; + + // Create a list with all the tabs. + this.tabNames.forEach((name, i) => { + options.push({ icon: i === this.selectedTab ? 'check' : '', label: name }) + }); + + // Show the tab selection modal window. + SelectOptionComponent.openDialog(this.dialog, options, 'node.logs.filter-title').afterClosed().subscribe((selectedOption: number) => { + this.tabChanged.emit(selectedOption - 1); + }); + } +} diff --git a/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.html b/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.html index a708bdb66a..b5f9818fed 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.html +++ b/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.html @@ -1,7 +1,7 @@ -
-
+
+
{{ 'node.logs.selected-filter' | translate }} {{ ('node.logs.' + levelDetails.get(currentMinimumLevel).levelFilterName) | translate }} @@ -10,7 +10,7 @@ {{ 'node.logs.filter-ignored' | translate:{number: logEntries.length - filteredLogEntries.length} }}
-
+
diff --git a/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.scss b/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.scss index a74a96c7ae..dc607e837d 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.scss +++ b/static/skywire-manager-src/src/app/components/pages/node/actions/node-logs/node-logs.component.scss @@ -1,19 +1,9 @@ @import "variables"; -.filter-area { - margin-left: -$mat-dialog-padding; - margin-right: -$mat-dialog-padding; - font-size: $font-size-smaller; - color: $light-gray; - background-color: #d9deeb; - cursor: pointer; - - &:hover { - background-color: darken(#d9deeb, 3%); - } +.top-dialog-button { + color: $light-gray !important; - .filter-content { - padding: 10px $mat-dialog-padding; + .top-dialog-button-content { text-align: center; .actual-value { @@ -24,12 +14,6 @@ font-size: $font-size-mini-plus; } } - - .filter-margin { - height: 1px; - background-color: $modal-separator; - margin: 0 12px; - } } .log-entry { 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 6ef1474669..82aa52d4d6 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,10 +1,15 @@ -