plugins columns cleanup, devDetail cleanup, better icon selector CUSTPROP

This commit is contained in:
jokob-sk
2025-07-23 22:25:35 +10:00
parent 7d26966250
commit 10a0921e35
51 changed files with 115 additions and 72 deletions

View File

@@ -1042,7 +1042,7 @@ height: 50px;
.myhidden
{
display:none;
display:none !important;
}
.center
@@ -1364,6 +1364,7 @@ input[readonly] {
.iconPreview {
min-width: 40px;
/* display: inherit; */
}
.iconPreview svg{
@@ -1469,6 +1470,11 @@ input[readonly] {
text-align: left;
}
#panDetails .input-group {
min-height: 40px;
}
#devicePageInfoPlc
{
display: none;
@@ -1547,10 +1553,6 @@ input[readonly] {
}
/* #panDetails .dataTables_wrapper .bottom .paging_simple_numbers */
#panDetails #NEWDEV_devIcon
{
display: none;
}
#panDetails #NEWDEV_devCustomProps_label
{
@@ -2023,8 +2025,9 @@ input[readonly] {
.pluginBadge
{
float: right;
margin-right: 3px;
margin-right: 10px;
opacity: 0.6;
margin-top: 4px;
}
.pluginBadgeWrap
@@ -2033,7 +2036,7 @@ input[readonly] {
display: ruby;
z-index: 1;
position: sticky;
margin-top: 1px;
margin-top: 4px;
}
/* -----------------------------------------------------------------------------

View File

@@ -447,7 +447,7 @@ async function renderSmallBoxes() {
"labelLang": "DevDetail_Shortcut_Presence",
"iconId": "deviceEventsIcon",
"iconClass": "fa fa-calendar",
"dataValue": `${deviceData.devPresenceHours}h`
"dataValue": `${deviceData.devPresenceHours ?? 0}h`
},
{
"onclickEvent": "$('#tabEvents').trigger('click');",

View File

@@ -126,9 +126,9 @@
// Group for Children.
DevDetail_Children_Title: {
data: ["devChildrenDynamic"],
docs: "https://github.com/jokob-sk/NetAlertX/blob/main/docs/CUSTOM_PROPERTIES.md",
docs: "https://github.com/jokob-sk/NetAlertX/blob/main/docs/NETWORK_TREE.md",
iconClass: "fa fa-list",
inputGroupClasses: "field-group cutprop-group col-lg-12 col-sm-12 col-xs-12",
inputGroupClasses: "field-group cutprop-group col-lg-6 col-sm-12 col-xs-12",
labelClasses: "col-sm-12 col-xs-12 control-label",
inputClasses: "col-sm-12 col-xs-12 input-group"
},
@@ -137,7 +137,7 @@
data: ["devCustomProps"],
docs: "https://github.com/jokob-sk/NetAlertX/blob/main/docs/CUSTOM_PROPERTIES.md",
iconClass: "fa fa-list",
inputGroupClasses: "field-group cutprop-group col-lg-12 col-sm-12 col-xs-12",
inputGroupClasses: "field-group cutprop-group col-lg-6 col-sm-12 col-xs-12",
labelClasses: "col-sm-12 col-xs-12 control-label",
inputClasses: "col-sm-12 col-xs-12 input-group"
}
@@ -212,15 +212,6 @@
<i class="fa-solid fa-dice" ></i>
</span>`;
}
// handle generate IP for new device
if (setting.setKey == "NEWDEV_devIcon") {
inlineControl += `<span class="input-group-addon pointer"
onclick="showIconSelection()"
title="${getString("Gen_Select")}">
<i class="fa-solid fa-chevron-down" ></i>
</span>`;
}
// handle devChildrenDynamic or NEWDEV_devChildrenNicsDynamic - selected values and options are the same
if (

View File

@@ -1198,6 +1198,9 @@ if (eventsList.length > 0) {
let eventIcon = "fa-play";
switch (event) {
case "select_icon":
eventIcon = "fa-chevron-down";
break;
case "add_icon":
case "add_option":
eventIcon = "fa-square-plus";

View File

@@ -323,8 +323,12 @@ function execute_settingEvent(element) {
() => addIconAsBase64(element), // Wrap in an arrow function
feSourceId // triggered by id
);
} else if (["copy_icons"].includes(feEvent)) {
} else if (["select_icon"].includes(feEvent)) {
showIconSelection(feSetKey)
// myparam-setkey
} else if (["copy_icons"].includes(feEvent)) {
// Ask overwrite icon types
showModalWarning (
@@ -449,10 +453,11 @@ function addIconAsBase64 (el) {
}
// -----------------------------------------------
// modal pop up for icon selection
function showIconSelection(setKey) {
function showIconSelection() {
const selectElement = document.getElementById('NEWDEV_devIcon');
const selectElement = document.getElementById(setKey);
const modalId = 'dynamicIconModal';
// Create modal HTML dynamically
@@ -560,7 +565,10 @@ function getColumnNameFromLangString(headStringKey) {
"Device_TableHead_SourcePlugin": "devSourcePlugin",
"Device_TableHead_PresentLastScan": "devPresentLastScan",
"Device_TableHead_AlertDown": "devAlertDown",
"Device_TableHead_CustomProps": "devCustomProps"
"Device_TableHead_CustomProps": "devCustomProps",
"Device_TableHead_FQDN": "devFQDN",
"Device_TableHead_ParentRelType": "devParentRelType",
"Device_TableHead_ReqNicsOnline": "devReqNicsOnline"
};
return columnNameMap[headStringKey] || "";

View File

@@ -167,7 +167,7 @@
const paneHtml = `
<div class="tab-pane box box-aqua box-body ${i === 0 ? 'active' : ''}" id="${id}">
<h2 class="page-header"><i class="fa fa-server"></i> ${getString('Network_Node')}</h2>
<h5><i class="fa fa-server"></i> ${getString('Network_Node')}</h5>
<div class="mb-3 row">
<label class="col-sm-3 col-form-label fw-bold">${getString('Network_Node')}</label>
@@ -201,12 +201,13 @@
${isRootNode ? '' : `</a>`}
</div>
</div>
<hr/>
<div class="box box-aqua box-body" id="connected">
<h3 class="page-header">
<h5>
<i class="fa fa-sitemap fa-rotate-270"></i>
${getString('Network_Connected')}
</h3>
</h5>
<div id="leafs_${id}"></div>
</div>
</div>
@@ -326,7 +327,7 @@
<div class="content">
<div id="unassignedDevices" class="box box-aqua box-body">
<section>
<h3><i class="fa-solid fa-plug-circle-xmark"></i> ${getString('Network_UnassignedDevices')}</h3>
<h5><i class="fa-solid fa-plug-circle-xmark"></i> ${getString('Network_UnassignedDevices')}</h5>
<table id="unassignedDevicesTable" class="table table-striped" width="100%"></table>
</section>
</div>

View File

@@ -726,6 +726,7 @@
"report_select_format": "اختر تنسيق التقرير",
"report_time": "وقت التقرير",
"run_event_tooltip": "تلميح تشغيل الحدث",
"select_icon_event_tooltip": "",
"settings_core_icon": "أيقونة الإعدادات الأساسية",
"settings_core_label": "تسمية الإعدادات الأساسية",
"settings_device_scanners": "ماسحات الأجهزة",

View File

@@ -726,6 +726,7 @@
"report_select_format": "Seleccioneu Format:",
"report_time": "Data de recepció:",
"run_event_tooltip": "Habiliteu la configuració i deseu els canvis al principi abans d'executar-lo.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Nucli",
"settings_device_scanners": "Escàners de dispositius utilitzats per descobrir dispositius que escriuen a la taula de base de dades CurrentScan.",

View File

@@ -726,6 +726,7 @@
"report_select_format": "",
"report_time": "",
"run_event_tooltip": "",
"select_icon_event_tooltip": "",
"settings_core_icon": "",
"settings_core_label": "",
"settings_device_scanners": "",

View File

@@ -807,6 +807,7 @@
"report_select_format": "Format auswählen:",
"report_time": "Benachrichtigungszeit:",
"run_event_tooltip": "Aktiviere die Einstellung und speichere deine Änderungen, bevor du sie ausführst.",
"select_icon_event_tooltip": "",
"settings_core_icon": "",
"settings_core_label": "Kern",
"settings_device_scanners": "",

View File

@@ -726,6 +726,7 @@
"report_select_format": "Select Format:",
"report_time": "Notification time:",
"run_event_tooltip": "Enable the setting and save your changes at first before you run it.",
"select_icon_event_tooltip": "Select icon",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Core",
"settings_device_scanners": "Device scanners used to discover devices that write into the CurrentScan database table.",

View File

@@ -805,6 +805,7 @@
"report_select_format": "Selecciona el formato:",
"report_time": "Hora de la notificación:",
"run_event_tooltip": "Activa el ajuste y guarda tus cambios antes de ejecutarlo.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Núcleo",
"settings_device_scanners": "Los escáneres de los dispositivos se utilizan para descubrir dispositivos que escriben en la tabla de base de datos de CurrentScan.",

3
front/php/templates/language/fr_fr.json Normal file → Executable file
View File

@@ -726,6 +726,7 @@
"report_select_format": "Sélectionner un format:",
"report_time": "Heure de la notification:",
"run_event_tooltip": "Activez le paramètre et enregistrez vos changements avant de le lancer.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Principal",
"settings_device_scanners": "Les scanners d'appareils utilisés pour découvrir des appareils, qui écrivent dans la table CurrentScan (scan actuel) de la base de données.",
@@ -753,4 +754,4 @@
"settings_system_label": "Système",
"settings_update_item_warning": "Mettre à jour la valeur ci-dessous. Veillez à bien suivre le même format qu'auparavant. <b>Il n'y a pas de pas de contrôle.</b>",
"test_event_tooltip": "Enregistrer d'abord vos modifications avant de tester vôtre paramétrage."
}
}

View File

@@ -726,6 +726,7 @@
"report_select_format": "Seleziona formato:",
"report_time": "Orario notifica:",
"run_event_tooltip": "Abilita l'impostazione e salva le modifiche prima di eseguirla.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Core",
"settings_device_scanners": "Scanner dei dispositivi utilizzati per rilevare i dispositivi che scrivono nella tabella del database CurrentScan.",

View File

@@ -726,6 +726,7 @@
"report_select_format": "Velg format:",
"report_time": "Notifikasjonstid:",
"run_event_tooltip": "Aktiver innstillingen og lagre endringene først før du kjører den.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Core",
"settings_device_scanners": "Enhets-skannere som brukes til å oppdage enheter som skrives inn i CurrentScan databasetabellen.",

View File

@@ -726,6 +726,7 @@
"report_select_format": "Wybierz format:",
"report_time": "Czas powiadomienia:",
"run_event_tooltip": "Najpierw włącz to ustawienie i zapisz zmiany, zanim je uruchomisz.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Główne",
"settings_device_scanners": "Skanery urządzeń używane do wykrywania urządzeń, które zapisują dane w tabeli bazy danych CurrentScan.",

View File

@@ -726,6 +726,7 @@
"report_select_format": "",
"report_time": "",
"run_event_tooltip": "",
"select_icon_event_tooltip": "",
"settings_core_icon": "",
"settings_core_label": "",
"settings_device_scanners": "",

View File

@@ -726,6 +726,7 @@
"report_select_format": "Выбрать формат:",
"report_time": "Время уведомления:",
"run_event_tooltip": "Включите настройку и сначала сохраните изменения, прежде чем запускать ее.",
"select_icon_event_tooltip": "",
"settings_core_icon": "fa-solid fa-gem",
"settings_core_label": "Основные",
"settings_device_scanners": "Сканеры устройств, используемые для обнаружения устройств, записывающих данные в таблицу базы данных CurrentScan.",

View File

@@ -726,6 +726,7 @@
"report_select_format": "",
"report_time": "Bildirim zamanı:",
"run_event_tooltip": "",
"select_icon_event_tooltip": "",
"settings_core_icon": "",
"settings_core_label": "",
"settings_device_scanners": "",

3
front/php/templates/language/uk_ua.json Normal file → Executable file
View File

@@ -726,6 +726,7 @@
"report_select_format": "Виберіть формат:",
"report_time": "Час сповіщення:",
"run_event_tooltip": "Увімкніть налаштування та збережіть зміни, перш ніж запускати його.",
"select_icon_event_tooltip": "",
"settings_core_icon": "фа-твердий фа-самоцвіт",
"settings_core_label": "Ядро",
"settings_device_scanners": "Сканери пристроїв, які використовуються для виявлення пристроїв, які записують дані в таблицю бази даних CurrentScan.",
@@ -753,4 +754,4 @@
"settings_system_label": "Система",
"settings_update_item_warning": "Оновіть значення нижче. Слідкуйте за попереднім форматом. <b>Перевірка не виконана.</b>",
"test_event_tooltip": "Перш ніж перевіряти налаштування, збережіть зміни."
}
}

View File

@@ -726,6 +726,7 @@
"report_select_format": "选择格式:",
"report_time": "通知时间:",
"run_event_tooltip": "在运行之前,请先启用设置并保存更改。",
"select_icon_event_tooltip": "",
"settings_core_icon": "",
"settings_core_label": "核",
"settings_device_scanners": "设备扫描器用于发现写入当前扫描数据库表的设备。",

View File

@@ -453,7 +453,7 @@
"value": "Example Plugin"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -134,7 +134,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-2",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",

View File

@@ -134,7 +134,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-2",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",

View File

@@ -96,7 +96,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-3",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",

View File

@@ -96,7 +96,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-3",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",

View File

@@ -96,7 +96,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-3",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",

View File

@@ -130,7 +130,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-2",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",

View File

@@ -96,7 +96,7 @@
},
{
"column": "Watched_Value1",
"css_classes": "col-sm-3",
"css_classes": "col-sm-1",
"show": true,
"type": "eval",
"default_value": "",
@@ -116,7 +116,7 @@
},
{
"column": "Watched_Value2",
"css_classes": "col-sm-2",
"css_classes": "col-sm-3",
"show": true,
"type": "textarea_readonly",
"default_value": "",
@@ -131,7 +131,7 @@
},
{
"column": "Watched_Value3",
"css_classes": "col-sm-2",
"css_classes": "col-sm-3",
"show": true,
"type": "textarea_readonly",
"default_value": "",

View File

@@ -468,7 +468,7 @@
"value": "ARPSCAN"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -492,7 +492,7 @@
"value": "ASUSWRT"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -284,7 +284,7 @@
{
"column": "Watched_Value1",
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -28,6 +28,9 @@
"settings": [
{
"function": "icon",
"events": [
"select_icon"
],
"type": {
"dataType": "array",
"elements": [

View File

@@ -607,7 +607,7 @@
"value": "DDNS"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -437,7 +437,7 @@
"value": "Freebox"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -365,7 +365,7 @@
"value": "ICMP"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -548,7 +548,7 @@
"value": "INTRNT"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -335,7 +335,7 @@
"value": "IPNEIGH"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -491,7 +491,7 @@
"value": "LUCIRPC"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -292,7 +292,7 @@
{
"column": "Watched_Value1",
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -562,7 +562,8 @@
"function": "devIcon",
"events": [
"copy_icons",
"add_icon"
"add_icon",
"select_icon"
],
"type": {
"dataType": "string",
@@ -587,7 +588,7 @@
"elementHasInputValue": 1,
"elementOptions": [
{
"cssClasses": "iconInputVal"
"cssClasses": "iconInputVal myhidden"
},
{
"onChange": "updateIconPreview(this)"
@@ -1624,7 +1625,7 @@
"elementHasInputValue": 1,
"elementOptions": [
{
"cssClasses": "iconInputVal"
"cssClasses": "iconInputVal myhidden"
},
{
"onChange": "updateIconPreview(this)"

View File

@@ -508,7 +508,7 @@
"value": "NMAPDEV"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -284,7 +284,7 @@
{
"column": "Watched_Value1",
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -620,7 +620,7 @@
"value": "OMDSDN"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -426,7 +426,7 @@
"value": "PIHOLE"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -279,7 +279,7 @@
"value": "SNMPDSC"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -587,7 +587,7 @@
"value": "sync"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -456,7 +456,8 @@
"Device_TableHead_SyncHubNodeName",
"Device_TableHead_NetworkSite",
"Device_TableHead_SSID",
"Device_TableHead_SourcePlugin"
"Device_TableHead_SourcePlugin",
"Device_TableHead_ParentRelType"
],
"localized": ["name", "description"],
"name": [

View File

@@ -355,7 +355,7 @@
}
],
"options": [],
"show": true,
"show": false,
"type": "label"
},
{

View File

@@ -462,7 +462,7 @@
"value": "VNDRPDT"
},
"css_classes": "col-sm-2",
"show": true,
"show": false,
"type": "label",
"default_value": "",
"options": [],

View File

@@ -523,12 +523,14 @@ function shouldBeShown(entry, pluginObj)
plugPrefix = ''
dbTable = ''
// --------------------------------------------------------
function purgeAll(callback) {
plugPrefix = arguments[0]; // plugin prefix
dbTable = arguments[1]; // DB table
// Ask
showModalWarning('<?= lang('Gen_Purge');?>' + ' ' + plugPrefix + ' ' + dbTable , '<?= lang('Gen_AreYouSure');?>',
'<?= lang('Gen_Cancel');?>', '<?= lang('Gen_Okay');?>', "purgeAllExecute");
// Ask for confirmation
showModalWarning(`${getString('Gen_Purge')} ${plugPrefix} ${dbTable}`, `${getString('Gen_AreYouSure')}`,
`${getString('Gen_Cancel')}`, `${getString('Gen_Okay')}`, "purgeAllExecute");
}
// --------------------------------------------------------
@@ -544,22 +546,37 @@ function purgeAllExecute() {
}
// --------------------------------------------------------
function deleteListed(plugPrefix, dbTable) {
function deleteListed(plugPrefixArg, dbTableArg) {
plugPrefix = plugPrefixArg;
dbTable = dbTableArg;
idArr = $(`#${plugPrefix} table[data-my-dbtable="${dbTable}"] tr[data-my-index]`).map(function(){return $(this).attr("data-my-index");}).get();
// Collect selected IDs
idArr = $(`#${plugPrefix} table[data-my-dbtable="${dbTable}"] tr[data-my-index]`)
.map(function() {
return $(this).attr("data-my-index");
}).get();
console.log(idArr);
if (idArr.length === 0) {
showModalOk('Nothing to delete', 'No items are selected for deletion.');
return;
}
// Ask for confirmation
showModalWarning(`${getString('Gen_Purge')} ${plugPrefix} ${dbTable}`, `${getString('Gen_AreYouSure')} (${idArr.length})`,
`${getString('Gen_Cancel')}`, `${getString('Gen_Okay')}`, "deleteListedExecute");
}
// --------------------------------------------------------
function deleteListedExecute() {
$.ajax({
method: "POST",
url: "php/server/dbHelper.php",
data: { action: "delete", dbtable: dbTable, columnName: 'Index', id:idArr.toString() },
success: function(data, textStatus) {
updateApi("plugins_objects")
showModalOk ('Result', data );
showModalOk('Result', data);
}
})
}