From 65d7726d5b5788be53b2820d37aef442e26a7148 Mon Sep 17 00:00:00 2001 From: Manuel Ceroni <46685230+manuelceroni@users.noreply.github.com> Date: Tue, 3 Feb 2026 12:25:46 +0100 Subject: [PATCH] Various fixes to exporter sites (#9994) * Removed the edit and delete options for the default exporter site * Changed the validation criteria for exporter sites --- http_src/vue/modal-edit-exporter-site.vue | 3 +++ http_src/vue/page-exporter-sites.vue | 20 ++++++++++++++++---- scripts/locales/en.lua | 1 + scripts/lua/modules/http_lint.lua | 2 ++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/http_src/vue/modal-edit-exporter-site.vue b/http_src/vue/modal-edit-exporter-site.vue index 405eb6b43b..c4ae186e62 100644 --- a/http_src/vue/modal-edit-exporter-site.vue +++ b/http_src/vue/modal-edit-exporter-site.vue @@ -141,11 +141,14 @@ const validateName = () => { return; } const trimmed = exporter_site_name.value.trim(); + const alphanumericRegex = /^[\p{L}0-9 ]+$/u; if (!trimmed) { name_error.value = _i18n("error_messages.name_cannot_be_empty"); } else if (trimmed.length <= 1) { name_error.value = _i18n("error_messages.name_must_be_longer_than_1_character"); + } else if (!alphanumericRegex.test(trimmed)) { + name_error.value = _i18n("error_messages.name_must_be_alphanumeric"); } else { name_error.value = ""; } diff --git a/http_src/vue/page-exporter-sites.vue b/http_src/vue/page-exporter-sites.vue index a040fbfcd9..630af79e9b 100644 --- a/http_src/vue/page-exporter-sites.vue +++ b/http_src/vue/page-exporter-sites.vue @@ -66,6 +66,16 @@ const map_table_def_columns = (columns) => { columns.forEach((c) => { c.render_func = map_columns[c.data_field]; + if (c.id === "actions") { + c.button_def_array.forEach((b) => { + b.f_map_class = (current_class, row) => { + if (row.id === 0) { + current_class.push("disabled"); + } + return current_class; + }; + }); + } }); return columns; @@ -102,6 +112,7 @@ function on_table_custom_event(event) { } const click_button_edit_exporter_site = (event) => { + if(event.row.id === 0) return; editingExporterSiteId.value = event.row.id; const exporter_site_data = { @@ -116,6 +127,7 @@ const click_button_edit_exporter_site = (event) => { }; async function click_button_delete_exporter_site(event) { + if(event.row.id === 0) return; const exporter_site = event.row.id; const requestParams = { @@ -174,8 +186,8 @@ const handleEditExporterSite = async (data) => { csrf: props.context.csrf, exporter_sites: [{ exporter_site_id: exporter_site_id, - name: new_exporter_site_name, - description: new_exporter_site_description, + exporter_site_name: new_exporter_site_name, + exporter_site_description: new_exporter_site_description, latitude: new_exporter_site_lat, longitude: new_exporter_site_lng }] @@ -213,8 +225,8 @@ const handleAddExporterSite = async (data) => { const addParams = { csrf: props.context.csrf, exporter_sites: [{ - name: data.exporter_site_name, - description: data.exporter_site_description, + exporter_site_name: data.exporter_site_name, + exporter_site_description: data.exporter_site_description, latitude: data.exporter_site_lat, longitude: data.exporter_site_lng }] diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index 9f765b3d41..c42260abeb 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -17,6 +17,7 @@ local lang = { ["name_cannot_be_empty"] = "Name Cannot Be Empty", ["name_must_be_longer_than_1_character"] = "Name Must Be Longer Than 1 Char", ["name_cannot_contain_spaces"] = "Name Cannot Contain Spaces", + ["name_must_be_alphanumeric"] = "Name Must Be Alphanumeric", }, ["active_monitoring_page"] = { diff --git a/scripts/lua/modules/http_lint.lua b/scripts/lua/modules/http_lint.lua index 568c2d5a2f..ac42e7c51b 100644 --- a/scripts/lua/modules/http_lint.lua +++ b/scripts/lua/modules/http_lint.lua @@ -2834,6 +2834,8 @@ local known_parameters = { ["longitude"] = validateSingleWord, ["exporter_site"] = validateSingleWord, ["exporter_site_id"] = validateSingleWord, + ["exporter_site_name"] = validateUnquoted, + ["exporter_site_description"] = validateUnchecked, -- nEdge policy ["default_policy"] = validatePolicy, -- users, nedge policies