diff --git a/docs/ICONS.md b/docs/ICONS.md
index 989ecd2d..b8cc92f2 100755
--- a/docs/ICONS.md
+++ b/docs/ICONS.md
@@ -29,11 +29,11 @@ Copying the HTML code from [Font Awesome](https://fontawesome.com/search?o=r&m=f

-3. Paste in the copied HTML or SVG code.
+3. Paste in the copied HTML or SVG code and click "OK":
-4. Click "OK"
+
-5. "Save" the device
+6. "Save" the device
> [!NOTE]
> If you want to mass-apply an icon to all devices of the same device type (Field: Type), you can click the mass-copy button (next to the "+" button). A confirmation prompt is displayed. If you proceed, icons of all devices set to the same device type as the current device, will be overwritten with the current device's icon.
diff --git a/docs/img/ICONS/paste-svg.png b/docs/img/ICONS/paste-svg.png
new file mode 100755
index 00000000..1c732529
Binary files /dev/null and b/docs/img/ICONS/paste-svg.png differ
diff --git a/front/deviceDetails.php b/front/deviceDetails.php
index fa8be620..9a5c560e 100755
--- a/front/deviceDetails.php
+++ b/front/deviceDetails.php
@@ -748,28 +748,13 @@ function main () {
// Show device icon as it changes
$('#txtIcon').on('change input', function() {
- updateIconPreview()
+ updateIconPreview('#txtIcon')
});
}
-// -----------------------------------------------------------------------------
-function updateIconPreview () {
- // update icon
- iconInput = $('#txtIcon')
-
- value = iconInput.val()
-
- iconInput.on('change input', function() {
- $('#txtIconFA').html(atob(value))
- });
-
- $('#txtIconFA').html(atob(value))
-
-}
-
// -----------------------------------------------------------------------------
function initializeTabs () {
// Activate panel
@@ -839,12 +824,12 @@ function initializeCombos () {
// nameTransformer) // callback to transform name
- initSettingDropdown("NEWDEV_dev_Icon", [], "dropdownIcon_tmp", genDevDetailsList, 'txtIcon', atob )
- initSettingDropdown("NEWDEV_dev_DeviceType", [], "dropdownDeviceType_tmp", genDevDetailsList, 'txtDeviceType' )
- initSettingDropdown("NEWDEV_dev_Owner", [], "dropdownOwner_tmp", genDevDetailsList, 'txtOwner' )
- initSettingDropdown("NEWDEV_dev_Group", [], "dropdownGroup_tmp", genDevDetailsList, 'txtGroup' )
- initSettingDropdown("NEWDEV_dev_Location", [], "dropdownLocation_tmp", genDevDetailsList, 'txtLocation' )
- initSettingDropdown("NEWDEV_dev_Network_Node_MAC_ADDR", [], "dropdownNetworkNodeMac_tmp", genDevDetailsList, 'txtNetworkNodeMac' )
+ initSettingDropdown("NEWDEV_dev_Icon", [], "dropdownIcon_tmp", genListWithInputSet, 'txtIcon', atob )
+ initSettingDropdown("NEWDEV_dev_DeviceType", [], "dropdownDeviceType_tmp", genListWithInputSet, 'txtDeviceType' )
+ initSettingDropdown("NEWDEV_dev_Owner", [], "dropdownOwner_tmp", genListWithInputSet, 'txtOwner' )
+ initSettingDropdown("NEWDEV_dev_Group", [], "dropdownGroup_tmp", genListWithInputSet, 'txtGroup' )
+ initSettingDropdown("NEWDEV_dev_Location", [], "dropdownLocation_tmp", genListWithInputSet, 'txtLocation' )
+ initSettingDropdown("NEWDEV_dev_Network_Node_MAC_ADDR", [], "dropdownNetworkNodeMac_tmp", genListWithInputSet, 'txtNetworkNodeMac' )
// Initialize static combos
initializeComboSkipRepeated ();
@@ -1155,7 +1140,7 @@ function initializeCalendar () {
showSpinner()
} else {
setTimeout(() => {
- updateIconPreview()
+ updateIconPreview('#txtIcon')
}, 100);
hideSpinner()
@@ -1673,7 +1658,7 @@ function addAsBase64 () {
$('#txtIcon').val(iconHtmlBase64);
- updateIconPreview()
+ updateIconPreview('#txtIcon')
}
diff --git a/front/js/ui_components.js b/front/js/ui_components.js
index 018580d4..d50e0c39 100755
--- a/front/js/ui_components.js
+++ b/front/js/ui_components.js
@@ -186,13 +186,25 @@ function hideUIelements(settingKey) {
// -----------------------------------------------------------------------------
// Processor to generate options for a dropdown menu
-function generateDropdownOptions(data, valuesArray) {
+function generateDropdownOptions(data, valuesArray, targetField, nameTransformer) {
var optionsHtml = "";
data.forEach(function(item) {
+ labelName = item.name
+
+ // console.log(nameTransformer);
+ // console.log(labelName);
+
+ // if(nameTransformer && nameTransformer != '' && labelName != '❌None')
+ // {
+ // console.log(labelName);
+ // labelName = nameTransformer(labelName)
+ // console.log(labelName);
+ // }
+
let selected = valuesArray.includes(item.id) ? 'selected' : '';
- optionsHtml += ``;
+ optionsHtml += ``;
});
return `${optionsHtml}`;
}
@@ -200,21 +212,28 @@ function generateDropdownOptions(data, valuesArray) {
// -----------------------------------------------------------------------------
// Processor to generate a list
-function generateList(data, valuesArray) {
+function generateList(data, valuesArray, targetField, nameTransformer) {
var listHtml = "";
data.forEach(function(item) {
+ labelName = item.name
+
+ if(nameTransformer && nameTransformer != '' && labelName != '❌None')
+ {
+ labelName = nameTransformer(labelName)
+ }
+
let selected = valuesArray.includes(item.id) ? 'selected' : '';
- listHtml += `
${item.name}`;
+ listHtml += `${labelName}`;
});
return listHtml;
}
// -----------------------------------------------------------------------------
-// Processor to generate a list in teh deviceDetails page
-function genDevDetailsList(data, valuesArray, targetField, nameTransformer) {
+// Processor to generate a list in the deviceDetails page
+function genListWithInputSet(data, valuesArray, targetField, nameTransformer) {
var listHtml = "";
@@ -227,7 +246,7 @@ function genDevDetailsList(data, valuesArray, targetField, nameTransformer) {
labelName = item.name
- if(nameTransformer && labelName != '❌None')
+ if(nameTransformer && nameTransformer != '' && labelName != '❌None')
{
labelName = nameTransformer(labelName)
}
@@ -242,7 +261,21 @@ function genDevDetailsList(data, valuesArray, targetField, nameTransformer) {
}
+// -----------------------------------------------------------------------------
+// Updates the icon preview
+function updateIconPreview (inputId) {
+ // update icon
+ iconInput = $(inputId)
+ value = iconInput.val()
+
+ iconInput.on('change input', function() {
+ $('#txtIconFA').html(atob(value))
+ });
+
+ $('#txtIconFA').html(atob(value))
+
+}
// -----------------------------------------------------------------------------
// initialize
diff --git a/front/multiEditCore.php b/front/multiEditCore.php
index 0f797410..7c78f2b8 100755
--- a/front/multiEditCore.php
+++ b/front/multiEditCore.php
@@ -105,8 +105,7 @@
default:
inputType = 'text';
break;
- }
-
+ }
if (inputType === 'text.select') {
@@ -114,12 +113,30 @@
initSettingDropdown(columns[j].Code_Name, [], targetLocation, generateDropdownOptions)
- input = `