fixed clone device redirect url

pull/2/merge
Szymon Lesisz 6 years ago
parent eb0a40c417
commit 0bc4dd3cf9

@ -6,9 +6,10 @@ yarn run build
printf "\n-- COPYING FILES ----------------------\n" printf "\n-- COPYING FILES ----------------------\n"
cd build # cd build
rsync -avz --delete -e ssh . admin@dev.sldev.cz:~/experiments/www # rsync -avz --delete -e ssh . admin@dev.sldev.cz:~/experiments/www
rsync -avz --delete -e ssh ./build/* admin@dev.sldev.cz:~/mytrezor/ethereum/www # rsync -avz --delete -e ssh ./build/* admin@dev.sldev.cz:~/mytrezor/ethereum/www
rsync -avz --delete -e ssh ./build/* admin@dev.sldev.cz:~/experiments/www
cd ../ cd ../
printf "\n-- COMPLETE ---------------------------\n" printf "\n-- COMPLETE ---------------------------\n"

@ -70,8 +70,6 @@ export const start = (device: TrezorDevice, network: string, ignoreCompleted?: b
return; return;
} }
const discovery: State = getState().discovery; const discovery: State = getState().discovery;
let discoveryProcess: ?Discovery = discovery.find(d => d.deviceState === device.state && d.network === network); let discoveryProcess: ?Discovery = discovery.find(d => d.deviceState === device.state && d.network === network);

@ -44,7 +44,7 @@ export type TrezorConnectAction = {
type: typeof CONNECT.SELECT_DEVICE, type: typeof CONNECT.SELECT_DEVICE,
payload: ?{ payload: ?{
id: string, id: string,
instance: string instance: ?number
} }
} | { } | {
type: typeof CONNECT.COIN_CHANGED, type: typeof CONNECT.COIN_CHANGED,
@ -127,9 +127,9 @@ export const init = (): AsyncAction => {
try { try {
await TrezorConnect.init({ await TrezorConnect.init({
transportReconnect: true, transportReconnect: true,
connectSrc: 'https://localhost:8088/', // connectSrc: 'https://localhost:8088/',
// connectSrc: 'https://connect.trezor.io/tpm/', // connectSrc: 'https://connect.trezor.io/tpm/',
// connectSrc: 'https://sisyfos.trezor.io/', connectSrc: 'https://sisyfos.trezor.io/',
debug: false, debug: false,
popup: false, popup: false,
webusb: true webusb: true
@ -256,7 +256,7 @@ export const onSelectDevice = (device: TrezorDevice | Device): ThunkAction => {
} }
// check if current location is not set to this device // check if current location is not set to this device
//dispatch( push(`/device/${ device.features.device_id }/network/etc/address/0`) ); //dispatch( push(`/device/${ device.features.device_id }/network/etc/address/0`) );
if (urlParams.deviceInstance !== instance || urlParams.device !== deviceId) { if (urlParams.deviceInstance !== instance || urlParams.device !== deviceId) {
dispatch( push(url) ); dispatch( push(url) );
} }
@ -485,7 +485,7 @@ export const forget = (device: TrezorDevice): Action => {
}; };
} }
export const duplicateDevice = (device: any): AsyncAction => { export const duplicateDevice = (device: TrezorDevice): AsyncAction => {
return async (dispatch: Dispatch, getState: GetState): Promise<void> => { return async (dispatch: Dispatch, getState: GetState): Promise<void> => {
dispatch({ dispatch({
type: CONNECT.TRY_TO_DUPLICATE, type: CONNECT.TRY_TO_DUPLICATE,

@ -61,7 +61,7 @@ export default class RememberDevice extends Component<Props, State> {
} }
} }
render(): any { render() {
if (!this.props.modal.opened) return null; if (!this.props.modal.opened) return null;
const { device, instances } = this.props.modal; const { device, instances } = this.props.modal;
const { onForgetDevice, onRememberDevice } = this.props.modalActions; const { onForgetDevice, onRememberDevice } = this.props.modalActions;
@ -69,8 +69,8 @@ export default class RememberDevice extends Component<Props, State> {
let label = device.label; let label = device.label;
let devicePlural = false; let devicePlural = false;
if (instances && instances.length > 0) { if (instances && instances.length > 0) {
label = instances.map(i => { label = instances.map((instance, index) => {
return (<span>{i.instanceLabel}</span>); return (<span key={index}>{instance.instanceLabel}</span>);
}) })
devicePlural = instances.length > 1; devicePlural = instances.length > 1;
} }
@ -85,7 +85,8 @@ export default class RememberDevice extends Component<Props, State> {
} }
} }
export const ForgetDevice = (props: any): any => { export const ForgetDevice = (props: Props) => {
if (!props.modal.opened) return null;
const { device } = props.modal; const { device } = props.modal;
const { onForgetSingleDevice, onCancel } = props.modalActions; const { onForgetSingleDevice, onCancel } = props.modalActions;
return ( return (
@ -98,7 +99,8 @@ export const ForgetDevice = (props: any): any => {
); );
} }
export const DisconnectDevice = (props: any): any => { export const DisconnectDevice = (props: Props) => {
if (!props.modal.opened) return null;
const { device } = props.modal; const { device } = props.modal;
const { onForgetSingleDevice, onCancel } = props.modalActions; const { onForgetSingleDevice, onCancel } = props.modalActions;
return ( return (

@ -159,8 +159,7 @@ export class DeviceDropdown extends Component<Props> {
let elem: any = (event.target : any); let elem: any = (event.target : any);
let block: boolean = false; let block: boolean = false;
while (elem.parentElement) { while (elem.parentElement) {
// if (elem.className.indexOf('aside-button') >= 0) { if (elem.tagName.toLowerCase() === 'aside' || (elem.className && elem.className.indexOf && elem.className.indexOf('modal-container') >= 0)) {
if (elem.tagName.toLowerCase() === 'aside' || (elem.className && elem.className.indexOf('modal-container') >= 0)) {
block = true; block = true;
break; break;
} }

@ -1,6 +1,7 @@
/* @flow */ /* @flow */
'use strict'; 'use strict';
import * as MODAL from '../actions/constants/modal';
import * as WEB3 from '../actions/constants/web3'; import * as WEB3 from '../actions/constants/web3';
import * as WALLET from '../actions/constants/wallet'; import * as WALLET from '../actions/constants/wallet';
@ -42,6 +43,12 @@ export default function wallet(state: State = initialState, action: Action): Sta
dropdownOpened: action.opened dropdownOpened: action.opened
} }
case MODAL.CLOSE :
return {
...state,
dropdownOpened: false
}
default: default:
return state; return state;
} }

@ -53,7 +53,7 @@ const validation = (api: MiddlewareAPI, params: RouterLocationState): boolean =>
let device: ?TrezorDevice; let device: ?TrezorDevice;
if (params.hasOwnProperty('deviceInstance')) { if (params.hasOwnProperty('deviceInstance')) {
device = devices.find(d => d.features && d.features.device_id === params.device && d.instance === params.deviceInstance ); device = devices.find(d => d.features && d.features.device_id === params.device && d.instance === parseInt(params.deviceInstance ) );
} else { } else {
device = devices.find(d => d.path === params.device || (d.features && d.features.device_id === params.device)); device = devices.find(d => d.path === params.device || (d.features && d.features.device_id === params.device));
} }
@ -136,7 +136,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
type: CONNECT.SELECT_DEVICE, type: CONNECT.SELECT_DEVICE,
payload: { payload: {
id: requestedParams.device, id: requestedParams.device,
instance: requestedParams.deviceInstance instance: requestedParams.deviceInstance ? parseInt(requestedParams.deviceInstance) : undefined
} }
}); });
} }

Loading…
Cancel
Save