fixed setup page issues which caused wrong choice to be used in the wizard

This commit is contained in:
azivner 2019-01-03 22:32:36 +01:00
parent fec3e47eb8
commit e2dfe1b6de
2 changed files with 8 additions and 14 deletions

View File

@ -25,26 +25,20 @@ function SetupModel() {
this.instanceType = utils.isElectron() ? "desktop" : "server";
this.setupTypeSelected = this.getSetupType = () =>
this.setupNewDocument()
|| this.setupSyncFromDesktop()
|| this.setupSyncFromServer();
this.setupTypeSelected = () => !!this.setupType();
this.selectSetupType = () => {
this.step(this.getSetupType());
this.setupType(this.getSetupType());
this.step(this.setupType());
};
this.back = () => {
this.step("setup-type");
this.setupNewDocument(false);
this.setupSyncFromServer(false);
this.setupSyncFromDesktop(false);
this.setupType("");
};
this.finish = async () => {
if (this.setupNewDocument()) {
if (this.setupType() === 'new-document') {
const username = this.username();
const password1 = this.password1();
const password2 = this.password2();
@ -72,7 +66,7 @@ function SetupModel() {
window.location.replace("/");
});
}
else if (this.setupSyncFromServer()) {
else if (this.setupType() === 'sync-from-server') {
const syncServerHost = this.syncServerHost();
const syncProxy = this.syncProxy();
const username = this.username();

View File

@ -13,15 +13,15 @@
<div id="setup-type" data-bind="visible: step() == 'setup-type'" style="margin-top: 20px;">
<div class="radio" style="margin-bottom: 15px;">
<label><input type="radio" name="setup-type" value="new-document" data-bind="checked: setupNewDocument">
<label><input type="radio" name="setup-type" value="new-document" data-bind="checked: setupType">
I'm a new user and I want to create new Trilium document for my notes</label>
</div>
<div class="radio" data-bind="if: instanceType == 'server'" style="margin-bottom: 15px;">
<label><input type="radio" name="setup-type" value="sync-from-desktop" data-bind="checked: setupSyncFromDesktop">
<label><input type="radio" name="setup-type" value="sync-from-desktop" data-bind="checked: setupType">
I have desktop instance already and I want to setup sync with it</label>
</div>
<div class="radio" data-bind="if: instanceType == 'desktop'" style="margin-bottom: 15px;">
<label><input type="radio" name="setup-type" value="sync-from-server" data-bind="checked: setupSyncFromServer">
<label><input type="radio" name="setup-type" value="sync-from-server" data-bind="checked: setupType">
I have server instance up and I want to setup sync with it</label>
</div>