mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 02:16:39 +00:00
added disable all button (#3917)
This commit is contained in:
parent
7320c8266c
commit
d0f1502e69
4 changed files with 29 additions and 2 deletions
|
|
@ -1532,6 +1532,8 @@ $(document).ready(function () {
|
|||
}
|
||||
|
||||
const [enabled_count, disabled_count] = count_scripts();
|
||||
// enable the disable all button if there are more than one enabled scripts
|
||||
if (enabled_count > 0) $(`#btn-disable-all`).removeAttr('disabled');
|
||||
|
||||
// select the correct tab
|
||||
select_script_filter(enabled_count);
|
||||
|
|
@ -1744,4 +1746,24 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
$(`#btn-disable-all`).click(async function() {
|
||||
|
||||
$(this).attr("disabled", "disabled");
|
||||
$.post(`${http_prefix}/lua/toggle_all_user_scripts.lua`, {
|
||||
action: 'disable',
|
||||
script_subdir: script_subdir,
|
||||
confset_id: confset_id,
|
||||
csrf: pageCsrf
|
||||
})
|
||||
.then((result) => {
|
||||
if (result.success) location.reload();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
})
|
||||
.always(() => {
|
||||
$(`#btn-disable-all`).removeAttr("disabled");
|
||||
})
|
||||
})
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue