diff --git a/react/change.log b/react/change.log index ca49259..d856f0b 100644 --- a/react/change.log +++ b/react/change.log @@ -21,6 +21,11 @@ UI: - zcashparams folder check - claim interest modal - renewed transactions history look +- prevent app from closing while komodod is still loading/processing data +- send form validation +- coin daemon port check on addcoin +- updated application settings +- komodo datadir v0.2.0.21a-beta -------------- diff --git a/react/src/components/dashboard/settings/settings.js b/react/src/components/dashboard/settings/settings.js index 20a685d..988f567 100644 --- a/react/src/components/dashboard/settings/settings.js +++ b/react/src/components/dashboard/settings/settings.js @@ -16,6 +16,7 @@ import { shepherdCli, checkForUpdateUIPromise, updateUIPromise, + triggerToaster, } from '../../../actions/actionCreators'; import Store from '../../../store'; @@ -447,17 +448,53 @@ class Settings extends React.Component { _saveAppConfig() { const _appSettings = this.state.appSettings; let _appSettingsPristine = Object.assign({}, this.props.Settings.appSettings); + let isError = false; + let saveAfterPathCheck = false; for (let key in _appSettings) { if (key.indexOf('__') === -1) { _appSettingsPristine[key] = this.state.appConfigSchema[key].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; + + if (this.state.appConfigSchema[key].type === 'folder' && + _appSettings[key] && + _appSettings[key].length) { + const _testLocation = window.require('electron').remote.getCurrentWindow().testLocation; + saveAfterPathCheck = true; + + _testLocation(_appSettings[key]) + .then((res) => { + if (res === -1) { + isError = true; + Store.dispatch( + triggerToaster( + 'Komodo datadir path is invalid', + translate('INDEX.SETTINGS'), + 'error' + ) + ); + } else if (res === false) { + isError = true; + Store.dispatch( + triggerToaster( + 'Komodo datadir path is not a directory', + translate('INDEX.SETTINGS'), + 'error' + ) + ); + } else { + Store.dispatch(saveAppConfig(_appSettingsPristine)); + } + }); + } } else { const _nestedKey = key.split('__'); _appSettingsPristine[_nestedKey[0]][_nestedKey[1]] = this.state.appConfigSchema[_nestedKey[0]][_nestedKey[1]].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; } } - Store.dispatch(saveAppConfig(_appSettingsPristine)); + if (!saveAfterPathCheck) { + Store.dispatch(saveAppConfig(_appSettingsPristine)); + } } renderConfigEditForm() { @@ -502,11 +539,12 @@ class Settings extends React.Component { value={ _appConfig[key][_key] } onChange={ (event) => this.updateInputSettings(event, key, _key) } /> } - { this.state.appConfigSchema[key][_key].type === 'string' && + { (this.state.appConfigSchema[key][_key].type === 'string' || this.state.appConfigSchema[key][_key].type === 'folder') && this.updateInputSettings(event, key, _key) } /> } { this.state.appConfigSchema[key][_key].type === 'boolean' && @@ -549,11 +587,12 @@ class Settings extends React.Component { value={ _appConfig[key] } onChange={ (event) => this.updateInputSettings(event, key) } /> } - { this.state.appConfigSchema[key].type === 'string' && + { (this.state.appConfigSchema[key].type === 'string' || this.state.appConfigSchema[key].type === 'folder') && this.updateInputSettings(event, key) } /> } { this.state.appConfigSchema[key].type === 'boolean' && diff --git a/react/src/components/overrides.scss b/react/src/components/overrides.scss index 5d739c2..1422ea2 100644 --- a/react/src/components/overrides.scss +++ b/react/src/components/overrides.scss @@ -1071,6 +1071,13 @@ select{ top: 4px; } table { - width: 80%; + width: 100%; + + td:first-child { + width: 40%; + } + td:last-child { + width: 60%; + } } } \ No newline at end of file