Fix pasting of value in Input fields (#4555)

* Fix logging and logger issues

* onPaste submit value + pasted text (#4553)
This commit is contained in:
Nicolas Gotchac 2017-02-15 13:37:58 +01:00 committed by Jaco Greeff
parent 3218c365e9
commit 8aaa18d75d
5 changed files with 20 additions and 11 deletions

View File

@ -21,6 +21,10 @@ export const LOG_KEYS = {
key: 'balances', key: 'balances',
desc: 'Balances fetching' desc: 'Balances fetching'
}, },
CertificationsMiddleware: {
key: 'certifications.middleware',
desc: 'Certifications Middleware'
},
TransferModalStore: { TransferModalStore: {
key: 'modalsTransferStore', key: 'modalsTransferStore',
desc: 'Transfer modal MobX store' desc: 'Transfer modal MobX store'

View File

@ -16,10 +16,14 @@
import { uniq, range, debounce } from 'lodash'; import { uniq, range, debounce } from 'lodash';
import CertifierABI from '~/contracts/abi/certifier.json'; import { addCertification, removeCertification } from './actions';
import { getLogger, LOG_KEYS } from '~/config';
import Contract from '~/api/contract'; import Contract from '~/api/contract';
import Contracts from '~/contracts'; import Contracts from '~/contracts';
import { addCertification, removeCertification } from './actions'; import CertifierABI from '~/contracts/abi/certifier.json';
const log = getLogger(LOG_KEYS.CertificationsMiddleware);
// TODO: move this to a more general place // TODO: move this to a more general place
const updatableFilter = (api, onFilter) => { const updatableFilter = (api, onFilter) => {
@ -180,10 +184,10 @@ export default class CertificationsMiddleware {
}) })
.catch((err) => { .catch((err) => {
if (/does not exist/.test(err.toString())) { if (/does not exist/.test(err.toString())) {
return console.warn(err.toString()); return log.info(err.toString());
} }
console.warn(`Could not fetch certifier ${id}:`, err); log.warn(`Could not fetch certifier ${id}:`, err);
}); });
}); });

View File

@ -218,10 +218,11 @@ export default class Input extends Component {
} }
onPaste = (event) => { onPaste = (event) => {
const value = event.clipboardData.getData('Text'); const { value } = event.target;
const pasted = event.clipboardData.getData('Text');
window.setTimeout(() => { window.setTimeout(() => {
this.onSubmit(value); this.onSubmit(value + pasted);
}, 0); }, 0);
} }

View File

@ -106,10 +106,10 @@ export default class Parity extends Component {
.keys(logLevels) .keys(logLevels)
.map((key) => { .map((key) => {
const { level, log } = logLevels[key]; const { level, log } = logLevels[key];
const { path, desc } = log; const { desc } = log;
const onChange = (_, index) => { const onChange = (_, index) => {
this.store.updateLoggerLevel(path, Object.values(LOGLEVEL_OPTIONS)[index].value); this.store.updateLoggerLevel(log.key, Object.values(LOGLEVEL_OPTIONS)[index].value);
}; };
return ( return (

View File

@ -40,7 +40,7 @@ export default class Store {
} }
@action setLogLevels = (logLevels) => { @action setLogLevels = (logLevels) => {
this.logLevels = logLevels; this.logLevels = { ...logLevels };
} }
@action setLogLevelsSelect = (logLevelsSelect) => { @action setLogLevelsSelect = (logLevelsSelect) => {
@ -83,8 +83,8 @@ export default class Store {
); );
} }
updateLoggerLevel (path, level) { updateLoggerLevel (key, level) {
LogLevel.getLogger(path).setLevel(level); LogLevel.getLogger(key).setLevel(level);
this.loadLogLevels(); this.loadLogLevels();
} }