Continue renter configuration
This commit is contained in:
@@ -1,28 +1,29 @@
|
||||
// Main
|
||||
(() => {
|
||||
function setInnerText(id, text) {
|
||||
document.getElementById(id).innerText = text;
|
||||
}
|
||||
|
||||
function setValue(id, value) {
|
||||
document.getElementById(id).value = value;
|
||||
}
|
||||
|
||||
function getValue(id) {
|
||||
return document.getElementById(id).value;
|
||||
}
|
||||
|
||||
function setSelect(id, itemList) {
|
||||
const select = document.getElementById(id);
|
||||
select.innerHTML = "";
|
||||
|
||||
for (const item of itemList) {
|
||||
const opt = document.createElement('option');
|
||||
opt.innerText = item;
|
||||
select.appendChild(opt);
|
||||
}
|
||||
}
|
||||
|
||||
window.uiUpdate = (()=> {
|
||||
function setInnerText(id, text) {
|
||||
document.getElementById(id).innerText = text;
|
||||
}
|
||||
|
||||
function setValue(id, value) {
|
||||
document.getElementById(id).value = value;
|
||||
}
|
||||
|
||||
function getValue(id) {
|
||||
return document.getElementById(id).value;
|
||||
}
|
||||
|
||||
function setSelect(id, itemList) {
|
||||
const select = document.getElementById(id);
|
||||
select.innerHTML = "";
|
||||
|
||||
for (const item of itemList) {
|
||||
const opt = document.createElement('option');
|
||||
opt.innerText = item;
|
||||
select.appendChild(opt);
|
||||
}
|
||||
}
|
||||
|
||||
const _renter = (()=> {
|
||||
return {
|
||||
@@ -121,7 +122,11 @@
|
||||
}
|
||||
|
||||
function _allocatedRenterFunds() {
|
||||
return window.uiState.allocatedRenterFunds
|
||||
return window.uiState.allocatedRenterFunds;
|
||||
}
|
||||
|
||||
function _defaultRenterSettings() {
|
||||
return window.uiState.defaultRenterSettings;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -129,7 +134,8 @@
|
||||
isOnline: _isOnline,
|
||||
isWalletConfigured: _isWalletConfigured,
|
||||
isWalletLocked: _isWalletLocked,
|
||||
allocatedRenterFunds: _allocatedRenterFunds
|
||||
allocatedRenterFunds: _allocatedRenterFunds,
|
||||
defaultRenterSettings: _defaultRenterSettings
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -165,8 +171,8 @@
|
||||
window.appActions.shutdown();
|
||||
}
|
||||
|
||||
function _setRenterAllowance(allowance) {
|
||||
window.appActions.setRenterAllowance(allowance);
|
||||
function _setRenterSettings(allowance, cb) {
|
||||
window.appActions.setRenterSettings(allowance, cb);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -177,7 +183,7 @@
|
||||
unlockWallet: _unlockWallet,
|
||||
unmountDrive: _unmountDrive,
|
||||
shutdown: _shutdown,
|
||||
setRenterAllowance: _setRenterAllowance
|
||||
setRenterSettings: _setRenterSettings
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -263,10 +269,22 @@
|
||||
|
||||
function handleRenterEditSettings() {
|
||||
setMainWindow('renter_settings_window');
|
||||
const defaultsButton = document.getElementById('ID_RenterSettingsDefaults');
|
||||
defaultsButton.onclick = ()=> {
|
||||
const settings = UiState.defaultRenterSettings();
|
||||
if (getValue('ID_RenterSetFunds') === '0') {
|
||||
setValue('ID_RenterSetFunds', settings.Funds);
|
||||
}
|
||||
setValue('ID_RenterSetHosts', settings.Hosts);
|
||||
setValue('ID_RenterSetPeriod', settings.Period);
|
||||
setValue('ID_RenterSetRenewWindow', settings.RenewWindowInBlocks);
|
||||
};
|
||||
|
||||
const cancelButton = document.getElementById('ID_RenterSettingsCancel');
|
||||
cancelButton.onclick = ()=> {
|
||||
saveButton.onclick = null;
|
||||
cancelButton.onclick = null;
|
||||
defaultsButton.onclick = null;
|
||||
beginMainApplication();
|
||||
};
|
||||
|
||||
@@ -274,7 +292,8 @@
|
||||
saveButton.onclick = ()=> {
|
||||
saveButton.onclick = null;
|
||||
cancelButton.onclick = null;
|
||||
AppActions.setRenterAllowance({
|
||||
defaultsButton.onclick = null;
|
||||
AppActions.setRenterSettings({
|
||||
'Funds': getValue('ID_RenterSetFunds'),
|
||||
'Hosts': getValue('ID_RenterSetHosts'),
|
||||
'Period': getValue('ID_RenterSetPeriod'),
|
||||
|
Reference in New Issue
Block a user