Fluid UI response
This commit is contained in:
@@ -23,47 +23,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
window.uiUpdate = (()=> {
|
||||
window.uiUpdate = (() => {
|
||||
|
||||
const _renter = (()=> {
|
||||
const _renter = (() => {
|
||||
return {
|
||||
setAllocatedFunds: (currency)=> {
|
||||
setAllocatedFunds: (currency) => {
|
||||
setInnerText('ID_Renter_AllocatedFunds', currency);
|
||||
},
|
||||
setUsedFunds: (currency)=> {
|
||||
setUsedFunds: (currency) => {
|
||||
setInnerText('ID_Renter_UsedFunds', currency);
|
||||
},
|
||||
setAvailableFunds: (currency)=> {
|
||||
setAvailableFunds: (currency) => {
|
||||
setInnerText('ID_Renter_AvailableFunds', currency);
|
||||
},
|
||||
setHostCount: (count)=> {
|
||||
setHostCount: (count) => {
|
||||
setInnerText('ID_Renter_HostCount', count);
|
||||
},
|
||||
setEstimatedSpace: (space)=> {
|
||||
setEstimatedSpace: (space) => {
|
||||
setInnerText('ID_Renter_EstimatedSpace', space);
|
||||
},
|
||||
setUsedSpace: (space)=> {
|
||||
setUsedSpace: (space) => {
|
||||
setInnerText('ID_Renter_UsedSpace', space);
|
||||
},
|
||||
setEstimatedCost: (currency)=> {
|
||||
setEstimatedCost: (currency) => {
|
||||
setInnerText('ID_Renter_EstimatedCost', currency);
|
||||
},
|
||||
setAvailableSpace: (space)=> {
|
||||
setAvailableSpace: (space) => {
|
||||
setInnerText('ID_Renter_AvailablSpace', space);
|
||||
},
|
||||
setDownloadCost: (currency)=> {
|
||||
setDownloadCost: (currency) => {
|
||||
setInnerText('ID_Renter_EstimatedDownloadCost', currency);
|
||||
},
|
||||
setUploadCost: (currency)=> {
|
||||
setUploadCost: (currency) => {
|
||||
setInnerText('ID_Renter_EstimatedUploadCost', currency);
|
||||
},
|
||||
setAllowance: (allowance)=> {
|
||||
setAllowance: (allowance) => {
|
||||
if (document.getElementById('renter_settings_window').classList.contains('hidden-element')) {
|
||||
setValue('ID_RenterSetFunds', allowance.Funds);
|
||||
setValue('ID_RenterSetHosts', allowance.Hosts);
|
||||
setValue('ID_RenterSetPeriod', allowance.Period);
|
||||
setValue('ID_RenterSetRenewWindow', allowance.RenewWindowInBlocks);
|
||||
AppActions.calculateEstimatedStorage(allowance.Funds, (res)=> {
|
||||
AppActions.calculateEstimatedStorage(allowance.Funds, (res) => {
|
||||
setInnerText('ID_RenterCalcStorage', '~' + res);
|
||||
});
|
||||
}
|
||||
@@ -71,18 +71,18 @@
|
||||
};
|
||||
})();
|
||||
|
||||
const _wallet = (()=> {
|
||||
const _wallet = (() => {
|
||||
return {
|
||||
setConfirmedBalance: (balance)=> {
|
||||
setConfirmedBalance: (balance) => {
|
||||
setInnerText('ID_WalletConfirmedBalance', balance);
|
||||
},
|
||||
setUnconfirmedBalance: (balance)=> {
|
||||
setUnconfirmedBalance: (balance) => {
|
||||
setInnerText('ID_WalletBalanceUnconfirmed', balance);
|
||||
},
|
||||
setTotalBalance: (balance)=> {
|
||||
setTotalBalance: (balance) => {
|
||||
setInnerText('ID_WalletTotalBalance', balance);
|
||||
},
|
||||
setReceiveAddress: (address)=> {
|
||||
setReceiveAddress: (address) => {
|
||||
setInnerText('ID_WalletReceiveAddress', address);
|
||||
}
|
||||
};
|
||||
@@ -97,17 +97,18 @@
|
||||
setServerVersion: (version) => {
|
||||
setInnerText('ID_ServerVersion', version);
|
||||
},
|
||||
setAvailableDriveLetters: (drives)=> {
|
||||
setAvailableDriveLetters: (drives) => {
|
||||
if (document.getElementById('ID_MountButton').innerText !== 'Unmount') {
|
||||
setSelect('ID_MountDrives', drives);
|
||||
}
|
||||
},
|
||||
notifyDriveUnmounted: _notifyDriveUnmounted
|
||||
notifyDriveUnmounted: _notifyDriveUnmounted,
|
||||
reloadApplication: reloadApplication
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
const UiState = (()=> {
|
||||
const UiState = (() => {
|
||||
function _clientVersion() {
|
||||
return 'v' + window.uiState.clientVersion;
|
||||
}
|
||||
@@ -147,7 +148,7 @@
|
||||
console.log('Create wallet');
|
||||
return window.appActions.createWallet(cb);
|
||||
}
|
||||
|
||||
|
||||
function _mountDrive(mountLocation, cb) {
|
||||
console.log('Mount drive: ' + mountLocation);
|
||||
return window.appActions.mountDrive(mountLocation, cb);
|
||||
@@ -181,6 +182,7 @@
|
||||
function _calculateEstimatedStorage(funds, cb) {
|
||||
window.appActions.calculateEstimatedStorage(funds, cb)
|
||||
}
|
||||
|
||||
return {
|
||||
createWallet: _createWallet,
|
||||
mountDrive: _mountDrive,
|
||||
@@ -234,14 +236,14 @@
|
||||
AppActions.startApp();
|
||||
setMainWindow('app_window');
|
||||
const renterEditLink = document.getElementById('ID_Renter_Edit');
|
||||
renterEditLink.onclick = ()=> {
|
||||
renterEditLink.onclick = () => {
|
||||
renterEditLink.onclick = null;
|
||||
handleRenterEditSettings();
|
||||
};
|
||||
const mountButton = document.getElementById('ID_MountButton');
|
||||
const mountSelect = document.getElementById('ID_MountDrives');
|
||||
|
||||
_mountHandler = ()=> {
|
||||
_mountHandler = () => {
|
||||
if (UiState.allocatedRenterFunds() === '0') {
|
||||
displayErrorPopup('Error', 'Renter funding must be configured before trying to mount.')
|
||||
} else {
|
||||
@@ -278,13 +280,13 @@
|
||||
setMainWindow('renter_settings_window');
|
||||
const funds = document.getElementById('ID_RenterSetFunds');
|
||||
funds.oninput = () => {
|
||||
AppActions.calculateEstimatedStorage(funds.value, (res)=> {
|
||||
AppActions.calculateEstimatedStorage(funds.value, (res) => {
|
||||
setInnerText('ID_RenterCalcStorage', '~' + res);
|
||||
});
|
||||
};
|
||||
|
||||
const defaultsButton = document.getElementById('ID_RenterSettingsDefaults');
|
||||
defaultsButton.onclick = ()=> {
|
||||
defaultsButton.onclick = () => {
|
||||
funds.oninput = null;
|
||||
const settings = UiState.defaultRenterSettings();
|
||||
if (getValue('ID_RenterSetFunds') === '0') {
|
||||
@@ -296,7 +298,7 @@
|
||||
};
|
||||
|
||||
const cancelButton = document.getElementById('ID_RenterSettingsCancel');
|
||||
cancelButton.onclick = ()=> {
|
||||
cancelButton.onclick = () => {
|
||||
funds.oninput = null;
|
||||
saveButton.onclick = null;
|
||||
cancelButton.onclick = null;
|
||||
@@ -305,7 +307,7 @@
|
||||
};
|
||||
|
||||
const saveButton = document.getElementById('ID_RenterSettingsOK');
|
||||
saveButton.onclick = ()=> {
|
||||
saveButton.onclick = () => {
|
||||
funds.oninput = null;
|
||||
saveButton.onclick = null;
|
||||
cancelButton.onclick = null;
|
||||
@@ -315,7 +317,7 @@
|
||||
'Hosts': getValue('ID_RenterSetHosts'),
|
||||
'Period': getValue('ID_RenterSetPeriod'),
|
||||
'RenewWindowInBlocks': getValue('ID_RenterSetRenewWindow')
|
||||
}, (success, reason)=> {
|
||||
}, (success, reason) => {
|
||||
if (success) {
|
||||
beginMainApplication();
|
||||
} else {
|
||||
@@ -354,7 +356,7 @@
|
||||
setMainWindow('wallet_created_window');
|
||||
document.getElementById('ID_WalletSeed').innerText = seed;
|
||||
const button = document.getElementById('ID_WalletCreatedButton');
|
||||
button.onclick = ()=> {
|
||||
button.onclick = () => {
|
||||
button.onclick = null;
|
||||
handleUnlockWallet();
|
||||
};
|
||||
@@ -377,8 +379,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
window.addEventListener('load', ()=> {
|
||||
console.log('Main window load');
|
||||
function reloadApplication() {
|
||||
AppActions.stopApp();
|
||||
document.getElementById('ID_SiaDrive').innerText = 'SiaDrive ' + UiState.clientVersion();
|
||||
document.getElementById('ID_ServerVersion').innerText = '...';
|
||||
@@ -395,6 +396,11 @@
|
||||
} else {
|
||||
setMainWindow('offline_window');
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('load', ()=> {
|
||||
console.log('Main window load');
|
||||
reloadApplication();
|
||||
});
|
||||
|
||||
window.onunload = ()=> {
|
||||
|
Reference in New Issue
Block a user