@homebridge-plugins/homebridge-govee 11.32.0-beta.8 → 11.32.0-beta.9
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/lib/homebridge-ui/public/index.html +63 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,7 @@ All notable changes to `@homebridge-plugins/homebridge-govee` will be documented
|
|
|
11
11
|
- chore(deps): dependency updates
|
|
12
12
|
- style(ui): standardise the custom ui layout and sync the support tab with the readme
|
|
13
13
|
- chore(deps): override help-me to v5 to clear the high brace-expansion security advisory from the aws-iot dependency chain
|
|
14
|
+
- feat(ui): add a remove all devices action to the my devices tab (#1323)
|
|
14
15
|
|
|
15
16
|
## v11.31.0 (2026-07-24)
|
|
16
17
|
|
|
@@ -105,6 +105,17 @@
|
|
|
105
105
|
</button>
|
|
106
106
|
</div>
|
|
107
107
|
</li>
|
|
108
|
+
<li class="list-group-item">
|
|
109
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
110
|
+
<div class="pr-2">
|
|
111
|
+
<div>Remove All Devices</div>
|
|
112
|
+
<div class="text-muted action-desc" id="removeAllText">Remove every device from the plugin config.</div>
|
|
113
|
+
</div>
|
|
114
|
+
<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">
|
|
115
|
+
<i aria-hidden="true" class="fas fa-arrow-right"></i>
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
</li>
|
|
108
119
|
<li class="list-group-item">
|
|
109
120
|
<div class="d-flex justify-content-between align-items-center">
|
|
110
121
|
<div class="pr-2">
|
|
@@ -308,6 +319,7 @@
|
|
|
308
319
|
let pickerAccessories = []
|
|
309
320
|
let pickerModelMap = {}
|
|
310
321
|
let removeConfirmTimer
|
|
322
|
+
let removeAllConfirmTimer
|
|
311
323
|
|
|
312
324
|
// Compare device ids ignoring case, colons and underscores, so an entry
|
|
313
325
|
// typed by hand in a different format still counts as the same device
|
|
@@ -508,6 +520,57 @@
|
|
|
508
520
|
homebridge.toast.error(err.message, 'Error')
|
|
509
521
|
}
|
|
510
522
|
})
|
|
523
|
+
const resetRemoveAllButton = () => {
|
|
524
|
+
const btn = document.getElementById('removeAllBtn')
|
|
525
|
+
clearTimeout(removeAllConfirmTimer)
|
|
526
|
+
delete btn.dataset.confirm
|
|
527
|
+
btn.classList.remove('btn-danger')
|
|
528
|
+
btn.classList.add('btn-primary')
|
|
529
|
+
btn.innerHTML = actionArrow
|
|
530
|
+
btn.setAttribute('aria-label', 'Remove all devices from the config')
|
|
531
|
+
document.getElementById('removeAllText').innerHTML = 'Remove every device from the plugin config.'
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
document.getElementById('removeAllBtn').addEventListener('click', async () => {
|
|
535
|
+
try {
|
|
536
|
+
const btn = document.getElementById('removeAllBtn')
|
|
537
|
+
const blocks = await getConfigBlocks()
|
|
538
|
+
const config = blocks[0]
|
|
539
|
+
let total = 0
|
|
540
|
+
deviceArrayKeys.forEach((key) => {
|
|
541
|
+
if (Array.isArray(config[key])) {
|
|
542
|
+
total += config[key].length
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
if (total === 0) {
|
|
546
|
+
resetRemoveAllButton()
|
|
547
|
+
homebridge.toast.info('There are no devices in the config.', 'Nothing To Remove')
|
|
548
|
+
return
|
|
549
|
+
}
|
|
550
|
+
if (btn.dataset.confirm !== 'yes') {
|
|
551
|
+
// Removing everything always asks for a second click, since any
|
|
552
|
+
// settings on the entries would be lost
|
|
553
|
+
btn.dataset.confirm = 'yes'
|
|
554
|
+
btn.classList.remove('btn-primary')
|
|
555
|
+
btn.classList.add('btn-danger')
|
|
556
|
+
btn.innerHTML = actionArrow
|
|
557
|
+
btn.setAttribute('aria-label', 'Confirm removing all devices from the config')
|
|
558
|
+
document.getElementById('removeAllText').innerHTML = 'Any settings on these entries will be lost. Click again to remove all ' + total + (total === 1 ? ' entry.' : ' entries.')
|
|
559
|
+
removeAllConfirmTimer = setTimeout(resetRemoveAllButton, 5000)
|
|
560
|
+
return
|
|
561
|
+
}
|
|
562
|
+
deviceArrayKeys.forEach((key) => {
|
|
563
|
+
delete config[key]
|
|
564
|
+
})
|
|
565
|
+
await homebridge.updatePluginConfig(blocks)
|
|
566
|
+
resetRemoveAllButton()
|
|
567
|
+
setConfigButton(false)
|
|
568
|
+
setHideControl(false)
|
|
569
|
+
homebridge.toast.success(total + ' device entr' + (total === 1 ? 'y' : 'ies') + ' removed - press Save to apply.', 'Removed From Config')
|
|
570
|
+
} catch (err) {
|
|
571
|
+
homebridge.toast.error(err.message, 'Error')
|
|
572
|
+
}
|
|
573
|
+
})
|
|
511
574
|
// ===== End device picker =====
|
|
512
575
|
|
|
513
576
|
showIntro = () => {
|
package/package.json
CHANGED