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

Status page updates #3774

Merged
merged 13 commits into from
Dec 10, 2016
5 changes: 4 additions & 1 deletion js/src/redux/providers/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export default class Status {
this._api.eth
.getBlockByNumber(blockNumber)
.then((block) => {
this._store.dispatch(statusCollection({ gasLimit: block.gasLimit }));
this._store.dispatch(statusCollection({
blockTimestamp: block.timestamp,
gasLimit: block.gasLimit
}));
})
.catch((error) => {
console.warn('status._subscribeBlockNumber', 'getBlockByNumber', error);
Expand Down
1 change: 1 addition & 0 deletions js/src/redux/providers/statusReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { handleActions } from 'redux-actions';

const initialState = {
blockNumber: new BigNumber(0),
blockTimestamp: new Date(),
devLogs: [],
devLogsLevels: null,
devLogsEnabled: false,
Expand Down
4 changes: 3 additions & 1 deletion js/src/ui/Actionbar/actionbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import React, { Component, PropTypes } from 'react';
import { Toolbar, ToolbarGroup } from 'material-ui/Toolbar';

import { nodeOrStringProptype } from '~/util/proptypes';

import styles from './actionbar.css';

export default class Actionbar extends Component {
static propTypes = {
title: PropTypes.string,
title: nodeOrStringProptype(),
buttons: PropTypes.array,
children: PropTypes.node,
className: PropTypes.string
Expand Down
4 changes: 2 additions & 2 deletions js/src/ui/Page/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.layout {
padding: 0.25em 0.25em 1em 0.25em;

> * {
margin-bottom: 0.75em;
&>div {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for that ? The & is useless, and we might not want to limit to divs. padding instead of margin is what was breaking the event pannel in Contracts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without that approach, you get a border around the full Page + Actionbar, instead of just the content below. So We are saying - only add border around the direct decendents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scrap the above, wrong comment, been too long between writing and review. Will need to go back and see why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapped to margin.

I recall now. The reasson why this was originally introduced (not this PR actually, this was just supposed to move stuff around) it to not make the fixed statusbar at the bottom overlap with the page. Any other solution and you start having funnies across the different pages, e.g. dapps as well.

May be good to have a re-look at this in your fixes branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is supposed to be a property of the .page class and not its descendants. That's why there is padding: 0.25em 0.25em 1em 0.25em for the Page Component. Anyway, looks good now :)

padding-bottom: 0.75em;
}
}
25 changes: 21 additions & 4 deletions js/src/ui/Page/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,38 @@

import React, { Component, PropTypes } from 'react';

import Actionbar from '../Actionbar';
import { nodeOrStringProptype } from '~/util/proptypes';

import styles from './page.css';

export default class Page extends Component {
static propTypes = {
buttons: PropTypes.array,
className: PropTypes.string,
children: PropTypes.node
children: PropTypes.node,
title: nodeOrStringProptype()
};

render () {
const { className, children } = this.props;
const { buttons, className, children, title } = this.props;
const classes = `${styles.layout} ${className}`;
let actionbar = null;

if (title || buttons) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

actionbar = (
<Actionbar
buttons={ buttons }
title={ title } />
);
}

return (
<div className={ classes }>
{ children }
<div>
{ actionbar }
<div className={ classes }>
{ children }
</div>
</div>
);
}
Expand Down
3 changes: 1 addition & 2 deletions js/src/views/Signer/signer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export default class Signer extends Component {
render () {
return (
<div>
<Actionbar
title='Trusted Signer' />
<Actionbar title='Trusted Signer' />
<RequestsPage />
</div>
);
Expand Down
12 changes: 6 additions & 6 deletions js/src/views/Signer/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ export default class Store {
}
}

@action unsubscribe () {
if (this._timeoutId) {
clearTimeout(this._timeoutId);
}
}

@action setBalance = (address, balance) => {
this.setBalances({ [address]: balance });
}
Expand All @@ -50,6 +44,12 @@ export default class Store {
}
}

@action unsubscribe () {
if (this._timeoutId) {
clearTimeout(this._timeoutId);
}
}

fetchBalance (address) {
this._api.eth
.getBalance(address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import ReorderIcon from 'material-ui/svg-icons/action/reorder';

import { Container } from '~/ui';

import styles from './Debug.css';
import styles from './debug.css';

export default class Debug extends Component {
static propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion js/src/views/Status/components/Debug/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

export default from './Debug';
export default from './debug';
2 changes: 1 addition & 1 deletion js/src/views/Status/components/MiningSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

export default from './MiningSettings';
export default from './miningSettings';
2 changes: 1 addition & 1 deletion js/src/views/Status/components/Status/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

export default from './Status';
export default from './status';
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@
content: '';
}

.blockinfo {
font-size: 24px;
.blockInfo {
color: #aaa;
line-height: 24px;
font-size: 1.5em;
line-height: 1.5em;
}

.blockByline {
color: #aaa;
font-size: 0.75em;
}

.padBottom {
padding-bottom: 1.25em !important;
}

.col,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

import React, { Component, PropTypes } from 'react';
import bytes from 'bytes';
import moment from 'moment';
import React, { Component, PropTypes } from 'react';

import { Container, ContainerTitle, Input } from '~/ui';

import styles from './Status.css';
import MiningSettings from '../MiningSettings';
import MiningSettings from '../miningSettings';

import styles from './status.css';

export default class Status extends Component {
static propTypes = {
Expand All @@ -44,23 +46,26 @@ export default class Status extends Component {
<div className={ styles.container }>
<div className={ styles.row }>
<div className={ styles.col3 }>
<div className={ styles.col12 }>
<div className={ `${styles.col12} ${styles.padBottom}` }>
<ContainerTitle title='best block' />
<h2 { ...this._test('best-block') } className={ styles.blockinfo }>
<div { ...this._test('best-block') } className={ styles.blockInfo }>
#{ nodeStatus.blockNumber.toFormat() }
</h2>
</div>
<div className={ styles.blockByline }>
{ moment().calendar(nodeStatus.blockTimestamp) }
</div>
</div>
<div className={ styles.col12 }>
<div className={ `${styles.col12} ${styles.padBottom}` }>
<ContainerTitle title='peers' />
<h2 { ...this._test('peers') } className={ styles.blockinfo }>
<div { ...this._test('peers') } className={ styles.blockInfo }>
{ peers }
</h2>
</div>
</div>
<div className={ styles.col12 }>
<div className={ `${styles.col12} ${styles.padBottom}` }>
<ContainerTitle title='hash rate' />
<h2 { ...this._test('hashrate') } className={ styles.blockinfo }>
<div { ...this._test('hashrate') } className={ styles.blockInfo }>
{ `${hashrate} H/s` }
</h2>
</div>
</div>
</div>
<div className={ styles.col5 }>
Expand Down
2 changes: 1 addition & 1 deletion js/src/views/Status/containers/StatusPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

export default from './StatusPage';
export default from './statusPage';
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
/* You should have received a copy of the GNU General Public License
/* along with Parity. If not, see <http://www.gnu.org/licenses/>.
*/
.container {

.body {
&>div {
margin-bottom: 0.25em;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { clearStatusLogs, toggleStatusLogs, toggleStatusRefresh } from '~/redux/
import Debug from '../../components/Debug';
import Status from '../../components/Status';

import styles from './statusPage.css';

class StatusPage extends Component {
static propTypes = {
nodeStatus: PropTypes.object.isRequired,
Expand All @@ -39,7 +41,7 @@ class StatusPage extends Component {

render () {
return (
<div>
<div className={ styles.body }>
<Status { ...this.props } />
<Debug { ...this.props } />
</div>
Expand Down
14 changes: 4 additions & 10 deletions js/src/views/Status/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,16 @@

import React, { Component } from 'react';

import { Actionbar, Page } from '~/ui';
import { Page } from '~/ui';

import StatusPage from './containers/StatusPage';

import styles from './status.css';

export default class Status extends Component {
render () {
return (
<div className={ styles.container }>
<Actionbar
title='status' />
<Page>
<StatusPage />
</Page>
</div>
<Page title='status'>
<StatusPage />
</Page>
);
}
}