mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 09:56:36 +01:00
#98, fixes in the wizard
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import server from './services/server.js';
|
||||
import utils from "./services/utils.js";
|
||||
|
||||
function SetupModel() {
|
||||
this.step = ko.observable("setup-type");
|
||||
@@ -12,6 +13,10 @@ function SetupModel() {
|
||||
this.password1 = ko.observable();
|
||||
this.password2 = ko.observable();
|
||||
|
||||
this.serverAddress = ko.observable();
|
||||
|
||||
this.instanceType = utils.isElectron() ? "desktop" : "server";
|
||||
|
||||
this.setupTypeSelected = this.getSetupType = () =>
|
||||
this.setupNewDocument()
|
||||
|| this.setupSyncFromDesktop()
|
||||
@@ -22,7 +27,13 @@ function SetupModel() {
|
||||
this.setupType(this.getSetupType());
|
||||
};
|
||||
|
||||
this.back = () => this.step("setup-type");
|
||||
this.back = () => {
|
||||
this.step("setup-type");
|
||||
|
||||
this.setupNewDocument(false);
|
||||
this.setupSyncFromServer(false);
|
||||
this.setupSyncFromDesktop(false);
|
||||
};
|
||||
|
||||
this.finish = () => {
|
||||
if (this.setupNewDocument()) {
|
||||
@@ -52,6 +63,28 @@ function SetupModel() {
|
||||
window.location.replace("/");
|
||||
});
|
||||
}
|
||||
else if (this.setupSyncFromServer()) {
|
||||
const serverAddress = this.serverAddress();
|
||||
const username = this.username();
|
||||
const password = this.password1();
|
||||
|
||||
if (!serverAddress) {
|
||||
showAlert("Trilium server address can't be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!username) {
|
||||
showAlert("Username can't be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!password) {
|
||||
showAlert("Password can't be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
showAlert("All OK");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,4 +93,6 @@ function showAlert(message) {
|
||||
$("#alert").show();
|
||||
}
|
||||
|
||||
ko.applyBindings(new SetupModel(), document.getElementById('setup-dialog'));
|
||||
ko.applyBindings(new SetupModel(), document.getElementById('setup-dialog'));
|
||||
|
||||
$("#setup-dialog").show();
|
||||
Reference in New Issue
Block a user