Shell: Add toggle to execute command as root

This commit is contained in:
Sebastian Serth
2022-10-04 14:42:15 +02:00
parent f22e3b56f1
commit f53c6cb3ee
8 changed files with 26 additions and 15 deletions

View File

@ -8,7 +8,8 @@ $(document).on('turbolinks:load', function () {
const executeCommand = function (command) {
$.ajax({
data: {
command: command
command: command,
sudo: $('#sudo').is(':checked')
},
method: 'POST',
url: $('#shell').data('url')
@ -92,6 +93,12 @@ $(document).on('turbolinks:load', function () {
const command = $('#command')
command.focus();
command.on('keypress', handleKeyPress);
const sudo = $('#sudo');
sudo.on('change', function () {
sudo.parent().toggleClass('text-muted')
command.focus();
});
}
})
;