Ui 2 expand method filters (#5974)

* Add account & vault APIs

* Additional status methods

* Move permission modals into Dapp

* Adjust display position

* Don't publish invalid events
This commit is contained in:
Jaco Greeff 2017-07-03 17:05:56 +02:00 committed by GitHub
parent 7f77e6004c
commit 15a9e56b09
21 changed files with 84 additions and 51 deletions

View File

@ -38,6 +38,7 @@ export default function Request ({ appId, className, approveRequest, denyRequest
method method
} } } }
/> />
<div>
<Button <Button
label={ label={
<FormattedMessage <FormattedMessage
@ -66,6 +67,7 @@ export default function Request ({ appId, className, approveRequest, denyRequest
onClick={ _onReject } onClick={ _onReject }
/> />
</div> </div>
</div>
); );
} }

View File

@ -18,13 +18,16 @@
.requests { .requests {
background: #f80; background: #f80;
color: white; color: white;
bottom: 0;
position: fixed; position: fixed;
left: 0; left: 0;
right: 0; right: 0;
top: 0;
z-index: 760; /* sits above requests */ z-index: 760; /* sits above requests */
.request { .request {
align-items: center;
display: flex;
justify-content: flex-end;
padding: 0.5em; padding: 0.5em;
> span { > span {

View File

@ -17,5 +17,29 @@
export default { export default {
'parity_accountsInfo': {}, 'parity_accountsInfo': {},
'parity_allAccountsInfo': {}, 'parity_allAccountsInfo': {},
'parity_hashContent': {} 'parity_changeVault': {},
'parity_changeVaultPassword': {},
'parity_consensusCapability': {},
'parity_checkRequest': {},
'parity_closeVault': {},
'parity_executeUpgrade': {},
'parity_generateSecretPhrase': {},
'parity_getVaultMeta': {},
'parity_hashContent': {},
'parity_importGethAccounts': {},
'parity_localTransactions': {},
'parity_listGethAccounts': {},
'parity_listVaults': {},
'parity_listOpenedVaults': {},
'parity_newAccountFromPhrase': {},
'parity_newAccountFromSecret': {},
'parity_newAccountFromWallet': {},
'parity_newVault': {},
'parity_openVault': {},
'parity_phraseToAddress': {},
'parity_setAccountMeta': {},
'parity_setAccountName': {},
'parity_setVaultMeta': {},
'parity_upgradeReady': {},
'parity_versionInfo': {}
}; };

View File

@ -17,7 +17,7 @@
import { action, computed, observable } from 'mobx'; import { action, computed, observable } from 'mobx';
import filteredRequests from './filteredRequests'; import filteredRequests from './filteredRequests';
import MethodsStore from '../DappMethods/store'; import MethodsStore from '../Dapps/SelectMethods/store';
let nextQueueId = 0; let nextQueueId = 0;
@ -116,9 +116,13 @@ export default class Store {
} }
receiveMessage = ({ data, origin, source }) => { receiveMessage = ({ data, origin, source }) => {
if (!data) {
return;
}
const { from, method, token } = data; const { from, method, token } = data;
if (from === 'shell' || from !== token) { if (!from || from === 'shell' || from !== token) {
return; return;
} }

View File

@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default from './dappsVisible'; export default from './selectAccounts';

View File

@ -21,7 +21,7 @@ import { FormattedMessage } from 'react-intl';
import { AccountCard, Portal, SelectionList } from '@parity/ui'; import { AccountCard, Portal, SelectionList } from '@parity/ui';
@observer @observer
export default class DappAccounts extends Component { export default class SelectAccounts extends Component {
static propTypes = { static propTypes = {
permissionStore: PropTypes.object.isRequired permissionStore: PropTypes.object.isRequired
}; };

View File

@ -29,7 +29,7 @@ function renderShallow (permissionStore = {}) {
return component; return component;
} }
describe('shell/DappAccounts', () => { describe('shell/Dapps/SelectAccounts', () => {
describe('rendering', () => { describe('rendering', () => {
it('renders defaults', () => { it('renders defaults', () => {
expect(renderShallow()).to.be.ok; expect(renderShallow()).to.be.ok;

View File

@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default from './dappMethods'; export default from './selectMethods';

View File

@ -21,10 +21,10 @@ import { FormattedMessage } from 'react-intl';
import { Portal } from '@parity/ui'; import { Portal } from '@parity/ui';
import MethodCheck from './MethodCheck'; import MethodCheck from './MethodCheck';
import styles from './dappMethods.css'; import styles from './selectMethods.css';
@observer @observer
export default class DappsMethods extends Component { export default class SelectMethods extends Component {
static propTypes = { static propTypes = {
methodsStore: PropTypes.object.isRequired, methodsStore: PropTypes.object.isRequired,
visibleStore: PropTypes.object.isRequired visibleStore: PropTypes.object.isRequired

View File

@ -19,7 +19,7 @@ import store from 'store';
import { sha3 } from '@parity/api/util/sha3'; import { sha3 } from '@parity/api/util/sha3';
import filteredRequests from '../DappRequests/filteredRequests'; import filteredRequests from '../../DappRequests/filteredRequests';
const LS_PERMISSIONS = '_parity::dapps::methods'; const LS_PERMISSIONS = '_parity::dapps::methods';

View File

@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default from './dappAccounts'; export default from './selectVisible';

View File

@ -20,10 +20,10 @@ import { FormattedMessage } from 'react-intl';
import { DappCard, Portal, SelectionList } from '@parity/ui'; import { DappCard, Portal, SelectionList } from '@parity/ui';
import styles from './dappsVisible.css'; import styles from './selectVisible.css';
@observer @observer
export default class DappsVisible extends Component { export default class SelectVisible extends Component {
static propTypes = { static propTypes = {
store: PropTypes.object.isRequired store: PropTypes.object.isRequired
}; };

View File

@ -25,7 +25,7 @@ function renderShallow (store = {}) {
); );
} }
describe('shell/DappsVisible', () => { describe('shell/Dapps/SelectVisible', () => {
describe('rendering', () => { describe('rendering', () => {
it('renders defaults', () => { it('renders defaults', () => {
expect(renderShallow()).to.be.ok; expect(renderShallow()).to.be.ok;

View File

@ -23,11 +23,11 @@ import { connect } from 'react-redux';
import { Actionbar, Button, Checkbox, DappCard, Page, SectionList } from '@parity/ui'; import { Actionbar, Button, Checkbox, DappCard, Page, SectionList } from '@parity/ui';
import { LockedIcon, MethodsIcon, VisibleIcon } from '@parity/ui/Icons'; import { LockedIcon, MethodsIcon, VisibleIcon } from '@parity/ui/Icons';
import DappAccounts from '../DappAccounts'; import SelectAccounts from './SelectAccounts';
import PermissionStore from '../DappAccounts/store'; import PermissionStore from './SelectAccounts/store';
import DappMethods from '../DappMethods'; import DappSelectMethods from './SelectMethods';
import MethodsStore from '../DappMethods/store'; import MethodsStore from './SelectMethods/store';
import DappsVisible from '../DappsVisible'; import SelectVisible from './SelectVisible';
import DappsStore from './dappsStore'; import DappsStore from './dappsStore';
@ -83,12 +83,12 @@ class Dapps extends Component {
return ( return (
<div> <div>
<DappAccounts permissionStore={ this.permissionStore } /> <SelectAccounts permissionStore={ this.permissionStore } />
<DappMethods <DappSelectMethods
methodsStore={ this.methodsStore } methodsStore={ this.methodsStore }
visibleStore={ this.store } visibleStore={ this.store }
/> />
<DappsVisible store={ this.store } /> <SelectVisible store={ this.store } />
<Actionbar <Actionbar
className={ styles.toolbar } className={ styles.toolbar }
title={ title={

View File

@ -42,7 +42,7 @@ import SecureApi from '~/secureApi';
import Application from './Application'; import Application from './Application';
import Dapp from './Dapp'; import Dapp from './Dapp';
import { setupProviderFilters } from './DappRequests'; import { setupProviderFilters } from './DappRequests';
import DappMethodsStore from './DappMethods/store'; import DappMethodsStore from './Dapps/SelectMethods/store';
import Dapps from './Dapps'; import Dapps from './Dapps';
injectTapEventPlugin(); injectTapEventPlugin();