@homebridge-plugins/homebridge-ewelink 12.17.0 → 12.18.0-beta.0
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 +6 -0
- package/lib/homebridge-ui/public/index.html +64 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@homebridge-plugins/homebridge-ewelink` will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## v12.18.0 (Pending Release)
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- feat(ui): add a remove all devices action to the my devices tab
|
|
10
|
+
|
|
5
11
|
## v12.17.0 (2026-07-25)
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
@@ -113,6 +113,17 @@
|
|
|
113
113
|
</button>
|
|
114
114
|
</div>
|
|
115
115
|
</li>
|
|
116
|
+
<li class="list-group-item">
|
|
117
|
+
<div class="d-flex justify-content-between align-items-center">
|
|
118
|
+
<div class="pr-2">
|
|
119
|
+
<div>Remove All Devices</div>
|
|
120
|
+
<div class="text-muted action-desc" id="removeAllText">Remove every device from the plugin config.</div>
|
|
121
|
+
</div>
|
|
122
|
+
<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">
|
|
123
|
+
<i aria-hidden="true" class="fas fa-arrow-right"></i>
|
|
124
|
+
</button>
|
|
125
|
+
</div>
|
|
126
|
+
</li>
|
|
116
127
|
<li class="list-group-item">
|
|
117
128
|
<div class="d-flex justify-content-between align-items-center">
|
|
118
129
|
<div class="pr-2">
|
|
@@ -269,6 +280,7 @@
|
|
|
269
280
|
let pickerAccessories = []
|
|
270
281
|
let pickerUiidMap = {}
|
|
271
282
|
let removeConfirmTimer
|
|
283
|
+
let removeAllConfirmTimer
|
|
272
284
|
|
|
273
285
|
// The action buttons always show the settings-page arrow; the row text
|
|
274
286
|
// (and the button's aria-label) says what the arrow will do
|
|
@@ -476,6 +488,58 @@
|
|
|
476
488
|
homebridge.toast.error(err.message, 'Error')
|
|
477
489
|
}
|
|
478
490
|
})
|
|
491
|
+
const resetRemoveAllButton = () => {
|
|
492
|
+
const btn = document.getElementById('removeAllBtn')
|
|
493
|
+
clearTimeout(removeAllConfirmTimer)
|
|
494
|
+
delete btn.dataset.confirm
|
|
495
|
+
btn.classList.remove('btn-danger')
|
|
496
|
+
btn.classList.add('btn-primary')
|
|
497
|
+
btn.innerHTML = actionArrow
|
|
498
|
+
btn.setAttribute('aria-label', 'Remove all devices from the config')
|
|
499
|
+
document.getElementById('removeAllText').innerHTML = 'Remove every device from the plugin config.'
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
document.getElementById('removeAllBtn').addEventListener('click', async () => {
|
|
503
|
+
try {
|
|
504
|
+
const btn = document.getElementById('removeAllBtn')
|
|
505
|
+
const blocks = await getConfigBlocks()
|
|
506
|
+
const config = blocks[0]
|
|
507
|
+
let total = 0
|
|
508
|
+
deviceArrays.forEach((key) => {
|
|
509
|
+
if (Array.isArray(config[key])) {
|
|
510
|
+
total += config[key].length
|
|
511
|
+
}
|
|
512
|
+
})
|
|
513
|
+
if (total === 0) {
|
|
514
|
+
resetRemoveAllButton()
|
|
515
|
+
homebridge.toast.info('There are no devices in the config.', 'Nothing To Remove')
|
|
516
|
+
return
|
|
517
|
+
}
|
|
518
|
+
if (btn.dataset.confirm !== 'yes') {
|
|
519
|
+
// Removing everything always asks for a second click, since any
|
|
520
|
+
// settings on the entries would be lost
|
|
521
|
+
btn.dataset.confirm = 'yes'
|
|
522
|
+
btn.classList.remove('btn-primary')
|
|
523
|
+
btn.classList.add('btn-danger')
|
|
524
|
+
btn.innerHTML = actionArrow
|
|
525
|
+
btn.setAttribute('aria-label', 'Confirm removing all devices from the config')
|
|
526
|
+
document.getElementById('removeAllText').innerHTML = 'Any settings on these entries will be lost. Click again to remove all ' + total + (total === 1 ? ' entry.' : ' entries.')
|
|
527
|
+
removeAllConfirmTimer = setTimeout(resetRemoveAllButton, 5000)
|
|
528
|
+
return
|
|
529
|
+
}
|
|
530
|
+
deviceArrays.forEach((key) => {
|
|
531
|
+
delete config[key]
|
|
532
|
+
})
|
|
533
|
+
await homebridge.updatePluginConfig(blocks)
|
|
534
|
+
resetRemoveAllButton()
|
|
535
|
+
setConfigButton(false)
|
|
536
|
+
setHideControl(false)
|
|
537
|
+
homebridge.toast.success(total + ' device entr' + (total === 1 ? 'y' : 'ies') + ' removed - press Save to apply.', 'Removed From Config')
|
|
538
|
+
} catch (err) {
|
|
539
|
+
homebridge.toast.error(err.message, 'Error')
|
|
540
|
+
}
|
|
541
|
+
})
|
|
542
|
+
|
|
479
543
|
// ===== End device picker =====
|
|
480
544
|
showIntro = () => {
|
|
481
545
|
homebridge.disableSaveButton?.()
|
package/package.json
CHANGED