Docs, Mass-delete 📚

This commit is contained in:
Jokob-sk
2024-02-28 21:03:27 +11:00
parent 84f96d72c8
commit 9685784452
19 changed files with 449 additions and 354 deletions

View File

@@ -357,7 +357,7 @@ function handle_locked_DB(data)
{
if(data.includes('database is locked'))
{
console.log(data)
// console.log(data)
showSpinner()
setTimeout(function() {
@@ -722,7 +722,7 @@ function initDeviceListAll_JSON()
$.get('api/table_devices.json', function(data) {
console.log(data)
// console.log(data)
devicesListAll_JSON = data["data"]
@@ -817,6 +817,9 @@ function updateApi()
})
}
// -----------------------------------------------------------------------------
// initialize
// -----------------------------------------------------------------------------

View File

@@ -17,21 +17,14 @@ function initDeviceSelectors() {
// Retrieve device list from session variable
var devicesListAll_JSON = sessionStorage.getItem('devicesListAll_JSON');
console.log(devicesListAll_JSON)
var devicesList = JSON.parse(devicesListAll_JSON);
console.log(devicesList)
// Check if both device list exists
if (devicesListAll_JSON) {
// Parse the JSON string to get the device list array
var devicesList = JSON.parse(devicesListAll_JSON);
console.log(devicesList)
var selectorFieldsHTML = ''
// Loop through the devices list
@@ -83,6 +76,37 @@ function initDeviceSelectors() {
}
// --------------------------------------------------------
//Initialize Select2 Elements and make them sortable
$(function () {
// Iterate over each Select2 dropdown
$('.select2').each(function() {
var selectEl = $(this).select2();
// Apply sortable functionality to the dropdown's dropdown-container
selectEl.next().children().children().children().sortable({
containment: 'parent',
update: function () {
var sortedValues = $(this).children().map(function() {
return $(this).attr('title');
}).get();
var sortedOptions = selectEl.find('option').sort(function(a, b) {
return sortedValues.indexOf($(a).text()) - sortedValues.indexOf($(b).text());
});
// Replace all options in selectEl
selectEl.empty().append(sortedOptions);
// Trigger change event on Select2
selectEl.trigger('change');
}
});
});
});
// -----------------------------------------------------------------------------
// initialize
// -----------------------------------------------------------------------------