From 6625e65f32d84952cf2b0062cde29c344c1c5871 Mon Sep 17 00:00:00 2001 From: Senyoret1 <34079003+Senyoret1@users.noreply.github.com> Date: Thu, 2 Jul 2020 08:48:55 -0400 Subject: [PATCH 1/4] Add DMSG info to the manager --- .../src/app/app.datatypes.ts | 2 + .../pages/node-list/node-list.component.html | 39 +++++- .../pages/node-list/node-list.component.ts | 120 +++++++++++++++--- .../node-info-content.component.html | 8 ++ .../src/app/services/node.service.ts | 41 +++++- .../src/assets/i18n/en.json | 8 ++ .../src/assets/scss/_responsive_tables.scss | 40 +++++- 7 files changed, 232 insertions(+), 26 deletions(-) diff --git a/static/skywire-manager-src/src/app/app.datatypes.ts b/static/skywire-manager-src/src/app/app.datatypes.ts index a65271220f..3ee9ba6de1 100644 --- a/static/skywire-manager-src/src/app/app.datatypes.ts +++ b/static/skywire-manager-src/src/app/app.datatypes.ts @@ -16,6 +16,8 @@ export class Node { online?: boolean; seconds_online?: number; health?: HealthInfo; + dmsgServerPk?: string; + roundTripPing?: number; } export interface Application { diff --git a/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.html b/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.html index f581f016ee..a386805402 100644 --- a/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.html +++ b/static/skywire-manager-src/src/app/components/pages/node-list/node-list.component.html @@ -26,7 +26,17 @@ >
-
+ +
+
+ +
+
{{ sortingArrow }} + + @@ -61,12 +79,17 @@ + +
+ {{ 'nodes.dmsg-server' | translate }} + {{ sortingArrow }} + + {{ 'nodes.ping' | translate }} + {{ sortingArrow }} +
{{ node.local_pk }} + {{ node.dmsgServerPk }} + + {{ node.roundTripPing }} + - {{ node.roundTripPing }} + {{ 'common.time-in-ms' | translate:{ time: node.roundTripPing } }} -
{{ sortingArrow }} - @@ -78,9 +68,11 @@
+ {{ 'nodes.label' | translate }} {{ sortingArrow }} {{ node.local_pk }} + {{ node.dmsgServerPk }} + {{ 'common.time-in-ms' | translate:{ time: node.roundTripPing } }} @@ -158,11 +150,13 @@
{{ 'nodes.key' | translate }}: - {{ node.local_pk }} + +
{{ 'nodes.dmsg-server' | translate }}: - {{ node.dmsgServerPk }} + +
{{ 'nodes.ping' | translate }}: 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 3df08e97dd..bcdfb1069d 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 @@ -1,3 +1,7 @@ +.labels { + width: 15%; +} + .actions { text-align: right; width: 120px; 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 ef1c53b222..a980173595 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 @@ -60,7 +60,6 @@ export class NodeListComponent implements OnInit, OnDestroy { tabsData: TabButtonData[] = []; showDmsgInfo = false; - private readonly dmsgInfoStorageKey = 'show-dmsg-info'; private dataSubscription: Subscription; private updateTimeSubscription: Subscription; private menuSubscription: Subscription; @@ -84,8 +83,8 @@ export class NodeListComponent implements OnInit, OnDestroy { private clipboardService: ClipboardService, private translateService: TranslateService, ) { - // We only need to check if the key exists. - this.showDmsgInfo = !!localStorage.getItem(this.dmsgInfoStorageKey); + // Show the dmsg info if the dmsg url was used. + this.showDmsgInfo = this.router.url.indexOf('dmsg') !== -1; // Data for populating the tab bar. this.tabsData = [ @@ -94,6 +93,11 @@ export class NodeListComponent implements OnInit, OnDestroy { label: 'nodes.title', linkParts: ['/nodes'], }, + { + icon: 'language', + label: 'nodes.dmsg-title', + linkParts: ['/nodes', 'dmsg'], + }, { icon: 'settings', label: 'settings.title', @@ -150,24 +154,6 @@ export class NodeListComponent implements OnInit, OnDestroy { } } - /** - * Makes the dmsg info to be shown or hidden. - */ - toggleDmsgInfo() { - this.showDmsgInfo = !this.showDmsgInfo; - // Create or remove an entry in the local storage, to be able to recover the setting later. - if (this.showDmsgInfo) { - localStorage.setItem(this.dmsgInfoStorageKey, '-'); - } else { - localStorage.removeItem(this.dmsgInfoStorageKey); - } - - // Do not allow to sort the list using a dmsg column while no dmsg data is being shown. - if (this.sortBy === SortableColumns.DmsgServer || this.sortBy === SortableColumns.Ping) { - this.changeSortingOrder(NodeListComponent.defaultSortableColumn); - } - } - /** * Returns the scss class to be used to show the current status of the node. * @param forDot If true, returns a class for creating a colored dot. If false, diff --git a/static/skywire-manager-src/src/assets/i18n/en.json b/static/skywire-manager-src/src/assets/i18n/en.json index b597a43379..7929c82b97 100644 --- a/static/skywire-manager-src/src/assets/i18n/en.json +++ b/static/skywire-manager-src/src/assets/i18n/en.json @@ -93,9 +93,8 @@ "nodes": { "title": "Visor list", + "dmsg-title": "DMSG", "update-all": "Update all", - "show-dmsg-info": "Show DMSG info", - "hide-dmsg-info": "Hide DMSG info", "state": "State", "state-tooltip": "Current state", "label": "Label",