Update code formatting
This commit is contained in:
@@ -3,7 +3,7 @@ import ReactSplitPane from 'react-split-pane'
|
||||
import { Sidebar } from '../Sidebar'
|
||||
import Tree from '../Tree/Tree'
|
||||
|
||||
export default function ContentView(props: {heightProperty: any, paneDefaults: any, connectionId: any}) {
|
||||
export default function ContentView(props: { heightProperty: any; paneDefaults: any; connectionId: any }) {
|
||||
return (
|
||||
<ReactSplitPane
|
||||
step={20}
|
||||
|
||||
@@ -22,13 +22,13 @@ const styles = (theme: Theme) => ({
|
||||
interface Props {
|
||||
classes: any
|
||||
actions: {
|
||||
tree: typeof treeActions,
|
||||
tree: typeof treeActions
|
||||
}
|
||||
paused: boolean
|
||||
tree?: q.Tree<any>
|
||||
}
|
||||
|
||||
class PauseButton extends React.Component<Props, {changes: number}> {
|
||||
class PauseButton extends React.Component<Props, { changes: number }> {
|
||||
private timer?: any
|
||||
constructor(props: Props) {
|
||||
super(props)
|
||||
@@ -42,7 +42,8 @@ class PauseButton extends React.Component<Props, {changes: number}> {
|
||||
|
||||
return (
|
||||
<span className={this.props.classes.bufferStats}>
|
||||
{this.state.changes} changes<br />
|
||||
{this.state.changes} changes
|
||||
<br />
|
||||
buffer at {Math.round(this.props.tree.unmergedChanges().fillState() * 10000) / 100}%
|
||||
</span>
|
||||
)
|
||||
@@ -66,12 +67,18 @@ class PauseButton extends React.Component<Props, {changes: number}> {
|
||||
}
|
||||
|
||||
public render() {
|
||||
const message = this.props.paused ? 'Resumes updating the tree, after applying all recorded changes' : 'Stops all updates, records changes until the buffer is full.'
|
||||
const message = this.props.paused
|
||||
? 'Resumes updating the tree, after applying all recorded changes'
|
||||
: 'Stops all updates, records changes until the buffer is full.'
|
||||
return (
|
||||
<div style={{ display: 'inline-flex' }}>
|
||||
<span>
|
||||
<CustomIconButton onClick={this.props.actions.tree.togglePause} tooltip={message}>
|
||||
{this.props.paused ? <Resume className={this.props.classes.icon} /> : <Pause className={this.props.classes.icon} />}
|
||||
{this.props.paused ? (
|
||||
<Resume className={this.props.classes.icon} />
|
||||
) : (
|
||||
<Pause className={this.props.classes.icon} />
|
||||
)}
|
||||
</CustomIconButton>
|
||||
</span>
|
||||
{this.props.paused ? this.renderBufferStats() : null}
|
||||
@@ -95,4 +102,7 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(PauseButton))
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withStyles(styles)(PauseButton))
|
||||
|
||||
@@ -11,14 +11,7 @@ import { connect } from 'react-redux'
|
||||
import { connectionActions, globalActions, settingsActions } from '../../actions'
|
||||
import { fade } from '@material-ui/core/styles/colorManipulator'
|
||||
import { Theme, withStyles } from '@material-ui/core/styles'
|
||||
import {
|
||||
AppBar,
|
||||
Button,
|
||||
IconButton,
|
||||
InputBase,
|
||||
Toolbar,
|
||||
Typography,
|
||||
} from '@material-ui/core'
|
||||
import { AppBar, Button, IconButton, InputBase, Toolbar, Typography } from '@material-ui/core'
|
||||
|
||||
const styles = (theme: Theme) => ({
|
||||
title: {
|
||||
@@ -92,9 +85,9 @@ const styles = (theme: Theme) => ({
|
||||
interface Props {
|
||||
classes: any
|
||||
actions: {
|
||||
settings: typeof settingsActions,
|
||||
connection: typeof connectionActions,
|
||||
global: typeof globalActions,
|
||||
settings: typeof settingsActions
|
||||
connection: typeof connectionActions
|
||||
global: typeof globalActions
|
||||
}
|
||||
topicFilter?: string
|
||||
}
|
||||
@@ -102,7 +95,7 @@ interface Props {
|
||||
class TitleBar extends React.Component<Props, {}> {
|
||||
constructor(props: any) {
|
||||
super(props)
|
||||
this.state = { }
|
||||
this.state = {}
|
||||
}
|
||||
|
||||
private renderSearch() {
|
||||
@@ -117,7 +110,11 @@ class TitleBar extends React.Component<Props, {}> {
|
||||
value={topicFilter}
|
||||
onChange={this.onFilterChange}
|
||||
placeholder="Search…"
|
||||
endAdornment={<div style={{ width: '24px', paddingRight: '8px' }}><ClearAdornment variant="primary" action={this.clearFilter} value={topicFilter} /></div>}
|
||||
endAdornment={
|
||||
<div style={{ width: '24px', paddingRight: '8px' }}>
|
||||
<ClearAdornment variant="primary" action={this.clearFilter} value={topicFilter} />
|
||||
</div>
|
||||
}
|
||||
classes={{ root: classes.inputRoot, input: classes.inputInput }}
|
||||
/>
|
||||
</div>
|
||||
@@ -138,10 +135,17 @@ class TitleBar extends React.Component<Props, {}> {
|
||||
return (
|
||||
<AppBar position="static">
|
||||
<Toolbar>
|
||||
<IconButton className={classes.menuButton} color="inherit" aria-label="Menu" onClick={actions.global.toggleSettingsVisibility}>
|
||||
<IconButton
|
||||
className={classes.menuButton}
|
||||
color="inherit"
|
||||
aria-label="Menu"
|
||||
onClick={actions.global.toggleSettingsVisibility}
|
||||
>
|
||||
<Menu />
|
||||
</IconButton>
|
||||
<Typography className={classes.title} variant="h6" color="inherit">MQTT Explorer</Typography>
|
||||
<Typography className={classes.title} variant="h6" color="inherit">
|
||||
MQTT Explorer
|
||||
</Typography>
|
||||
{this.renderSearch()}
|
||||
<PauseButton />
|
||||
<Button className={classes.disconnect} onClick={actions.connection.disconnect}>
|
||||
@@ -170,4 +174,7 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(TitleBar))
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withStyles(styles)(TitleBar))
|
||||
|
||||
Reference in New Issue
Block a user