From 1d289a9d58858580674f3d4801d1be3e8027a907 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 23 Apr 2020 08:09:11 +0100 Subject: [PATCH] feat: disable web ui links when node is not online License: MIT Signed-off-by: Henrique Dias --- src/tray.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tray.js b/src/tray.js index f5d2afeef..36f89520c 100644 --- a/src/tray.js +++ b/src/tray.js @@ -74,14 +74,17 @@ function buildMenu (ctx) { }, { type: 'separator' }, { + id: 'webuiStatus', label: i18n.t('status'), click: () => { ctx.launchWebUI('/') } }, { + id: 'webuiFiles', label: i18n.t('files'), click: () => { ctx.launchWebUI('/files') } }, { + id: 'webuiPeers', label: i18n.t('peers'), click: () => { ctx.launchWebUI('/peers') } }, @@ -253,6 +256,10 @@ module.exports = function (ctx) { menu.getMenuItemById('stopIpfs').visible = status === STATUS.STARTING_FINISHED menu.getMenuItemById('restartIpfs').visible = (status === STATUS.STARTING_FINISHED || errored) + menu.getMenuItemById('webuiStatus').enabled = status === STATUS.STARTING_FINISHED + menu.getMenuItemById('webuiFiles').enabled = status === STATUS.STARTING_FINISHED + menu.getMenuItemById('webuiPeers').enabled = status === STATUS.STARTING_FINISHED + menu.getMenuItemById('startIpfs').enabled = !gcRunning menu.getMenuItemById('stopIpfs').enabled = !gcRunning menu.getMenuItemById('restartIpfs').enabled = !gcRunning