Skip to content

Commit

Permalink
feat: disable web ui links when node is not online
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Apr 23, 2020
1 parent ad91dce commit 1d289a9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') }
},
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1d289a9

Please sign in to comment.