mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Various fixes to exporter sites (#9994)
* Removed the edit and delete options for the default exporter site * Changed the validation criteria for exporter sites
This commit is contained in:
parent
49efa101f7
commit
65d7726d5b
4 changed files with 22 additions and 4 deletions
|
|
@ -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 = "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}]
|
||||
|
|
|
|||
|
|
@ -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"] = {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue