From 2040ccd5517789996ce62a6f021df1bbe0f6d08d Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 23 Jun 2022 22:23:11 -0600 Subject: [PATCH] Basic selection display --- art/themes/luciano_blocktronics/theme.hjson | 2 + art/themes/luciano_blocktronics/wfc.ans | Bin 3055 -> 3055 bytes core/wfc.js | 59 +++++++++++++------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/art/themes/luciano_blocktronics/theme.hjson b/art/themes/luciano_blocktronics/theme.hjson index a3fc4f85..cf3b744f 100644 --- a/art/themes/luciano_blocktronics/theme.hjson +++ b/art/themes/luciano_blocktronics/theme.hjson @@ -296,6 +296,8 @@ } statusAvailableIndicators: [ "N", "Y" ] statusVisibleIndicators: [ "N", "Y" ] + + nodeStatusSelectionFormat: "|00|10{realName}" } 0: { mci: { diff --git a/art/themes/luciano_blocktronics/wfc.ans b/art/themes/luciano_blocktronics/wfc.ans index 92a7f302f8b3477573c3de820bd808434a9d875d..9c1e6ede43aa7c319f0b9df2d1ef10cdd35f8654 100644 GIT binary patch delta 28 kcmaDa{$6}TAq$IYh>!8)k1S%FyIE}5nT(7lpX62p0F?R(MF0Q* delta 26 icmaDa{$6}TA -1) { this.selectedNodeStatusIndex = index; this._selectNodeByIndex(nodeStatusView, this.selectedNodeStatusIndex); + + const nodeStatusSelectionView = this.getView( + 'main', + MciViewIds.main.selectedNodeStatusInfo + ); + + if (nodeStatusSelectionView) { + const item = nodeStatusView.getItems()[index]; + this._updateNodeStatusSelection(nodeStatusSelectionView, item); + } } + return cb(null); }, kickSelectedNode: (formData, extraArgs, cb) => { @@ -172,18 +183,14 @@ exports.getModule = class WaitingForCallerModule extends MenuModule { 'main', MciViewIds.main.selectedNodeStatusInfo ); - const nodeStatusSelectionFormat = - this.config.nodeStatusSelectionFormat || '{text}'; + if (nodeStatusView && nodeStatusSelectionView) { nodeStatusView.on('index update', index => { const item = nodeStatusView.getItems()[index]; - if (item) { - nodeStatusSelectionView.setText( - stringFormat(nodeStatusSelectionFormat, item) - ); - // :TODO: Update view - // :TODO: this is not triggered by key-presses (1, 2, ...) -- we need to handle that as well - } + this._updateNodeStatusSelection( + nodeStatusSelectionView, + item + ); }); } @@ -202,16 +209,6 @@ exports.getModule = class WaitingForCallerModule extends MenuModule { ); } - _displayHelpPage(cb) { - this._stopRefreshing(); - - this.displayAsset(this.menuConfig.config.art.help, { clearScreen: true }, () => { - this.client.waitForKeyPress(() => { - return this._displayMainPage(true, cb); - }); - }); - } - enter() { this.client.stopIdleMonitor(); this._applyOpVisibility(); @@ -231,6 +228,26 @@ exports.getModule = class WaitingForCallerModule extends MenuModule { super.leave(); } + _updateNodeStatusSelection(nodeStatusSelectionView, item) { + if (item) { + const nodeStatusSelectionFormat = + this.config.nodeStatusSelectionFormat || '{text}'; + nodeStatusSelectionView.setText( + stringFormat(nodeStatusSelectionFormat, item) + ); + } + } + + _displayHelpPage(cb) { + this._stopRefreshing(); + + this.displayAsset(this.menuConfig.config.art.help, { clearScreen: true }, () => { + this.client.waitForKeyPress(() => { + return this._displayMainPage(true, cb); + }); + }); + } + _getSelectedNodeItem() { const nodeStatusView = this.getView('main', MciViewIds.main.nodeStatus); if (!nodeStatusView) { @@ -460,7 +477,7 @@ exports.getModule = class WaitingForCallerModule extends MenuModule { return cb(null); } - _getNodeByNodeId(nodeStatusView, nodeId) { + _getNodeStatusIndexByNodeId(nodeStatusView, nodeId) { return nodeStatusView.getItems().findIndex(entry => entry.node == nodeId); }