mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-04 18:00:10 +00:00
Removed MUD code
This commit is contained in:
parent
31a33b1b11
commit
bbf48666c8
8 changed files with 8 additions and 162 deletions
|
|
@ -1113,113 +1113,6 @@ const ElephantFlows = (gui, hooks, script_subdir, script_key) => {
|
|||
|
||||
/* ******************************************************* */
|
||||
|
||||
const FlowMud = (gui, hooks, script_subdir, script_key) => {
|
||||
|
||||
const $table_editor = $("#script-config-editor");
|
||||
$("#script-config-editor").empty();
|
||||
|
||||
const render_template = () => {
|
||||
const enabled = hooks.all.enabled;
|
||||
const items_list = (hooks.all.script_conf ? hooks.all.script_conf.device_types : null) || [];
|
||||
const max_recording = (hooks.all.script_conf ? hooks.all.script_conf.max_recording : null) || 3600;
|
||||
|
||||
const $multiselect_ds = generate_multi_select({
|
||||
enabled: enabled,
|
||||
name: 'item_list',
|
||||
selected_values: items_list,
|
||||
groups: device_types
|
||||
}, false /* no container */);
|
||||
|
||||
const $max_recording = generate_single_select({
|
||||
enabled: enabled,
|
||||
label: i18n.scripts_list.templates.max_mud_recording,
|
||||
name: 'max_recording',
|
||||
current_value: max_recording,
|
||||
elements: mud_max_recording,
|
||||
});
|
||||
|
||||
|
||||
const $checkbox_enabled = generate_checkbox_enabled(
|
||||
'mud-checkbox', enabled, function (e) {
|
||||
const checked = $(this).prop('checked');
|
||||
|
||||
if (!checked) {
|
||||
$multiselect_ds.attr("disabled", "");
|
||||
$max_recording.find('select').attr("disabled", "");
|
||||
} else {
|
||||
$multiselect_ds.removeAttr("disabled");
|
||||
$max_recording.find('select').removeAttr("disabled");
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
const $container = $(`<tr></tr>`).append(
|
||||
$(`<td class='text-center'></td>`).append($checkbox_enabled),
|
||||
$(`<td></td>`).append(
|
||||
$(`<div class='form-group'>
|
||||
<label>${i18n.scripts_list.templates.mud_enabled_devices}:</label>
|
||||
</div>`).append($multiselect_ds),
|
||||
$max_recording
|
||||
)
|
||||
);
|
||||
|
||||
$table_editor.append(`<tr class='text-center'><th>${i18n.enabled}</th></tr>`);
|
||||
|
||||
// append all inside the table
|
||||
$table_editor.append($container);
|
||||
}
|
||||
|
||||
const apply_event = (event) => {
|
||||
|
||||
const hook_enabled = $('#mud-checkbox').prop('checked');
|
||||
const items_list = $(`select[name='item_list']`).val();
|
||||
const max_recording = parseInt($(`select[name='max_recording']`).val());
|
||||
|
||||
const template_data = {
|
||||
all: {
|
||||
enabled: hook_enabled,
|
||||
script_conf: {
|
||||
device_types: items_list,
|
||||
max_recording: max_recording,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make post request to save data
|
||||
apply_edits_script(template_data, script_subdir, script_key);
|
||||
}
|
||||
|
||||
const reset_event = (event) => {
|
||||
reset_script_defaults(script_key, script_subdir, (reset_data) => {
|
||||
const max_recording = reset_data.hooks.all.script_conf.max_recording || 3600;
|
||||
const items_list = reset_data.hooks.all.script_conf.device_types || [];
|
||||
const enabled = reset_data.hooks.all.enabled;
|
||||
|
||||
// set textarea value with default's one
|
||||
$(`select[name='item_list']`).val(items_list.join(','));
|
||||
$('#mud-checkbox').prop('checked', enabled);
|
||||
$(`select[name='max_recording']`).val(max_recording);
|
||||
|
||||
if (!enabled) {
|
||||
$(`select[name='item_list']`).attr('disabled', '');
|
||||
$(`select[name='max_recording']`).attr('disabled', '');
|
||||
} else {
|
||||
$(`select[name='item_list']`).removeAttr('disabled', '');
|
||||
$(`select[name='max_recording']`).removeAttr('disabled', '');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
apply_click_event: apply_event,
|
||||
reset_click_event: reset_event,
|
||||
render: render_template,
|
||||
}
|
||||
};
|
||||
|
||||
/* ******************************************************* */
|
||||
|
||||
const EmptyTemplate = (gui = null, hooks = null, script_subdir = null, script_key = null) => {
|
||||
|
||||
const $tableEditor = $("#script-config-editor");
|
||||
|
|
@ -1315,7 +1208,6 @@ const TemplateBuilder = ({ gui, hooks }, script_subdir, script_key) => {
|
|||
items_list: ItemsList(gui, hooks, script_subdir, script_key),
|
||||
long_lived: LongLived(gui, hooks, script_subdir, script_key),
|
||||
elephant_flows: ElephantFlows(gui, hooks, script_subdir, script_key),
|
||||
flow_mud: FlowMud(gui, hooks, script_subdir, script_key),
|
||||
}
|
||||
|
||||
let template_chosen = templates[template_name];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue