From 62e75a30ea3db8e6d2cd9d46060be5193d00b57b Mon Sep 17 00:00:00 2001 From: Senyoret1 <34079003+Senyoret1@users.noreply.github.com> Date: Thu, 13 May 2021 11:53:51 -0400 Subject: [PATCH] Fixes for the UI code --- .../src/app/app.datatypes.ts | 2 -- .../src/app/services/node.service.ts | 27 +++++++------------ .../src/assets/i18n/de.json | 1 - .../src/assets/i18n/de_base.json | 1 - .../src/assets/i18n/en.json | 1 - .../src/assets/i18n/es.json | 1 - .../src/assets/i18n/es_base.json | 1 - 7 files changed, 10 insertions(+), 24 deletions(-) diff --git a/static/skywire-manager-src/src/app/app.datatypes.ts b/static/skywire-manager-src/src/app/app.datatypes.ts index d9725ede80..58a0598cd4 100644 --- a/static/skywire-manager-src/src/app/app.datatypes.ts +++ b/static/skywire-manager-src/src/app/app.datatypes.ts @@ -1,9 +1,7 @@ export class Node { label: string; localPk: string; - tcpAddr: string; ip: string; - port: string; version: string; apps: Application[]; transports: Transport[]; diff --git a/static/skywire-manager-src/src/app/services/node.service.ts b/static/skywire-manager-src/src/app/services/node.service.ts index 6674e0f321..69b7e35dfc 100644 --- a/static/skywire-manager-src/src/app/services/node.service.ts +++ b/static/skywire-manager-src/src/app/services/node.service.ts @@ -498,7 +498,7 @@ export class NodeService { node.localPk = response.overview.local_pk; // Ip. - if (response.overview.local_ip && (response.overview.local_ip as string).trim()) { + if (response.overview && response.overview.local_ip && (response.overview.local_ip as string).trim()) { node.ip = response.overview.local_ip; } else { node.ip = null; @@ -508,6 +508,15 @@ export class NodeService { const labelInfo = this.storageService.getLabelInfo(node.localPk); node.label = labelInfo && labelInfo.label ? labelInfo.label : this.storageService.getDefaultLabel(node); + // If the node is offline, there if no need for getting the rest of the data. + if (!node.online) { + node.dmsgServerPk = ''; + node.roundTripPing = ''; + nodes.push(node); + + return; + } + // Health data. node.health = { status: 200, @@ -731,22 +740,6 @@ export class NodeService { ); } - /** - * Gets a part of the node address: the ip or the port. - * @param tcpAddr Complete address. - * @param part 0 for the ip or 1 for the port. - */ - private getAddressPart(tcpAddr: string, part: number): string { - const addressParts = tcpAddr.split(':'); - let port = tcpAddr; - - if (addressParts && addressParts.length === 2) { - port = addressParts[part]; - } - - return port; - } - /** * Restarts a node. */ diff --git a/static/skywire-manager-src/src/assets/i18n/de.json b/static/skywire-manager-src/src/assets/i18n/de.json index 98e754e2ec..63bff53703 100644 --- a/static/skywire-manager-src/src/assets/i18n/de.json +++ b/static/skywire-manager-src/src/assets/i18n/de.json @@ -93,7 +93,6 @@ "title": "Visor Info", "label": "Bezeichnung:", "public-key": "Öffentlicher Schlüssel:", - "port": "Port:", "dmsg-server": "DMSG Server:", "ping": "Ping:", "node-version": "Visor Version:", diff --git a/static/skywire-manager-src/src/assets/i18n/de_base.json b/static/skywire-manager-src/src/assets/i18n/de_base.json index a95962415f..00e9012cc2 100644 --- a/static/skywire-manager-src/src/assets/i18n/de_base.json +++ b/static/skywire-manager-src/src/assets/i18n/de_base.json @@ -93,7 +93,6 @@ "title": "Visor Info", "label": "Label:", "public-key": "Public key:", - "port": "Port:", "dmsg-server": "DMSG server:", "ping": "Ping:", "node-version": "Visor version:", diff --git a/static/skywire-manager-src/src/assets/i18n/en.json b/static/skywire-manager-src/src/assets/i18n/en.json index f3600d4c45..09a7bcc62f 100644 --- a/static/skywire-manager-src/src/assets/i18n/en.json +++ b/static/skywire-manager-src/src/assets/i18n/en.json @@ -97,7 +97,6 @@ "label": "Label:", "public-key": "Public key:", "ip": "IP:", - "port": "Port:", "dmsg-server": "DMSG server:", "ping": "Ping:", "node-version": "Visor version:", diff --git a/static/skywire-manager-src/src/assets/i18n/es.json b/static/skywire-manager-src/src/assets/i18n/es.json index e851c6bfe8..638cde8918 100644 --- a/static/skywire-manager-src/src/assets/i18n/es.json +++ b/static/skywire-manager-src/src/assets/i18n/es.json @@ -97,7 +97,6 @@ "label": "Etiqueta:", "public-key": "Llave pública:", "ip": "IP:", - "port": "Puerto:", "dmsg-server": "Servidor DMSG:", "ping": "Ping:", "node-version": "Versión del visor:", diff --git a/static/skywire-manager-src/src/assets/i18n/es_base.json b/static/skywire-manager-src/src/assets/i18n/es_base.json index f3600d4c45..09a7bcc62f 100644 --- a/static/skywire-manager-src/src/assets/i18n/es_base.json +++ b/static/skywire-manager-src/src/assets/i18n/es_base.json @@ -97,7 +97,6 @@ "label": "Label:", "public-key": "Public key:", "ip": "IP:", - "port": "Port:", "dmsg-server": "DMSG server:", "ping": "Ping:", "node-version": "Visor version:",