add ability to disable the wizard

This commit is contained in:
ryan.kuba 2022-06-29 16:01:33 -04:00
parent 78c76e72c9
commit 76e559fe02
2 changed files with 28 additions and 1 deletions

View file

@ -95,7 +95,14 @@ io.on('connection', async function (socket) {
socket.emit('renderinstall', [EULA, images]);
}
}
// Disable wizard
async function noWizard() {
await fsw.writeFile('/opt/NO_WIZARD', '');
socket.emit('wizardkilled');
let cmd = pty.spawn('/usr/bin/pkill', ['node']);
}
//// Incoming requests ////
socket.on('renderlanding', renderLanding);
socket.on('install', install);
socket.on('nowizard', noWizard);
});

View file

@ -151,7 +151,26 @@ async function renderDash(info) {
$('<header>').text('System Information'),
$('<table>').append(sysinfoTable)
]);
$('#container').append([systemCard, dockerCard]);
let killButton = $('<button>', {class: 'btn btn-default btn-ghost center', onclick: 'nowizard()'}).text('Stop Install Wizard');
$('#container').append([
systemCard,
dockerCard,
killButton
]);
}
// Kill off wizard
function nowizard() {
socket.emit('nowizard');
}
function wizardKilled() {
showContainer();
titleChange('Wizard killed');
let titleBar = $('<div>');
titleBar.append($('<h2>', {class: 'center'}).text('Install Wizard has been disabled'));
titleBar.append($('<h3>', {class: 'center'}).text('To re-enable please remove the /opt/NO_WIZARD file'));
titleBar.append($('<h3>', {class: 'center'}).text('And restart the container'));
$('#container').append(titleBar);
}
// Render primary form
@ -289,6 +308,7 @@ socket.on('renderinstall', renderInstall);
socket.on('renderdash', renderDash);
socket.on('term', renderTerm);
socket.on('done', done);
socket.on('wizardkilled', wizardKilled);
// Render landing on page load
window.onload = function() {