Skip to content

Commit c9cb1f3

Browse files
committed
Add db_count to DeviceResult and update GraphQL response handling; localize Device_NoMatch_Title in multiple languages
1 parent 78a8030 commit c9cb1f3

23 files changed

+35
-6
lines changed

front/devices.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,7 @@ function initializeDatatable (status) {
767767
${_gqlFields}
768768
}
769769
count
770+
db_count
770771
}
771772
}
772773
`;
@@ -807,9 +808,10 @@ function initializeDatatable (status) {
807808
console.log("Raw response:", res);
808809
const json = res["data"];
809810

810-
// Set the total number of records for pagination at the *root level* so DataTables sees them
811-
res.recordsTotal = json.devices.count || 0;
812-
res.recordsFiltered = json.devices.count || 0;
811+
// recordsTotal = raw DB count (before filters/search) so DataTables uses emptyTable
812+
// only when the DB is genuinely empty, and zeroRecords when a filter returns nothing.
813+
res.recordsTotal = json.devices.db_count || 0;
814+
res.recordsFiltered = json.devices.count || 0;
813815

814816
// console.log("recordsTotal:", res.recordsTotal, "recordsFiltered:", res.recordsFiltered);
815817
// console.log("tableRows:", tableRows);
@@ -1049,7 +1051,8 @@ function initializeDatatable (status) {
10491051
// Processing
10501052
'processing' : true,
10511053
'language' : {
1052-
emptyTable: buildEmptyDeviceTableMessage(getString('Device_NextScan_Imminent')),
1054+
emptyTable: buildEmptyDeviceTableMessage(getString('Device_NextScan_Imminent')),
1055+
zeroRecords: "<?= lang('Device_NoMatch_Title');?>",
10531056
"lengthMenu": "<?= lang('Device_Tablelenght');?>",
10541057
"search": "<?= lang('Device_Searchbox');?>: ",
10551058
"paginate": {

front/php/templates/language/ar_ar.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "",
209209
"Device_NoData_Scanning": "",
210210
"Device_NoData_Title": "",
211+
"Device_NoMatch_Title": "",
211212
"Device_Save_Failed": "",
212213
"Device_Save_Unauthorized": "",
213214
"Device_Saved_Success": "",

front/php/templates/language/ca_ca.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "",
209209
"Device_NoData_Scanning": "",
210210
"Device_NoData_Title": "",
211+
"Device_NoMatch_Title": "",
211212
"Device_Save_Failed": "Problemes guardant el dispositiu",
212213
"Device_Save_Unauthorized": "Token invàlid - No autoritzat",
213214
"Device_Saved_Success": "S'ha guardat el dispositiu",

front/php/templates/language/cs_cz.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "",
209209
"Device_NoData_Scanning": "",
210210
"Device_NoData_Title": "",
211+
"Device_NoMatch_Title": "",
211212
"Device_Save_Failed": "",
212213
"Device_Save_Unauthorized": "",
213214
"Device_Saved_Success": "",

front/php/templates/language/de_de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
"Device_NoData_Help": "",
213213
"Device_NoData_Scanning": "",
214214
"Device_NoData_Title": "",
215+
"Device_NoMatch_Title": "",
215216
"Device_Save_Failed": "",
216217
"Device_Save_Unauthorized": "",
217218
"Device_Saved_Success": "Gerät erfolgreich gespeichert",

front/php/templates/language/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "If devices don't appear after the scan, check your SCAN_SUBNETS setting and <a href=\"https://docs.netalertx.com/SUBNETS\" target=\"_blank\">documentation</a>.",
209209
"Device_NoData_Scanning": "Waiting for the first scan - this may take several minutes after the initial setup.",
210210
"Device_NoData_Title": "No devices found yet",
211+
"Device_NoMatch_Title": "No devices match the current filter",
211212
"Device_Save_Failed": "Failed to save device",
212213
"Device_Save_Unauthorized": "Unauthorized - invalid API token",
213214
"Device_Saved_Success": "Device saved successfully",

front/php/templates/language/es_es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@
210210
"Device_NoData_Help": "",
211211
"Device_NoData_Scanning": "",
212212
"Device_NoData_Title": "",
213+
"Device_NoMatch_Title": "",
213214
"Device_Save_Failed": "Fallo al guardar el dispositivo",
214215
"Device_Save_Unauthorized": "No autorizado - Token de API inválido",
215216
"Device_Saved_Success": "Dispositivo guardado exitósamente",

front/php/templates/language/fa_fa.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "",
209209
"Device_NoData_Scanning": "",
210210
"Device_NoData_Title": "",
211+
"Device_NoMatch_Title": "",
211212
"Device_Save_Failed": "",
212213
"Device_Save_Unauthorized": "",
213214
"Device_Saved_Success": "",

front/php/templates/language/fr_fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "Si les appareils n'apparaissent pas après le scan, vérifiez vos paramètres SCAN_SUBNETS et la <a href=\"https://docs.netalertx.com/SUBNETS\" target=\"_blank\">documentation</a>.",
209209
"Device_NoData_Scanning": "En attente du premier scan - cela peut prendre quelques minutes après le premier paramétrage.",
210210
"Device_NoData_Title": "Aucun appareil trouvé pour le moment",
211+
"Device_NoMatch_Title": "",
211212
"Device_Save_Failed": "Erreur à l'enregistrement de l'appareil",
212213
"Device_Save_Unauthorized": "Non autorisé - Jeton d'API invalide",
213214
"Device_Saved_Success": "Appareil enregistré avec succès",

front/php/templates/language/id_id.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
"Device_NoData_Help": "",
209209
"Device_NoData_Scanning": "",
210210
"Device_NoData_Title": "",
211+
"Device_NoMatch_Title": "",
211212
"Device_Save_Failed": "",
212213
"Device_Save_Unauthorized": "",
213214
"Device_Saved_Success": "",

0 commit comments

Comments
 (0)