Skip to content

Commit

Permalink
luci-app-banip: new button "Apply & Restart"
Browse files Browse the repository at this point in the history
* Many changes to the user interface require a banIP restart, e.g. to restructure the underlying nft rule set. In this case, “Apply & Restart” saves the user an unnecessary “Save & Apply” (followed by a banIP reload & restart to obtain the new nft structure.

Signed-off-by: Dirk Brenken <dev@brenken.org>
  • Loading branch information
dibdot committed Apr 26, 2024
1 parent f8eb80b commit 1661b21
Show file tree
Hide file tree
Showing 2 changed files with 245 additions and 234 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';
'require dom';
'require view';
'require poll';
'require fs';
Expand All @@ -11,6 +12,12 @@
button handling
*/
function handleAction(ev) {
if (ev === 'restart') {
let map = document.querySelector('.cbi-map');
dom.callClassMethod(map, 'save').then(function() {
classes.ui.changes.apply(false);
});
}
return fs.exec_direct('/etc/init.d/banip', [ev])
}

Expand Down Expand Up @@ -222,7 +229,7 @@ return view.extend({
'click': ui.createHandlerFn(this, function () {
return handleAction('restart');
})
}, [_('Restart')])
}, [_('Apply & Restart')])
])
]);
}, o, this);
Expand Down
Loading

0 comments on commit 1661b21

Please sign in to comment.