mirror of
https://github.com/opnsense/core.git
synced 2026-02-18 18:18:13 -05:00
Firewall: Rules [new]: Move download and upload commands out of partial into global commands (#9781)
This commit is contained in:
parent
8405980833
commit
d5a50a98c2
1 changed files with 27 additions and 23 deletions
|
|
@ -597,6 +597,32 @@
|
|||
},
|
||||
},
|
||||
commands: {
|
||||
upload_rules: {
|
||||
onRendered: function () {
|
||||
const $el = $(this);
|
||||
$el.data('title', "{{ lang._('Import rules') }}");
|
||||
$el.data('endpoint', '/api/firewall/filter/upload_rules');
|
||||
$el.SimpleFileUploadDlg({
|
||||
onAction: function () {
|
||||
$("#{{formGridFilterRule['table_id']}}").bootgrid('reload');
|
||||
}
|
||||
});
|
||||
},
|
||||
footer: true,
|
||||
classname: 'fa fa-fw fa-upload',
|
||||
title: "{{ lang._('Import csv') }}",
|
||||
sequence: 400
|
||||
},
|
||||
download_rules: {
|
||||
footer: true,
|
||||
classname: 'fa fa-fw fa-table',
|
||||
title: "{{ lang._('Export as csv') }}",
|
||||
method: function (e) {
|
||||
e.preventDefault();
|
||||
window.open("/api/firewall/filter/download_rules");
|
||||
},
|
||||
sequence: 500
|
||||
},
|
||||
move_before: {
|
||||
method: function(event) {
|
||||
// Ensure exactly one rule is selected to be moved
|
||||
|
|
@ -1148,29 +1174,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- grid -->
|
||||
{{ partial('layout_partials/base_bootgrid_table', formGridFilterRule + {'command_width': '180'}+ {
|
||||
'grid_commands': {
|
||||
'upload_rules': {
|
||||
'title': lang._('Import csv'),
|
||||
'class': 'btn btn-xs',
|
||||
'icon_class': 'fa fa-fw fa-upload',
|
||||
'data': {
|
||||
'title': lang._('Import rules'),
|
||||
'endpoint': '/api/firewall/filter/upload_rules',
|
||||
'toggle': 'tooltip'
|
||||
}
|
||||
},
|
||||
'download_rules': {
|
||||
'title': lang._('Export as csv'),
|
||||
'class': 'btn btn-xs',
|
||||
'icon_class': 'fa fa-fw fa-table',
|
||||
'data': {
|
||||
'toggle': 'tooltip'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}}
|
||||
{{ partial('layout_partials/base_bootgrid_table', formGridFilterRule + {'command_width': '180'}) }}
|
||||
</div>
|
||||
|
||||
{{ partial('layout_partials/base_apply_button', {'data_endpoint': '/api/firewall/filter/apply'}) }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue