@homebridge-plugins/homebridge-resideo 3.2.0-beta.1 → 3.2.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/homebridge-ui/public/index.html +57 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -118,6 +118,17 @@
|
|
|
118
118
|
</button>
|
|
119
119
|
</div>
|
|
120
120
|
</li>
|
|
121
|
+
<li class="list-group-item">
|
|
122
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
123
|
+
<div class="pr-2">
|
|
124
|
+
<div>Remove All Devices</div>
|
|
125
|
+
<div class="text-muted action-desc" id="removeAllText">Remove every device from the plugin config.</div>
|
|
126
|
+
</div>
|
|
127
|
+
<button type="button" class="btn btn-primary m-0 ml-3 py-1 min-w-50" id="removeAllBtn" aria-label="Remove all devices from the config">
|
|
128
|
+
<i aria-hidden="true" class="fas fa-arrow-right"></i>
|
|
129
|
+
</button>
|
|
130
|
+
</div>
|
|
131
|
+
</li>
|
|
121
132
|
<li class="list-group-item">
|
|
122
133
|
<div class="d-flex justify-content-between align-items-center">
|
|
123
134
|
<div class="pr-2">
|
|
@@ -235,6 +246,7 @@
|
|
|
235
246
|
// so staged-but-unsaved edits made in the Settings tab are respected
|
|
236
247
|
let pickerAccessories = []
|
|
237
248
|
let removeConfirmTimer
|
|
249
|
+
let removeAllConfirmTimer
|
|
238
250
|
|
|
239
251
|
// The action buttons always show the settings-page arrow; the row text
|
|
240
252
|
// (and the button's aria-label) says what the arrow will do
|
|
@@ -449,6 +461,51 @@
|
|
|
449
461
|
homebridge.toast.error(err.message, 'Error')
|
|
450
462
|
}
|
|
451
463
|
})
|
|
464
|
+
const resetRemoveAllButton = () => {
|
|
465
|
+
const btn = document.getElementById('removeAllBtn')
|
|
466
|
+
clearTimeout(removeAllConfirmTimer)
|
|
467
|
+
delete btn.dataset.confirm
|
|
468
|
+
btn.classList.remove('btn-danger')
|
|
469
|
+
btn.classList.add('btn-primary')
|
|
470
|
+
btn.innerHTML = actionArrow
|
|
471
|
+
btn.setAttribute('aria-label', 'Remove all devices from the config')
|
|
472
|
+
document.getElementById('removeAllText').innerHTML = 'Remove every device from the plugin config.'
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
document.getElementById('removeAllBtn').addEventListener('click', async () => {
|
|
476
|
+
try {
|
|
477
|
+
const btn = document.getElementById('removeAllBtn')
|
|
478
|
+
const blocks = await getConfigBlocks()
|
|
479
|
+
const config = blocks[0]
|
|
480
|
+
const total = config.options && Array.isArray(config.options.devices) ? config.options.devices.length : 0
|
|
481
|
+
if (total === 0) {
|
|
482
|
+
resetRemoveAllButton()
|
|
483
|
+
homebridge.toast.info('There are no devices in the config.', 'Nothing To Remove')
|
|
484
|
+
return
|
|
485
|
+
}
|
|
486
|
+
if (btn.dataset.confirm !== 'yes') {
|
|
487
|
+
// Removing everything always asks for a second click, since any
|
|
488
|
+
// settings on the entries would be lost
|
|
489
|
+
btn.dataset.confirm = 'yes'
|
|
490
|
+
btn.classList.remove('btn-primary')
|
|
491
|
+
btn.classList.add('btn-danger')
|
|
492
|
+
btn.innerHTML = actionArrow
|
|
493
|
+
btn.setAttribute('aria-label', 'Confirm removing all devices from the config')
|
|
494
|
+
document.getElementById('removeAllText').innerHTML = 'Any settings on these entries will be lost. Click again to remove all ' + total + (total === 1 ? ' entry.' : ' entries.')
|
|
495
|
+
removeAllConfirmTimer = setTimeout(resetRemoveAllButton, 5000)
|
|
496
|
+
return
|
|
497
|
+
}
|
|
498
|
+
delete config.options.devices
|
|
499
|
+
await homebridge.updatePluginConfig(blocks)
|
|
500
|
+
resetRemoveAllButton()
|
|
501
|
+
setConfigButton(false)
|
|
502
|
+
setHideControl(false)
|
|
503
|
+
homebridge.toast.success(total + ' device entr' + (total === 1 ? 'y' : 'ies') + ' removed - press Save to apply.', 'Removed From Config')
|
|
504
|
+
} catch (err) {
|
|
505
|
+
homebridge.toast.error(err.message, 'Error')
|
|
506
|
+
}
|
|
507
|
+
})
|
|
508
|
+
|
|
452
509
|
// ===== End device picker =====
|
|
453
510
|
const hostname = window.location.hostname
|
|
454
511
|
try {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@homebridge-plugins/homebridge-resideo",
|
|
3
3
|
"displayName": "Resideo",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "3.2.0-beta.
|
|
5
|
+
"version": "3.2.0-beta.2",
|
|
6
6
|
"description": "The Resideo plugin allows you to access your Resideo device(s) from HomeKit.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "bwp91",
|