From f93ca218ca60cad2956c076e2cdc103d89cf2350 Mon Sep 17 00:00:00 2001 From: pbca26 Date: Fri, 20 Oct 2017 14:13:23 +0300 Subject: [PATCH] AGT-115, tab resize interval --- .../settings/settings.appSettingsPanel.js | 27 ++++++++++++++----- .../settings/settings.debugLogPanel.js | 23 +++++++++++----- .../components/dashboard/settings/settings.js | 2 +- .../dashboard/settings/settings.panel.js | 1 - .../dashboard/settings/settings.panelBody.js | 23 ++++++++++++---- 5 files changed, 57 insertions(+), 19 deletions(-) diff --git a/react/src/components/dashboard/settings/settings.appSettingsPanel.js b/react/src/components/dashboard/settings/settings.appSettingsPanel.js index 09b89ef..791dee6 100644 --- a/react/src/components/dashboard/settings/settings.appSettingsPanel.js +++ b/react/src/components/dashboard/settings/settings.appSettingsPanel.js @@ -60,7 +60,8 @@ class AppSettingsPanel extends React.Component { if (key.indexOf('__') === -1) { _appSettingsPristine[key] = this.state.appConfigSchema[key] && this.state.appConfigSchema[key].type === 'number' ? Number(_appSettings[key]) : _appSettings[key]; - if (this.state.appConfigSchema[key] && this.state.appConfigSchema[key].type === 'folder' && + if (this.state.appConfigSchema[key] && + this.state.appConfigSchema[key].type === 'folder' && _appSettings[key] && _appSettings[key].length) { const _testLocation = window.require('electron').remote.getCurrentWindow().testLocation; @@ -72,18 +73,20 @@ class AppSettingsPanel extends React.Component { isError = true; Store.dispatch( triggerToaster( - translate('TOASTR.KOMODO_DATADIR_INVALID'), + this.renderLB('TOASTR.KOMODO_DATADIR_INVALID'), translate('INDEX.SETTINGS'), - 'error' + 'error', + false ) ); } else if (res === false) { isError = true; Store.dispatch( triggerToaster( - translate('TOASTR.KOMODO_DATADIR_NOT_DIR'), + this.renderLB('TOASTR.KOMODO_DATADIR_NOT_DIR'), translate('INDEX.SETTINGS'), - 'error' + 'error', + false ) ); } else { @@ -102,6 +105,17 @@ class AppSettingsPanel extends React.Component { } } + renderLB(_translationID) { + const _translationComponents = translate(_translationID).split('
'); + + return _translationComponents.map((_translation) => + + {_translation} +
+
+ ); + } + renderConfigEditForm() { let items = []; const _appConfig = this.state.appSettings; @@ -257,7 +271,8 @@ class AppSettingsPanel extends React.Component { let _appSettings = this.state.appSettings; let _appSettingsPrev = Object.assign({}, _appSettings); - if (!childKey && this.state.appConfigSchema[parentKey].type === 'boolean') { + if (!childKey && + this.state.appConfigSchema[parentKey].type === 'boolean') { _appSettings[parentKey] = typeof _appSettings[parentKey] !== undefined ? !_appSettings[parentKey] : !this.state.appSettings[parentKey]; } else if (childKey && this.state.appConfigSchema[parentKey][childKey].type === 'boolean') { _appSettings[parentKey][childKey] = typeof _appSettings[parentKey][childKey] !== undefined ? !_appSettings[parentKey][childKey] : !this.state.appSettings[parentKey][childKey]; diff --git a/react/src/components/dashboard/settings/settings.debugLogPanel.js b/react/src/components/dashboard/settings/settings.debugLogPanel.js index 0cac3c8..08405e5 100644 --- a/react/src/components/dashboard/settings/settings.debugLogPanel.js +++ b/react/src/components/dashboard/settings/settings.debugLogPanel.js @@ -17,6 +17,7 @@ class DebugLogPanel extends React.Component { debugTarget: 'iguana', nativeOnly: Config.iguanaLessMode, toggleAppRuntimeLog: false, + pristine: true, }; this.readDebugLog = this.readDebugLog.bind(this); this.updateInput = this.updateInput.bind(this); @@ -26,17 +27,21 @@ class DebugLogPanel extends React.Component { } readDebugLog() { + this.setState(Object.assign({}, this.state, { + pristine: false, + })); + Store.dispatch( getDebugLog( - this.state.debugTarget, + 'komodo', this.state.debugLinesCount ) ); } renderAppRuntimeLog() { - let _items = []; const _appRuntimeLog = this.state.appRuntimeLog; + let _items = []; for (let i = 0; i < _appRuntimeLog.length; i++) { _items.push( @@ -74,7 +79,8 @@ class DebugLogPanel extends React.Component { } renderDebugLogData() { - if (this.props.Settings.debugLog) { + if (this.props.Settings.debugLog && + !this.state.pristine) { const _debugLogDataRows = this.props.Settings.debugLog.split('\n'); if (_debugLogDataRows && @@ -106,7 +112,9 @@ class DebugLogPanel extends React.Component { return (
- { this.props.Main.coins && this.props.Main.coins.native && Object.keys(this.props.Main.coins.native).length > 0 && + { this.props.Main.coins && + this.props.Main.coins.native && + Object.keys(this.props.Main.coins.native).length > 0 &&

{ translate('INDEX.DEBUG_LOG_DESC') }

}
@@ -123,10 +131,13 @@ class DebugLogPanel extends React.Component { Show app runtime log + onClick={ this.toggleAppRuntimeLog }>{ translate('SETTINGS.SHOW_APP_RUNTIME_LOG') }
- { !this.state.toggleAppRuntimeLog && this.props.Main.coins && this.props.Main.coins.native && Object.keys(this.props.Main.coins.native).length > 0 && + { !this.state.toggleAppRuntimeLog && + this.props.Main.coins && + this.props.Main.coins.native && + Object.keys(this.props.Main.coins.native).length > 0 &&
{ + if (this.props.active) { + this.setState({ + sectionHeight: `${this.accordionContent.scrollHeight}px`, + }); + } + }, 500); + } + + componentWillUnmount() { + clearInterval(this.accordionResizeInterval); } componentWillReceiveProps(props) { @@ -78,10 +91,10 @@ class PanelSection extends React.Component { }); return( -
this.toggleSection()}> -
+
+
this.toggleSection()} + className="panel-heading"> {title}