Merge pull request #1569 from amitnndn/master

Adding ability to view logs and open log directory
This commit is contained in:
Sean Yesmunt 2018-06-13 12:37:54 -04:00 committed by GitHub
commit 02a9139ddd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 84 additions and 9 deletions

View file

@ -20,5 +20,6 @@ module.name_mapper='^lbry\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/lbry\1'
module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/rewards\1'
module.name_mapper='^modal\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/modal\1'
module.name_mapper='^app\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/app\1'
module.name_mapper='^native\(.*\)$' -> '<PROJECT_ROOT>/src/renderer/native\1'
[strict]

View file

@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
### Added
* Add ability to open log file and log directory in the help page ([#1556](https://github.com/lbryio/lbry-app/issues/1556))
* Add ability to resend verification email ([#1492](https://github.com/lbryio/lbry-app/issues/1492))
* Add Narrative about Feature Request on Help Page and Report Page ([#1551](https://github.com/lbryio/lbry-app/pull/1551))
* Add keyboard shortcut to quit the app on Windows ([#1202](https://github.com/lbryio/lbry-app/pull/1202))
@ -27,6 +28,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
* Move rewards logic to interal api ([#1509](https://github.com/lbryio/lbry-app/pull/1509))
### Fixed
* Fixing content address extending outside of visible area. ([#741](https://github.com/lbryio/lbry-app/issues/741))
* Fix content-type not shown correctly in file description ([#863](https://github.com/lbryio/lbry-app/pull/863))
* Fix [Flow](https://flow.org/) ([#1197](https://github.com/lbryio/lbry-app/pull/1197))
* Fix black screen on macOS after maximizing LBRY and then closing ([#1235](https://github.com/lbryio/lbry-app/pull/1235))

View file

@ -1,12 +1,14 @@
import { connect } from 'react-redux';
import { doAuthNavigate } from 'redux/actions/navigation';
import { doFetchAccessToken } from 'redux/actions/user';
import { selectDaemonSettings } from 'redux/selectors/settings';
import { selectAccessToken, selectUser } from 'redux/selectors/user';
import HelpPage from './view';
const select = state => ({
user: selectUser(state),
accessToken: selectAccessToken(state),
deamonSettings: selectDaemonSettings(state),
});
const perform = dispatch => ({
@ -14,4 +16,7 @@ const perform = dispatch => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()),
});
export default connect(select, perform)(HelpPage);
export default connect(
select,
perform
)(HelpPage);

View file

@ -1,15 +1,44 @@
// @TODO: Customize advice based on OS
import React from 'react';
// @flow
import * as React from 'react';
import { shell } from 'electron';
import { Lbry } from 'lbry-redux';
import Native from 'native';
import Button from 'component/button';
import BusyIndicator from 'component/common/busy-indicator';
import Icon from 'component/common/icon';
import Page from 'component/page';
import * as icons from 'constants/icons';
class HelpPage extends React.PureComponent {
constructor(props) {
type DeamonSettings = {
data_dir: string | any,
};
type Props = {
deamonSettings: DeamonSettings,
accessToken: string,
fetchAccessToken: () => void,
doAuth: () => void,
user: any,
};
type VersionInfo = {
os_system: string,
os_release: string,
platform: string,
lbrynet_version: string,
lbryum_version: string,
};
type State = {
versionInfo: VersionInfo | any,
lbryId: String | any,
uiVersion: ?string,
upgradeAvailable: ?boolean,
accessTokenHidden: ?boolean,
};
class HelpPage extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
@ -20,11 +49,12 @@ class HelpPage extends React.PureComponent {
accessTokenHidden: true,
};
this.showAccessToken = this.showAccessToken.bind(this);
(this: any).showAccessToken = this.showAccessToken.bind(this);
(this: any).openLogFile = this.openLogFile.bind(this);
}
componentDidMount() {
Native.getAppVersionInfo().then(({ remoteVersion, localVersion, upgradeAvailable }) => {
Native.getAppVersionInfo().then(({ localVersion, upgradeAvailable }) => {
this.setState({
uiVersion: localVersion,
upgradeAvailable,
@ -50,13 +80,24 @@ class HelpPage extends React.PureComponent {
});
}
openLogFile(userHomeDirectory: string) {
const logFileName = 'lbrynet.log';
const os = this.state.versionInfo.os_system;
if (os === 'Darwin' || os === 'Linux') {
shell.openItem(`${userHomeDirectory}/${logFileName}`);
} else {
shell.openItem(`${userHomeDirectory}\\${logFileName}`);
}
}
render() {
let ver;
let osName;
let platform;
let newVerLink;
const { accessToken, doAuth, user } = this.props;
const { accessToken, doAuth, user, deamonSettings } = this.props;
const { data_dir: dataDirectory } = deamonSettings;
if (this.state.versionInfo) {
ver = this.state.versionInfo;
@ -108,12 +149,34 @@ class HelpPage extends React.PureComponent {
</div>
</section>
<section className="card card--section">
<div className="card__title">{__('View your Log')}</div>
<p className="card__subtitle">
{__(
'Do you find something wrong? Have a look in your log, or send your log to support for some help.'
)}
</p>
<div className="card__actions">
<Button
button="primary"
label={__('Open Log')}
icon={icons.REPORT}
onClick={() => this.openLogFile(dataDirectory)}
/>
<Button
button="primary"
label={__('Open Log Folder')}
icon={icons.REPORT}
onClick={() => shell.showItemInFolder(dataDirectory)}
/>
</div>
</section>
<section className="card card--section">
<div className="card__title">{__('Report a Bug or Suggest a New Feature')}</div>
<p className="card__subtitle">
{__('Did you find something wrong? Think LBRY could add something useful and cool?')}
</p>
<div className="card__actions">
<Button
navigate="/report"

View file

@ -8,6 +8,10 @@
flex-direction: column;
}
.card > h1 {
word-wrap: break-word;
}
.card--section {
background-color: var(--card-bg);
padding: $spacing-vertical;