From 05e1ad20b1d659004aa269721aa9b89608db7a01 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Tue, 10 Jan 2017 12:00:24 +0100 Subject: [PATCH] Move log levels to Parity tab --- js/src/routes.js | 3 - js/src/views/Settings/Advanced/advanced.js | 105 --------------------- js/src/views/Settings/Advanced/index.js | 17 ---- js/src/views/Settings/Parity/parity.js | 105 ++++++++++++++++++++- js/src/views/Settings/index.js | 2 - 5 files changed, 101 insertions(+), 131 deletions(-) delete mode 100644 js/src/views/Settings/Advanced/advanced.js delete mode 100644 js/src/views/Settings/Advanced/index.js diff --git a/js/src/routes.js b/js/src/routes.js index f1bf74c09b6..20fb3dba61b 100644 --- a/js/src/routes.js +++ b/js/src/routes.js @@ -22,8 +22,6 @@ import { Wallet, Web, WriteContract } from '~/views'; -import { SettingsAdvanced } from '~/views/Settings'; - function handleDeprecatedRoute (nextState, replace) { const { address } = nextState.params; const redirectMap = { @@ -62,7 +60,6 @@ const contractsRoutes = [ ]; const settingsRoutes = [ - { path: 'advanced', component: SettingsAdvanced }, { path: 'background', component: SettingsBackground }, { path: 'proxy', component: SettingsProxy }, { path: 'views', component: SettingsViews }, diff --git a/js/src/views/Settings/Advanced/advanced.js b/js/src/views/Settings/Advanced/advanced.js deleted file mode 100644 index 685d63d7dfd..00000000000 --- a/js/src/views/Settings/Advanced/advanced.js +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2015, 2016 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component } from 'react'; -import LogLevel from 'loglevel'; - -import { Container, Select } from '~/ui'; -import { LOG_KEYS } from '~/config'; - -import layout from '../layout.css'; - -export default class AdvancedSettings extends Component { - - state = { - loglevels: {}, - selectValues: [] - }; - - componentWillMount () { - this.loadLogLevels(); - - const selectValues = Object.keys(LogLevel.levels).map((levelName) => { - const value = LogLevel.levels[levelName]; - - return { - name: levelName, - value - }; - }); - - this.setState({ selectValues }); - } - - loadLogLevels () { - const nextState = { ...this.state.logLevels }; - - Object.keys(LOG_KEYS).map((logKey) => { - const log = LOG_KEYS[logKey]; - - const logger = LogLevel.getLogger(log.path); - const level = logger.getLevel(); - - nextState[logKey] = { level, log }; - }); - - this.setState({ logLevels: nextState }); - } - - render () { - return ( - -
-
-
- Choose the different logs level. -
-
-
- { this.renderLogsLevels() } -
-
-
- ); - } - - renderLogsLevels () { - const { logLevels, selectValues } = this.state; - - return Object.keys(logLevels).map((logKey) => { - const { level, log } = logLevels[logKey]; - const { path, desc } = log; - - const onChange = (_, index) => { - const nextLevel = Object.values(selectValues)[index].value; - LogLevel.getLogger(path).setLevel(nextLevel); - this.loadLogLevels(); - }; - - return ( -
-
{ path }
-

{ desc }

- +
+ ); + }); + } + renderModes () { const { mode } = this.state; diff --git a/js/src/views/Settings/index.js b/js/src/views/Settings/index.js index 4f75ac90622..878a874526b 100644 --- a/js/src/views/Settings/index.js +++ b/js/src/views/Settings/index.js @@ -16,7 +16,6 @@ import settingsReducer from './reducers'; import { toggleView, updateBackground } from './actions'; -import SettingsAdvanced from './Advanced'; import SettingsBackground from './Background'; import SettingsParity from './Parity'; import SettingsProxy from './Proxy'; @@ -25,7 +24,6 @@ import SettingsViews, { defaultViews } from './Views'; export default from './settings'; export { - SettingsAdvanced, SettingsBackground, SettingsParity, SettingsProxy,