Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix restart issues #1001

Merged
merged 15 commits into from
Nov 5, 2019
Merged
2 changes: 2 additions & 0 deletions src/html/modals/options.pug
Original file line number Diff line number Diff line change
@@ -81,6 +81,8 @@

let optionsAdded = false;
ipcRenderer.on("user:configure", (event, osInstructs) => {
views.show("working", "particles");
footer.underText.set("Please Configure the installation");
modals.show("options");
if (!optionsAdded) {
optionsAdded = true;
9 changes: 7 additions & 2 deletions src/html/scripts/main.pug
Original file line number Diff line number Diff line change
@@ -57,11 +57,16 @@ script.
ipcRenderer.on("user:os", (event, installConfig, osSelects) => {
global.installConfig = installConfig;
global.installConfig.os_to_install = undefined;
footer.topText.set(installConfig.name+" ("+installConfig.codename+")");
footer.underText.set("Please select an operating system for installation");
$("#options-os").append(osSelects);
$("#your-ubp-device").text(installConfig.name+" ("+installConfig.codename+")");
$("#your-ubp-device").click(() => {
$("#device-name").text(installConfig.name+" ("+installConfig.codename+")");
$("#device-page-link").click(() => {
shell.openExternal("https://devices.ubuntu-touch.io/device/" + installConfig.codename);
});
$("#device-config").click(() => {
shell.openExternal("https://github.com/ubports/installer-configs/blob/master/v1/" + installConfig.codename + ".json");
});
modals.hide("select-device");
views.show("select-os");
});
6 changes: 4 additions & 2 deletions src/html/views/select-os.pug
Original file line number Diff line number Diff line change
@@ -3,13 +3,15 @@
.col-xs-6
img(style='height: 350px; margin: auto; display: block;', src='../screens/Screen6.jpg')
.col-xs-6(style='height: 100%')
h4.user-install-header(style='font-weight: bold;') Select your Operating System
h4.user-install-header#device-name(style='font-weight: bold;')
p
| Your device: #[a#your-ubp-device]
| #[a#device-page-link about this device] | #[a#device-config view config file]
p
| What operating system do you want to install?
form.form-horizontal
.form-group
.col-xs-3
label.control-label OS
.col-xs-9
select#options-os.form-control.space
button#btn-inst.btn.btn-primary(type='button', style='width: 100%; margin-top: 10px;', onclick="ipcRenderer.send(\"os:selected\", getElementById('options-os').selectedIndex); global.installConfig.os_to_install = getElementById('options-os').selectedIndex;") Install
25 changes: 9 additions & 16 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -337,27 +337,20 @@ mainEvent.on("user:configure", osInstructs => {
mainEvent.on("device", device => {
global.installProperties.device = device;
function continueWithConfig() {
if (global.installConfig.operating_systems.length > 1) {
// ask for os selection if there's one os
mainWindow.webContents.send(
"user:os",
global.installConfig,
devices.getOsSelects(global.installConfig.operating_systems)
);
} else {
// immediately jump to configure if there's only one os
global.installProperties.osIndex = 0;
mainEvent.emit(
"user:configure",
global.installConfig.operating_systems[0]
);
}
mainWindow.webContents.send(
"user:os",
global.installConfig,
devices.getOsSelects(global.installConfig.operating_systems)
);
}
if (global.installConfig && global.installConfig.operating_systems) {
// local config specified
continueWithConfig();
} else {
// local config specified
// fetch remote config
global.mainEvent.emit("user:write:working", "particles");
global.mainEvent.emit("user:write:status", "Preparing installation", true);
global.mainEvent.emit("user:write:under", "Fetching installation instructions");
api
.getDevice(device)
.then(config => {