Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix pasting of value in Input fields (#4555)
Browse files Browse the repository at this point in the history
* Fix logging and logger issues

* onPaste submit value + pasted text (#4553)
  • Loading branch information
ngotchac authored and jacogr committed Feb 15, 2017
1 parent 3218c36 commit 8aaa18d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 4 additions & 0 deletions js/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export const LOG_KEYS = {
key: 'balances',
desc: 'Balances fetching'
},
CertificationsMiddleware: {
key: 'certifications.middleware',
desc: 'Certifications Middleware'
},
TransferModalStore: {
key: 'modalsTransferStore',
desc: 'Transfer modal MobX store'
Expand Down
12 changes: 8 additions & 4 deletions js/src/redux/providers/certifications/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@

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 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
const updatableFilter = (api, onFilter) => {
Expand Down Expand Up @@ -180,10 +184,10 @@ export default class CertificationsMiddleware {
})
.catch((err) => {
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);
});
});

Expand Down
5 changes: 3 additions & 2 deletions js/src/ui/Form/Input/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ export default class Input extends Component {
}

onPaste = (event) => {
const value = event.clipboardData.getData('Text');
const { value } = event.target;
const pasted = event.clipboardData.getData('Text');

window.setTimeout(() => {
this.onSubmit(value);
this.onSubmit(value + pasted);
}, 0);
}

Expand Down
4 changes: 2 additions & 2 deletions js/src/views/Settings/Parity/parity.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ export default class Parity extends Component {
.keys(logLevels)
.map((key) => {
const { level, log } = logLevels[key];
const { path, desc } = log;
const { desc } = log;

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 (
Expand Down
6 changes: 3 additions & 3 deletions js/src/views/Settings/Parity/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class Store {
}

@action setLogLevels = (logLevels) => {
this.logLevels = logLevels;
this.logLevels = { ...logLevels };
}

@action setLogLevelsSelect = (logLevelsSelect) => {
Expand Down Expand Up @@ -83,8 +83,8 @@ export default class Store {
);
}

updateLoggerLevel (path, level) {
LogLevel.getLogger(path).setLevel(level);
updateLoggerLevel (key, level) {
LogLevel.getLogger(key).setLevel(level);
this.loadLogLevels();
}

Expand Down

0 comments on commit 8aaa18d

Please sign in to comment.