Skip to content

Commit

Permalink
Merge pull request #4 from phillipivan/main
Browse files Browse the repository at this point in the history
Hide redundant controller config fields when not required
  • Loading branch information
phillipivan authored May 12, 2024
2 parents df855c4 + 2c47892 commit 591b4b4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
3 changes: 3 additions & 0 deletions companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ The alarms should match the number of configured alarm indexes in your system. R

## Version History

### Version 1.0.4
- Hide redundant config fields when not required

### Version 1.0.3
- Better status updates
- Update dependencies
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ntp-technology-dot",
"version": "1.0.3",
"version": "1.0.4",
"main": "src/main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
28 changes: 27 additions & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ module.exports = {
default: '',
width: 8,
regex: Regex.HOSTNAME,
isVisible: (options) => {
return options.redundant
},
},
{
type: 'static-text',
id: 'place-holder-1',
label: '',
value: '',
width: 8,
isVisible: (options) => {
return !options.redundant
},
},
{
type: 'number',
Expand All @@ -59,12 +72,25 @@ module.exports = {
min: 1,
max: 65535,
tooltip: 'Default: 10005',
isVisible: (options) => {
return options.redundant
},
},
{
type: 'static-text',
id: 'place-holder-2',
label: '',
value: '',
width: 4,
isVisible: (options) => {
return !options.redundant
},
},
{
type: 'checkbox',
id: 'redundant',
label: 'Redundant Controllers',
default: true,
default: false,
width: 4,
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class NTP_DOT_PROTOCOL extends InstanceBase {
this.updateStatus(InstanceStatus.Connecting)
this.config = config
if (this.config.redundant) {
if (this.config.hostSec == '' || this.config.portSec == '') {
this.log('error', 'Secondary host / port not defined')
if (this.config.hostSec == '') {
this.log('error', 'Secondary host not defined')
this.updateStatus(InstanceStatus.BadConfig, 'Secondary not defined')
return undefined
}
Expand Down

0 comments on commit 591b4b4

Please sign in to comment.