Skip to content

Commit

Permalink
add ability to disable the wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan.kuba committed Jun 29, 2022
1 parent 78c76e7 commit 76e559f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
22 changes: 21 additions & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 76e559f

Please sign in to comment.