diff --git a/httpdocs/js/config_callbacks/config-list-utils.js b/httpdocs/js/config_callbacks/config-list-utils.js
index 472cabde5d..c5c9c468e2 100644
--- a/httpdocs/js/config_callbacks/config-list-utils.js
+++ b/httpdocs/js/config_callbacks/config-list-utils.js
@@ -18,7 +18,7 @@ const check_status_code = (status_code, status_text, $error_label) => {
const get_configuration_data = ($config_table, $button_caller) => {
// get row data
- const row_data = $config_table.row($button_caller.parent().parent()).data();
+ const row_data = $config_table.row($button_caller.parent()).data();
return {
config_id: row_data.id,
@@ -89,35 +89,35 @@ $(document).ready(function() {
className: 'text-center',
render: function(data, type, row) {
var rv = `
-
-
-
+
+ ${i18n.edit}
`
- if(can_clone_config())
+ if(can_clone_config() && data.name !== 'Default')
rv += `
-
-
-
-
-
+ data-target="#delete-modal">
+ ${i18n.delete}
+
`;
return rv;
@@ -128,7 +128,7 @@ $(document).ready(function() {
});
// handle clone modal
- $('#config-list').on('click', 'button[data-target="#clone-modal"]', function(e) {
+ $('#config-list').on('click', 'a[data-target="#clone-modal"]', function(e) {
const {config_id, config_name} = get_configuration_data($config_table, $(this));
@@ -165,7 +165,7 @@ $(document).ready(function() {
}
// disable button until request hasn't finished
- $button.attr("disabled", "");
+ $button.removeAttr("href");
$.post(`${http_prefix}/lua/edit_scripts_configsets.lua`, {
action: 'clone',
@@ -180,7 +180,7 @@ $(document).ready(function() {
if (check_status_code(xhr.status, xhr.statusText, $("#clone-error"))) return;
// re-enable button
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
// if the operation was not successful then show an error
if (!data.success) {
$("#clone-error").text(data.error).show();
@@ -205,7 +205,7 @@ $(document).ready(function() {
}
// re-enable button
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
})
})
@@ -219,7 +219,7 @@ $(document).ready(function() {
});
// handle apply modal
- $('#config-list').on('click', 'button[data-target="#applied-modal"]', function(e) {
+ $('#config-list').on('click', 'a[data-target="#applied-modal"]', function(e) {
const {config_id, config_name, config_targets} = get_configuration_data($config_table, $(this));
@@ -255,7 +255,7 @@ $(document).ready(function() {
applied_value = $("#applied-input").val();
}
- $button.attr("disabled");
+ $button.removeAttr("href");
$.post(`${http_prefix}/lua/edit_scripts_configsets.lua`, {
action: 'set_targets',
@@ -269,7 +269,7 @@ $(document).ready(function() {
// check if the status code is successfull
if (check_status_code(xhr.status, xhr.statusText, $("#rename-error"))) return;
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
if (!data.success) {
apply_csrf = data.csrf;
@@ -295,7 +295,7 @@ $(document).ready(function() {
}
// re-enable button
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
})
@@ -310,7 +310,7 @@ $(document).ready(function() {
});
// handle rename modal
- $('#config-list').on('click', 'button[data-target="#rename-modal"]', function(e) {
+ $('#config-list').on('click', 'a[data-target="#rename-modal"]', function(e) {
const {config_id, config_name} = get_configuration_data($config_table, $(this));
@@ -342,7 +342,7 @@ $(document).ready(function() {
return;
}
- $button.attr("disabled");
+ $button.removeAttr("href");
$.post(`${http_prefix}/lua/edit_scripts_configsets.lua`, {
action: 'rename',
@@ -355,7 +355,7 @@ $(document).ready(function() {
// check if the status code is successfull
if (check_status_code(xhr.status, xhr.statusText, $("#rename-error"))) return;
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
if (!data.success) {
$("#rename-error").text(data.error).show();
@@ -381,7 +381,7 @@ $(document).ready(function() {
}
// re-enable button
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
})
})
@@ -394,7 +394,7 @@ $(document).ready(function() {
});
// handle delete modal
- $('#config-list').on('click', 'button[data-target="#delete-modal"]', function(e) {
+ $('#config-list').on('click', 'a[data-target="#delete-modal"]', function(e) {
const {config_id, config_name} = get_configuration_data($config_table, $(this));
@@ -406,7 +406,7 @@ $(document).ready(function() {
const $button = $(this);
- $button.attr("disabled", "");
+ $button.removeAttr("href");
$.post(`${http_prefix}/lua/edit_scripts_configsets.lua`, {
action: 'delete',
@@ -418,7 +418,7 @@ $(document).ready(function() {
// check if the status code is successfull
if (check_status_code(xhr.status, xhr.statusText, $("#delete-error"))) return;
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
if (!data.success) {
$("#delete-error").text(data.error).show();
@@ -442,7 +442,7 @@ $(document).ready(function() {
$("#delete-error").text(`${i18n.expired_csrf}`).show();
}
// re-enable button
- $button.removeAttr("disabled");
+ $button.attr("href", "#");
})
})
diff --git a/httpdocs/js/config_callbacks/scripts-list-utils.js b/httpdocs/js/config_callbacks/scripts-list-utils.js
index 91ec9b4490..67e156c4aa 100644
--- a/httpdocs/js/config_callbacks/scripts-list-utils.js
+++ b/httpdocs/js/config_callbacks/scripts-list-utils.js
@@ -695,25 +695,23 @@ $(document).ready(function() {
render: function (data, type, row) {
const edit_script_btn = `
-
+
+ ${i18n.edit}
+
+ `;
+ const edit_url_btn = `
+
+ ${i18n.view}
+
`;
return `
-
- ${row.all_hooks.length > 0 && row.input_handler == undefined ? '' : edit_script_btn}
-
-
-
-
+ ${row.input_handler == undefined ? '' : edit_script_btn}
+ ${!data.edit_url ? '' : edit_url_btn}
`;
},
sortable: false,
@@ -747,10 +745,10 @@ $(document).ready(function() {
});
// load templates for the script
- $('#scripts-config').on('click', 'button[data-target="#modal-script"]', function(e) {
+ $('#scripts-config').on('click', 'a[data-target="#modal-script"]', function(e) {
// get script key and script name
- const row_data = $script_table.row($(this).parent().parent()).data();
+ const row_data = $script_table.row($(this).parent()).data();
const script_key = row_data.key;
const script_title = row_data.title;
@@ -824,4 +822,4 @@ $(document).ready(function() {
return [enabled_count, disabled_count];
}
-});
\ No newline at end of file
+});
diff --git a/httpdocs/templates/config_list.html b/httpdocs/templates/config_list.html
index 122ff23c76..33b00745de 100644
--- a/httpdocs/templates/config_list.html
+++ b/httpdocs/templates/config_list.html
@@ -29,7 +29,7 @@
| {{ i18n("config_scripts.config_name", {}) }} |
{{ i18n("config_scripts.applied_to", {}) }} |
- {{ i18n("actions", {}) }} |
+ {{ i18n("actions", {}) }} |
diff --git a/httpdocs/templates/script_list.html b/httpdocs/templates/script_list.html
index 7f015630e4..80818ed523 100644
--- a/httpdocs/templates/script_list.html
+++ b/httpdocs/templates/script_list.html
@@ -68,7 +68,9 @@ i18n.request_failed_message = '{{ i18n("request_failed_message") }}'
i18n.select_operator = "{{ i18n('scripts_list.select_operator') }}";
i18n.empty_input_box = "{{ i18n('config_scripts.empty_value_message') }}"
i18n.template_not_found = "{{ i18n('scripts_list.template_not_found') }}"
+i18n.view = "{{ i18n('scripts_list.actions.view') }}"
i18n.view_src_script = "{{ i18n('scripts_list.actions.view_src_script') }}"
+i18n.edit = "{{ i18n('scripts_list.actions.edit') }}"
i18n.edit_script = "{{ i18n('scripts_list.actions.edit_script') }}"
i18n.items_list_comma = "{{ i18n('scripts_list.items_list_comma') }}";
i18n.blacklisted_country = "{{ i18n('scripts_list.blacklisted_country') }}";
diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua
index 107e6a0660..4c080e73e0 100644
--- a/scripts/locales/en.lua
+++ b/scripts/locales/en.lua
@@ -529,7 +529,7 @@ local lang = {
["type_targets"] = "Type targets",
["type_targets_example"] = "Type targets separated by a comma. i.e: 192.168.1.20,192.168.0.0/16",
["actions"] = {
- ["apply_to"] = "Applied to",
+ ["apply_to"] = "Apply to",
["clone"] = "Clone",
["delete"] = "Delete",
["edit"] = "Edit",
@@ -3149,7 +3149,9 @@ local lang = {
["select_operator"] = "Please select an operator!",
["template_not_found"] = "The template was not found!",
["actions"] = {
+ ["edit"] = "Edit",
["edit_script"] = "Edit Script",
+ ["view"] = "View",
["view_src_script"] = "View Source Script",
},
},