Browse Source

Merge pull request #661 from gre/cmd-e

add Ctrl+E to export logs
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
74ec47fa67
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      package.json
  2. 14
      src/components/ExportLogsBtn.js
  3. 2
      src/components/layout/Default.js
  4. 7
      yarn.lock

1
package.json

@ -75,6 +75,7 @@
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-i18next": "^7.7.0",
"react-key-handler": "^1.0.1",
"react-markdown": "^3.3.2",
"react-mortal": "^3.2.0",
"react-motion": "^0.5.2",

14
src/components/ExportLogsBtn.js

@ -6,6 +6,7 @@ import { webFrame, remote } from 'electron'
import React, { Component } from 'react'
import { translate } from 'react-i18next'
import { connect } from 'react-redux'
import KeyHandler from 'react-key-handler'
import { createStructuredSelector, createSelector } from 'reselect'
import { accountsSelector, encodeAccountsModel } from 'reducers/accounts'
import { storeSelector as settingsSelector } from 'reducers/settings'
@ -20,6 +21,7 @@ class ExportLogsBtn extends Component<{
t: *,
settings: *,
accounts: *,
hookToShortcut?: boolean,
}> {
handleExportLogs = () => {
const { accounts, settings } = this.props
@ -49,9 +51,17 @@ class ExportLogsBtn extends Component<{
}
}
onKeyHandle = e => {
if (e.ctrlKey) {
this.handleExportLogs()
}
}
render() {
const { t } = this.props
return (
const { t, hookToShortcut } = this.props
return hookToShortcut ? (
<KeyHandler keyValue="e" onKeyHandle={this.onKeyHandle} />
) : (
<Button primary onClick={this.handleExportLogs}>
{t('app:settings.exportLogs.btn')}
</Button>

2
src/components/layout/Default.js

@ -20,6 +20,7 @@ import SettingsPage from 'components/SettingsPage'
import LibcoreBusyIndicator from 'components/LibcoreBusyIndicator'
import DeviceBusyIndicator from 'components/DeviceBusyIndicator'
import TriggerAppReady from 'components/TriggerAppReady'
import ExportLogsBtn from 'components/ExportLogsBtn'
import AppRegionDrag from 'components/AppRegionDrag'
import IsUnlocked from 'components/IsUnlocked'
@ -75,6 +76,7 @@ class Default extends Component<Props> {
<Fragment>
<TriggerAppReady />
{process.platform === 'darwin' && <AppRegionDrag />}
<ExportLogsBtn hookToShortcut />
<IsUnlocked>
{Object.entries(modals).map(([name, ModalComponent]: [string, any]) => (

7
yarn.lock

@ -11553,6 +11553,13 @@ react-is@^16.4.1:
version "16.4.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.4.1.tgz#d624c4650d2c65dbd52c72622bbf389435d9776e"
react-key-handler@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/react-key-handler/-/react-key-handler-1.0.1.tgz#1fc0f4f4855f506a192c2cbe9fe8cb78fc553191"
dependencies:
exenv "^1.2.0"
prop-types "^15.5.7"
react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"

Loading…
Cancel
Save