mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
dashboard: move the geth version to the right, make commit optional
This commit is contained in:
parent
e9e7e5c30a
commit
26133480cf
6 changed files with 660 additions and 659 deletions
1255
dashboard/assets.go
1255
dashboard/assets.go
File diff suppressed because it is too large
Load diff
|
|
@ -58,7 +58,6 @@ const deepUpdate = (prev: Object, update: Object, updater: Object) => {
|
||||||
// We could return the message itself too, but it's safer not to give access to it.
|
// We could return the message itself too, but it's safer not to give access to it.
|
||||||
const shouldUpdate = (msg: Object, updater: Object) => {
|
const shouldUpdate = (msg: Object, updater: Object) => {
|
||||||
const su = {};
|
const su = {};
|
||||||
console.log(msg);
|
|
||||||
Object.keys(msg).forEach((key) => {
|
Object.keys(msg).forEach((key) => {
|
||||||
su[key] = typeof updater[key] !== 'function' ? shouldUpdate(msg[key], updater[key]) : true;
|
su[key] = typeof updater[key] !== 'function' ? shouldUpdate(msg[key], updater[key]) : true;
|
||||||
});
|
});
|
||||||
|
|
@ -76,8 +75,8 @@ const replacer = <T>(prev: T, update: T) => update;
|
||||||
// defaultContent is the initial value of the state content.
|
// defaultContent is the initial value of the state content.
|
||||||
const defaultContent: Content = {
|
const defaultContent: Content = {
|
||||||
general: {
|
general: {
|
||||||
version: '-',
|
version: null,
|
||||||
commit: '-',
|
commit: null,
|
||||||
},
|
},
|
||||||
home: {
|
home: {
|
||||||
memory: [],
|
memory: [],
|
||||||
|
|
|
||||||
|
|
@ -21,24 +21,13 @@ import React, {Component} from 'react';
|
||||||
import withStyles from 'material-ui/styles/withStyles';
|
import withStyles from 'material-ui/styles/withStyles';
|
||||||
import AppBar from 'material-ui/AppBar';
|
import AppBar from 'material-ui/AppBar';
|
||||||
import Toolbar from 'material-ui/Toolbar';
|
import Toolbar from 'material-ui/Toolbar';
|
||||||
import Transition from 'react-transition-group/Transition';
|
|
||||||
import IconButton from 'material-ui/IconButton';
|
|
||||||
import Typography from 'material-ui/Typography';
|
import Typography from 'material-ui/Typography';
|
||||||
import ChevronLeftIcon from 'material-ui-icons/ChevronLeft';
|
|
||||||
|
|
||||||
import {DURATION} from './Common';
|
import type {General} from '../types/content';
|
||||||
|
|
||||||
// arrowDefault is the default style of the arrow button.
|
// styles contains styles for the Header component.
|
||||||
const arrowDefault = {
|
|
||||||
transition: `transform ${DURATION}ms`,
|
|
||||||
};
|
|
||||||
// arrowTransition is the additional style of the arrow button corresponding to the transition's state.
|
|
||||||
const arrowTransition = {
|
|
||||||
entered: {transform: 'rotate(180deg)'},
|
|
||||||
};
|
|
||||||
// Styles for the Header component.
|
|
||||||
const styles = theme => ({
|
const styles = theme => ({
|
||||||
header: {
|
footer: {
|
||||||
backgroundColor: theme.palette.background.appBar,
|
backgroundColor: theme.palette.background.appBar,
|
||||||
color: theme.palette.getContrastText(theme.palette.background.appBar),
|
color: theme.palette.getContrastText(theme.palette.background.appBar),
|
||||||
zIndex: theme.zIndex.appBar,
|
zIndex: theme.zIndex.appBar,
|
||||||
|
|
@ -46,12 +35,15 @@ const styles = theme => ({
|
||||||
toolbar: {
|
toolbar: {
|
||||||
paddingLeft: theme.spacing.unit,
|
paddingLeft: theme.spacing.unit,
|
||||||
paddingRight: theme.spacing.unit,
|
paddingRight: theme.spacing.unit,
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'flex-end',
|
||||||
},
|
},
|
||||||
mainText: {
|
light: {
|
||||||
paddingLeft: theme.spacing.unit,
|
color: 'rgba(255, 255, 255, 0.54)',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
export type Props = {
|
export type Props = {
|
||||||
|
general: General,
|
||||||
classes: Object,
|
classes: Object,
|
||||||
};
|
};
|
||||||
// TODO (kurkomisi): If the structure is appropriate, make an abstraction of the common parts with the Header.
|
// TODO (kurkomisi): If the structure is appropriate, make an abstraction of the common parts with the Header.
|
||||||
|
|
@ -61,18 +53,24 @@ class Footer extends Component<Props> {
|
||||||
return typeof nextProps.shouldUpdate.logs !== 'undefined';
|
return typeof nextProps.shouldUpdate.logs !== 'undefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info = (about: string, data: string) => (
|
||||||
|
<Typography type="caption" color="inherit">
|
||||||
|
<span className={this.props.classes.light}>{about}</span> {data}
|
||||||
|
</Typography>
|
||||||
|
);
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {classes} = this.props; // The classes property is injected by withStyles().
|
const {classes, general} = this.props; // The classes property is injected by withStyles().
|
||||||
|
const geth = general.version ? this.info('Geth', general.version) : null;
|
||||||
|
const commit = general.commit ? this.info('Commit', general.commit) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar position="static" className={classes.header}>
|
<AppBar position="static" className={classes.footer}>
|
||||||
<Toolbar className={classes.toolbar}>
|
<Toolbar className={classes.toolbar}>
|
||||||
<Typography type="title" color="inherit" className={classes.mainText}>
|
<div>
|
||||||
{this.props.general.version}
|
{geth}
|
||||||
</Typography>
|
{commit}
|
||||||
<Typography type="title" color="inherit" className={classes.mainText}>
|
</div>
|
||||||
{this.props.general.commit}
|
|
||||||
</Typography>
|
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
"react-transition-group": "^2.2.1",
|
"react-transition-group": "^2.2.1",
|
||||||
"recharts": "^1.0.0-beta.7",
|
"recharts": "^1.0.0-beta.7",
|
||||||
"style-loader": "^0.19.1",
|
"style-loader": "^0.19.1",
|
||||||
|
"typeface-roboto": "^0.0.50",
|
||||||
"url": "^0.11.0",
|
"url": "^0.11.0",
|
||||||
"url-loader": "^0.6.2",
|
"url-loader": "^0.6.2",
|
||||||
"webpack": "^3.10.0"
|
"webpack": "^3.10.0"
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ export type Content = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type General = {
|
export type General = {
|
||||||
version: string,
|
version: ?string,
|
||||||
commit: string,
|
commit: ?string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Home = {
|
export type Home = {
|
||||||
|
|
|
||||||
|
|
@ -211,8 +211,8 @@ func (db *Dashboard) apiHandler(conn *websocket.Conn) {
|
||||||
// Send the past data.
|
// Send the past data.
|
||||||
client.msg <- Message{
|
client.msg <- Message{
|
||||||
General: &GeneralMessage{
|
General: &GeneralMessage{
|
||||||
Version: fmt.Sprintf("Geth v%d.%d.%d%s", params.VersionMajor, params.VersionMinor, params.VersionPatch, versionMeta),
|
Version: fmt.Sprintf("v%d.%d.%d%s", params.VersionMajor, params.VersionMinor, params.VersionPatch, versionMeta),
|
||||||
Commit: fmt.Sprintf("Commit %s", db.commit),
|
Commit: db.commit,
|
||||||
},
|
},
|
||||||
Home: &HomeMessage{
|
Home: &HomeMessage{
|
||||||
Memory: db.charts.Memory,
|
Memory: db.charts.Memory,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue