1
0

Renter settings

This commit is contained in:
Scott E. Graves
2017-03-25 12:25:45 -05:00
parent 77579ffea3
commit e82081fd41
9 changed files with 243 additions and 49 deletions

View File

@@ -85,7 +85,8 @@
if (document.getElementById('ID_MountButton').innerText !== 'Unmount') {
setSelect('ID_MountDrives', drives);
}
}
},
notifyDriveUnmounted: _notifyDriveUnmounted
};
})();
@@ -158,6 +159,8 @@
};
})();
let _mountHandler;
function setMainWindow(name) {
console.log('Setting main window: ' + name);
const elem = document.getElementById(name);
@@ -181,13 +184,29 @@
}
}
function _notifyDriveUnmounted() {
const mountButton = document.getElementById('ID_MountButton');
const mountSelect = document.getElementById('ID_MountDrives');
if (mountButton.innerText === 'Unmount') {
mountButton.innerText = "Mount";
mountButton.onclick = _mountHandler;
mountButton.disabled = false;
mountSelect.disabled = false;
}
}
function beginMainApplication() {
AppActions.startApp();
setMainWindow('app_window');
const renterEditLink = document.getElementById('ID_Renter_Edit');
renterEditLink.onclick = ()=> {
renterEditLink.onclick = null;
handleRenterEditSettings();
};
const mountButton = document.getElementById('ID_MountButton');
const mountSelect = document.getElementById('ID_MountDrives');
const mountHandler = ()=> {
_mountHandler = ()=> {
mountButton.onclick = null;
mountButton.disabled = true;
mountSelect.disabled = true;
@@ -198,23 +217,31 @@
} else {
displayErrorPopup('Mount Failed', reason);
}
mountButton.onclick = mountHandler;
mountButton.onclick = _mountHandler;
mountButton.disabled = false;
});
} else {
AppActions.unmountDrive((success, reason) => {
if (success) {
mountButton.innerText = "Mount";
mountSelect.disabled = false;
_notifyDriveUnmounted()
} else {
displayErrorPopup('Unmount Failed', reason);
mountButton.onclick = _mountHandler;
mountButton.disabled = false;
}
mountButton.onclick = mountHandler;
mountButton.disabled = false;
});
}
};
mountButton.onclick = mountHandler;
mountButton.onclick = _mountHandler;
}
function handleRenterEditSettings() {
setMainWindow('renter_settings_window');
const cancelButton = document.getElementById('ID_RenterSettingsCancel');
cancelButton.onclick = ()=> {
cancelButton.onclick = null;
beginMainApplication();
}
}
function handleUnlockWallet() {
@@ -225,7 +252,6 @@
unlockButton.onclick = null;
const password = document.getElementById('ID_WalletUnlockPwd');
if (AppActions.unlockWallet(password.value, (success, reason) => {
password.value = '';
if (success) {
beginMainApplication();
} else {
@@ -234,7 +260,10 @@
});
}
})) {
password.value = '';
setMainWindow('unlocking_window');
} else {
password.value = '';
}
};
}