FE: add clear sources functionality in multi-edit

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2026-02-02 15:59:53 +11:00
parent 6d03d58c78
commit b45804f177
21 changed files with 92 additions and 11 deletions

View File

@@ -70,6 +70,12 @@
</div>
<div class="col-md-10"><?= lang('Maintenance_Tool_del_unlockFields_selecteddev_text');?></div>
</div>
<div class="col-md-12">
<div class="col-md-2" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red" id="btnClearSourceFields" onclick="askClearSourceFields()"><?= lang('Maintenance_Tool_clearSourceFields_selected');?></button>
</div>
<div class="col-md-10"><?= lang('Maintenance_Tool_clearSourceFields_selected_text');?></div>
</div>
</div>
</div>
</div>
@@ -436,6 +442,18 @@ function askUnlockFieldsSelected () {
'unlockFieldsSelected');
}
// -----------------------------------------------------------------------------
// Ask to unlock fields of selected devices
function askClearSourceFields () {
// Ask
showModalWarning(
getString('Maintenance_Tool_clearSourceFields_selected_noti'),
getString('Gen_AreYouSure'),
getString('Gen_Cancel'),
getString('Gen_Okay'),
()=>unlockFieldsSelected(null, true));
}
// -----------------------------------------------------------------------------
// Unlock fields for selected devices
function unlockFieldsSelected(fields = null, clearAll = false) {
@@ -443,6 +461,7 @@ function unlockFieldsSelected(fields = null, clearAll = false) {
const macs_tmp = selectorMacs(); // returns array of MACs
console.log(macs_tmp);
console.log(clearAll);
if (!macs_tmp || macs_tmp == "" || macs_tmp.length === 0) {
@@ -461,7 +480,7 @@ function unlockFieldsSelected(fields = null, clearAll = false) {
const payload = {
mac: macsArray, // array of MACs for backend
fields: fields, // null for all tracked fields
clear_all: clearAll // true to clear all sources, false to clear only LOCKED/USER
clearAll: clearAll // true to clear all sources, false to clear only LOCKED/USER
};
$.ajax({