From 3cd0d58f390f857a94e2c4056cd2f7df3e5d6099 Mon Sep 17 00:00:00 2001 From: Senyoret1 <34079003+Senyoret1@users.noreply.github.com> Date: Thu, 13 May 2021 13:11:15 -0400 Subject: [PATCH] Add a view logs option to he UI --- .../components/pages/node/actions/node-actions-helper.ts | 9 ++++++++- .../src/app/components/pages/node/node.component.ts | 2 +- static/skywire-manager-src/src/assets/i18n/en.json | 3 ++- static/skywire-manager-src/src/assets/i18n/es.json | 3 ++- static/skywire-manager-src/src/assets/i18n/es_base.json | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/static/skywire-manager-src/src/app/components/pages/node/actions/node-actions-helper.ts b/static/skywire-manager-src/src/app/components/pages/node/actions/node-actions-helper.ts index 95343f6be..af5fa1096 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/actions/node-actions-helper.ts +++ b/static/skywire-manager-src/src/app/components/pages/node/actions/node-actions-helper.ts @@ -67,6 +67,11 @@ export class NodeActionsHelper { name: 'actions.menu.update', actionName: 'update', icon: 'get_app', + }, + { + name: 'actions.menu.logs', + actionName: 'logs', + icon: 'subject', } ]; @@ -92,12 +97,14 @@ export class NodeActionsHelper { * Must be called when an option form the top bar is selected. * @param actionName Name of the selected option, as defined in the options array. */ - performAction(actionName: string) { + performAction(actionName: string, nodePk: string) { // Call the adequate function if the user clicks any of the options. if (actionName === 'terminal') { this.terminal(); } else if (actionName === 'update') { this.update(); + } else if (actionName === 'logs') { + window.open(window.location.origin + '/api/visors/' + nodePk + '/runtime-logs', '_blank'); } else if (actionName === 'reboot') { this.reboot(); } else if (actionName === null) { diff --git a/static/skywire-manager-src/src/app/components/pages/node/node.component.ts b/static/skywire-manager-src/src/app/components/pages/node/node.component.ts index a148b7266..570c38aea 100644 --- a/static/skywire-manager-src/src/app/components/pages/node/node.component.ts +++ b/static/skywire-manager-src/src/app/components/pages/node/node.component.ts @@ -229,7 +229,7 @@ export class NodeComponent implements OnInit, OnDestroy { */ performAction(actionName: string) { // The helper object manages the event. - this.nodeActionsHelper.performAction(actionName); + this.nodeActionsHelper.performAction(actionName, NodeComponent.currentNodeKey); } /** diff --git a/static/skywire-manager-src/src/assets/i18n/en.json b/static/skywire-manager-src/src/assets/i18n/en.json index f3600d4c4..cc4d1078f 100644 --- a/static/skywire-manager-src/src/assets/i18n/en.json +++ b/static/skywire-manager-src/src/assets/i18n/en.json @@ -242,7 +242,8 @@ "terminal": "Terminal", "config": "Configuration", "update": "Update", - "reboot": "Reboot" + "reboot": "Reboot", + "logs": "View logs" }, "reboot": { "confirmation": "Are you sure you want to reboot the visor?", diff --git a/static/skywire-manager-src/src/assets/i18n/es.json b/static/skywire-manager-src/src/assets/i18n/es.json index e851c6bfe..49d6b5fc9 100644 --- a/static/skywire-manager-src/src/assets/i18n/es.json +++ b/static/skywire-manager-src/src/assets/i18n/es.json @@ -242,7 +242,8 @@ "terminal": "Terminal", "config": "Configuración", "update": "Actualizar", - "reboot": "Reiniciar" + "reboot": "Reiniciar", + "logs": "Ver logs" }, "reboot": { "confirmation": "¿Seguro que desea reiniciar el 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 f3600d4c4..cc4d1078f 100644 --- a/static/skywire-manager-src/src/assets/i18n/es_base.json +++ b/static/skywire-manager-src/src/assets/i18n/es_base.json @@ -242,7 +242,8 @@ "terminal": "Terminal", "config": "Configuration", "update": "Update", - "reboot": "Reboot" + "reboot": "Reboot", + "logs": "View logs" }, "reboot": { "confirmation": "Are you sure you want to reboot the visor?",