Clean up
This commit is contained in:
@@ -1,17 +1,14 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { AppState } from './reducers'
|
|
||||||
|
|
||||||
import { withStyles, Theme } from '@material-ui/core/styles'
|
|
||||||
import CssBaseline from '@material-ui/core/CssBaseline'
|
|
||||||
|
|
||||||
import * as q from '../../backend/src/Model'
|
import * as q from '../../backend/src/Model'
|
||||||
|
import CssBaseline from '@material-ui/core/CssBaseline'
|
||||||
|
import { withStyles, Theme } from '@material-ui/core/styles'
|
||||||
import Tree from './components/Tree/Tree'
|
import Tree from './components/Tree/Tree'
|
||||||
import TitleBar from './components/TitleBar'
|
import TitleBar from './components/TitleBar'
|
||||||
import Sidebar from './components/Sidebar/Sidebar'
|
import Sidebar from './components/Sidebar/Sidebar'
|
||||||
import Connection from './components/ConnectionSetup/Connection'
|
import Connection from './components/ConnectionSetup/Connection'
|
||||||
import Settings from './components/Settings'
|
import Settings from './components/Settings'
|
||||||
|
import { AppState } from './reducers'
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
selectedNode?: q.TreeNode,
|
selectedNode?: q.TreeNode,
|
||||||
@@ -81,7 +78,7 @@ class App extends React.Component<Props, State> {
|
|||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const { settingsVisible } = this.props
|
const { settingsVisible } = this.props
|
||||||
const { content, contentShift, settings, centerContent } = this.getStyles()
|
const { content, contentShift, centerContent } = this.getStyles()
|
||||||
return <div style={centerContent}>
|
return <div style={centerContent}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<Settings />
|
<Settings />
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { Action } from 'redux'
|
|
||||||
import { ActionTypes } from '../reducers'
|
import { ActionTypes } from '../reducers'
|
||||||
|
|
||||||
export const setAutoExpandLimit = (autoExpandLimit: number = 0) => {
|
export const setAutoExpandLimit = (autoExpandLimit: number = 0) => {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class Connection extends React.Component<Props, State> {
|
|||||||
minWidth: 550,
|
minWidth: 550,
|
||||||
maxWidth: 650,
|
maxWidth: 650,
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
margin: '20vh auto auto auto',
|
margin: '14vh auto auto auto',
|
||||||
padding: `${2 * theme.spacing.unit}px`,
|
padding: `${2 * theme.spacing.unit}px`,
|
||||||
outline: 'none',
|
outline: 'none',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import FileCopy from '@material-ui/icons/FileCopy'
|
|||||||
import Check from '@material-ui/icons/Check'
|
import Check from '@material-ui/icons/Check'
|
||||||
import green from '@material-ui/core/colors/green'
|
import green from '@material-ui/core/colors/green'
|
||||||
import { withStyles, Theme } from '@material-ui/core/styles'
|
import { withStyles, Theme } from '@material-ui/core/styles'
|
||||||
|
|
||||||
const copy = require('copy-text-to-clipboard')
|
const copy = require('copy-text-to-clipboard')
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -16,19 +17,19 @@ interface State {
|
|||||||
snackBarOpen: boolean
|
snackBarOpen: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
class Copy extends React.Component<Props, State> {
|
const styles = (theme: Theme) => ({
|
||||||
constructor(props: Props) {
|
|
||||||
super(props)
|
|
||||||
this.state = { didCopy: false, snackBarOpen: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static styles = (theme: Theme) => ({
|
|
||||||
snackbar: {
|
snackbar: {
|
||||||
backgroundColor: green[600],
|
backgroundColor: green[600],
|
||||||
color: theme.typography.button.color,
|
color: theme.typography.button.color,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
class Copy extends React.Component<Props, State> {
|
||||||
|
constructor(props: Props) {
|
||||||
|
super(props)
|
||||||
|
this.state = { didCopy: false, snackBarOpen: false }
|
||||||
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const icon = !this.state.didCopy
|
const icon = !this.state.didCopy
|
||||||
? <FileCopy fontSize="inherit" style={ { cursor: 'pointer' } } onClick={this.handleClick} />
|
? <FileCopy fontSize="inherit" style={ { cursor: 'pointer' } } onClick={this.handleClick} />
|
||||||
@@ -66,4 +67,4 @@ class Copy extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStyles(Copy.styles)(Copy)
|
export default withStyles(styles)(Copy)
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ const styles: StyleRulesCallback = theme => ({
|
|||||||
...theme.mixins.toolbar,
|
...theme.mixins.toolbar,
|
||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
margin: `auto ${theme.spacing.unit}px auto ${theme.spacing.unit}px`,
|
minWidth: '150px',
|
||||||
|
margin: `auto ${theme.spacing.unit}px auto ${2 * theme.spacing.unit}px`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ class Settings extends React.Component<Props, State> {
|
|||||||
private renderAutoExpand() {
|
private renderAutoExpand() {
|
||||||
const { classes, actions, autoExpandLimit } = this.props
|
const { classes, actions, autoExpandLimit } = this.props
|
||||||
|
|
||||||
return <span>
|
return <div style={{ padding: '8px' }}>
|
||||||
<InputLabel htmlFor="auto-expand">Auto Expand</InputLabel>
|
<InputLabel htmlFor="auto-expand">Auto Expand</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
value = { autoExpandLimit }
|
value = { autoExpandLimit }
|
||||||
@@ -97,11 +98,12 @@ class Settings extends React.Component<Props, State> {
|
|||||||
className = {classes.input}
|
className = {classes.input}
|
||||||
>
|
>
|
||||||
<MenuItem value = {0}><em>Disabled</em></MenuItem>
|
<MenuItem value = {0}><em>Disabled</em></MenuItem>
|
||||||
|
<MenuItem value = {2}>Few</MenuItem>
|
||||||
<MenuItem value = {3}>Some</MenuItem>
|
<MenuItem value = {3}>Some</MenuItem>
|
||||||
<MenuItem value = {10}>Most</MenuItem>
|
<MenuItem value = {10}>Most</MenuItem>
|
||||||
<MenuItem value = {1E6}>All</MenuItem>
|
<MenuItem value = {1E6}>All</MenuItem>
|
||||||
</Select>
|
</Select>
|
||||||
</span>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,28 +2,16 @@ import * as React from 'react'
|
|||||||
import * as q from '../../../../backend/src/Model'
|
import * as q from '../../../../backend/src/Model'
|
||||||
// import Drawer from '@material-ui/core/Drawer'
|
// import Drawer from '@material-ui/core/Drawer'
|
||||||
import { Typography } from '@material-ui/core'
|
import { Typography } from '@material-ui/core'
|
||||||
import { withStyles, Theme, StyleRulesCallback } from '@material-ui/core/styles'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
node: q.TreeNode,
|
node: q.TreeNode
|
||||||
classes: any,
|
|
||||||
theme: Theme
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
class NodeStats extends React.Component<Props, {}> {
|
||||||
node?: q.TreeNode | undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
class NodeStats extends React.Component<Props, State> {
|
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props)
|
super(props)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static styles: StyleRulesCallback<string> = (theme: Theme) => {
|
|
||||||
return {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const { node } = this.props
|
const { node } = this.props
|
||||||
|
|
||||||
@@ -35,4 +23,4 @@ class NodeStats extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStyles(NodeStats.styles, { withTheme: true })(NodeStats)
|
export default NodeStats
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as q from '../../../../backend/src/Model'
|
import * as q from '../../../../backend/src/Model'
|
||||||
// import Drawer from '@material-ui/core/Drawer'
|
import { ExpansionPanel, ExpansionPanelDetails, ExpansionPanelSummary, Typography } from '@material-ui/core'
|
||||||
import ExpansionPanel from '@material-ui/core/ExpansionPanel'
|
import { withStyles, Theme, StyleRulesCallback } from '@material-ui/core/styles'
|
||||||
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'
|
|
||||||
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'
|
|
||||||
import ExpandMore from '@material-ui/icons/ExpandMore'
|
import ExpandMore from '@material-ui/icons/ExpandMore'
|
||||||
|
|
||||||
|
import Copy from '../Copy'
|
||||||
import ValueRenderer from './ValueRenderer'
|
import ValueRenderer from './ValueRenderer'
|
||||||
import NodeStats from './NodeStats'
|
import NodeStats from './NodeStats'
|
||||||
import Topic from './Topic'
|
import Topic from './Topic'
|
||||||
import { Typography } from '@material-ui/core'
|
|
||||||
import { withStyles, Theme, StyleRulesCallback } from '@material-ui/core/styles'
|
|
||||||
import Copy from '../Copy'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
node?: q.TreeNode,
|
node?: q.TreeNode,
|
||||||
@@ -19,7 +16,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
node?: q.TreeNode
|
node: q.TreeNode
|
||||||
}
|
}
|
||||||
|
|
||||||
class Sidebar extends React.Component<Props, State> {
|
class Sidebar extends React.Component<Props, State> {
|
||||||
@@ -29,6 +26,7 @@ class Sidebar extends React.Component<Props, State> {
|
|||||||
|
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props)
|
super(props)
|
||||||
|
console.warn('Find and fix me #state')
|
||||||
this.state = { node: new q.Tree() }
|
this.state = { node: new q.Tree() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as q from '../../../../backend/src/Model'
|
import * as q from '../../../../backend/src/Model'
|
||||||
import { withStyles, Theme, StyleRulesCallback } from '@material-ui/core/styles'
|
|
||||||
import Button from '@material-ui/core/Button'
|
import Button from '@material-ui/core/Button'
|
||||||
|
import { withStyles, Theme, StyleRulesCallback } from '@material-ui/core/styles'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
classes: any
|
classes: any
|
||||||
@@ -11,8 +11,7 @@ interface Props {
|
|||||||
didSelectNode: (node: q.TreeNode) => void
|
didSelectNode: (node: q.TreeNode) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
class Topic extends React.Component<Props, {}> {
|
const styles: StyleRulesCallback<string> = (theme: Theme) => ({
|
||||||
public static styles: StyleRulesCallback<string> = (theme: Theme) => ({
|
|
||||||
button: {
|
button: {
|
||||||
textTransform: 'none',
|
textTransform: 'none',
|
||||||
padding: '3px 5px 3px 5px',
|
padding: '3px 5px 3px 5px',
|
||||||
@@ -20,6 +19,7 @@ class Topic extends React.Component<Props, {}> {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
class Topic extends React.Component<Props, {}> {
|
||||||
public render() {
|
public render() {
|
||||||
const { node } = this.props
|
const { node } = this.props
|
||||||
if (!node) {
|
if (!node) {
|
||||||
@@ -54,4 +54,4 @@ class Topic extends React.Component<Props, {}> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStyles(Topic.styles, { withTheme: true })(Topic)
|
export default withStyles(styles, { withTheme: true })(Topic)
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ class ValueRenderer extends React.Component<Props, State> {
|
|||||||
nextProps.node && nextProps.node.onMessage.subscribe(this.updateNode)
|
nextProps.node && nextProps.node.onMessage.subscribe(this.updateNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private style = (theme: Theme) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
const node = this.props.node
|
const node = this.props.node
|
||||||
if (!node || !node.message) {
|
if (!node || !node.message) {
|
||||||
|
|||||||
@@ -1,28 +1,16 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as q from '../../../backend/src/Model'
|
|
||||||
|
|
||||||
import Search from '@material-ui/icons/Search'
|
|
||||||
import Drawer from '@material-ui/core/Drawer'
|
|
||||||
import IconButton from '@material-ui/core/IconButton'
|
|
||||||
import Menu from '@material-ui/icons/Menu'
|
|
||||||
|
|
||||||
import List from '@material-ui/core/List'
|
|
||||||
import Divider from '@material-ui/core/Divider'
|
|
||||||
import ListItem from '@material-ui/core/ListItem'
|
|
||||||
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
|
||||||
import ListItemText from '@material-ui/core/ListItemText'
|
|
||||||
import Slider from '@material-ui/lab/Slider'
|
|
||||||
|
|
||||||
import { settingsActions } from '../actions'
|
|
||||||
import { AppState, SettingsModel } from '../reducers'
|
|
||||||
|
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { bindActionCreators } from 'redux'
|
import { bindActionCreators } from 'redux'
|
||||||
|
import * as q from '../../../backend/src/Model'
|
||||||
|
|
||||||
import { AppBar, Toolbar, Typography, InputBase } from '@material-ui/core'
|
import { AppBar, IconButton, InputBase, Toolbar, Typography } from '@material-ui/core'
|
||||||
|
import Search from '@material-ui/icons/Search'
|
||||||
|
import Menu from '@material-ui/icons/Menu'
|
||||||
import { withStyles, StyleRulesCallback } from '@material-ui/core/styles'
|
import { withStyles, StyleRulesCallback } from '@material-ui/core/styles'
|
||||||
import { fade } from '@material-ui/core/styles/colorManipulator'
|
import { fade } from '@material-ui/core/styles/colorManipulator'
|
||||||
|
|
||||||
|
import { settingsActions } from '../actions'
|
||||||
|
|
||||||
const styles: StyleRulesCallback = theme => ({
|
const styles: StyleRulesCallback = theme => ({
|
||||||
title: {
|
title: {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
@@ -105,7 +93,14 @@ class TitleBar extends React.Component<Props, State> {
|
|||||||
<Menu />
|
<Menu />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Typography className={classes.title} variant="h6" color="inherit">MQTT-Xplorer</Typography>
|
<Typography className={classes.title} variant="h6" color="inherit">MQTT-Xplorer</Typography>
|
||||||
<div className={classes.search}>
|
</Toolbar>
|
||||||
|
</AppBar>
|
||||||
|
}
|
||||||
|
|
||||||
|
private renderSearch() {
|
||||||
|
const { classes } = this.props
|
||||||
|
|
||||||
|
return <div className={classes.search}>
|
||||||
<div className={classes.searchIcon}>
|
<div className={classes.searchIcon}>
|
||||||
<Search />
|
<Search />
|
||||||
</div>
|
</div>
|
||||||
@@ -117,8 +112,6 @@ class TitleBar extends React.Component<Props, State> {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Toolbar>
|
|
||||||
</AppBar>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as q from '../../../../backend/src/Model'
|
|
||||||
import TreeNode from './TreeNode'
|
|
||||||
import { Typography } from '@material-ui/core'
|
|
||||||
import { makeConnectionMessageEvent, rendererEvents } from '../../../../events'
|
|
||||||
import { } from '../../../../events/Events'
|
|
||||||
const MovingAvaerage = require('moving-average')
|
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
|
import * as q from '../../../../backend/src/Model'
|
||||||
|
import { Typography } from '@material-ui/core'
|
||||||
|
import TreeNode from './TreeNode'
|
||||||
|
import { makeConnectionMessageEvent, rendererEvents } from '../../../../events'
|
||||||
import { AppState } from '../../reducers'
|
import { AppState } from '../../reducers'
|
||||||
|
|
||||||
|
const MovingAverage = require('moving-average')
|
||||||
|
|
||||||
declare const performance: any
|
declare const performance: any
|
||||||
|
|
||||||
const timeInterval = 10 * 1000
|
const timeInterval = 10 * 1000
|
||||||
const average = MovingAvaerage(timeInterval)
|
const average = MovingAverage(timeInterval)
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
autoExpandLimit: number
|
autoExpandLimit: number
|
||||||
@@ -25,7 +25,6 @@ interface TreeState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Tree extends React.Component<Props, TreeState> {
|
class Tree extends React.Component<Props, TreeState> {
|
||||||
private renderDuration: number = 300
|
|
||||||
private updateTimer?: any
|
private updateTimer?: any
|
||||||
private lastUpdate: number = 0
|
private lastUpdate: number = 0
|
||||||
private perf: number = 0
|
private perf: number = 0
|
||||||
@@ -111,7 +110,6 @@ class Tree extends React.Component<Props, TreeState> {
|
|||||||
key="rootNode"
|
key="rootNode"
|
||||||
performanceCallback={(ms: number) => {
|
performanceCallback={(ms: number) => {
|
||||||
average.push(Date.now(), ms)
|
average.push(Date.now(), ms)
|
||||||
this.renderDuration = ms
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as q from '../../../../backend/src/Model'
|
import * as q from '../../../../backend/src/Model'
|
||||||
import { withStyles, Theme } from '@material-ui/core/styles'
|
import { withStyles, Theme } from '@material-ui/core/styles'
|
||||||
|
|
||||||
import { isElementInViewport } from '../helper/isElementInViewport'
|
import { isElementInViewport } from '../helper/isElementInViewport'
|
||||||
import TreeNodeTitle from './TreeNodeTitle'
|
import TreeNodeTitle from './TreeNodeTitle'
|
||||||
import TreeNodeSubnodes from './TreeNodeSubnodes'
|
import TreeNodeSubnodes from './TreeNodeSubnodes'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as q from '../../../../backend/src/Model'
|
import * as q from '../../../../backend/src/Model'
|
||||||
import { withTheme, Theme } from '@material-ui/core/styles'
|
import { withTheme, Theme } from '@material-ui/core/styles'
|
||||||
import { List, ListItem, Collapse } from '@material-ui/core'
|
|
||||||
import TreeNode from './TreeNode'
|
import TreeNode from './TreeNode'
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
@@ -21,10 +21,6 @@ class TreeNodeSubnodes extends React.Component<Props, {}> {
|
|||||||
padding: '3px 8px 0px 8px',
|
padding: '3px 8px 0px 8px',
|
||||||
}
|
}
|
||||||
|
|
||||||
const listStyle = {
|
|
||||||
padding: '3px 8px 0px 8px',
|
|
||||||
}
|
|
||||||
|
|
||||||
if (edges.length > 0 && !this.props.collapsed) {
|
if (edges.length > 0 && !this.props.collapsed) {
|
||||||
const listItems = edges
|
const listItems = edges
|
||||||
.map(edge => edge.target)
|
.map(edge => edge.target)
|
||||||
|
|||||||
@@ -1,21 +1,13 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import * as ReactDOM from 'react-dom'
|
import * as ReactDOM from 'react-dom'
|
||||||
|
|
||||||
import { Provider } from 'react-redux'
|
import { Provider } from 'react-redux'
|
||||||
import { createStore } from 'redux'
|
import { createStore } from 'redux'
|
||||||
import reducers, { AppState } from './reducers'
|
|
||||||
import App from './App'
|
|
||||||
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'
|
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'
|
||||||
|
|
||||||
const theme = createMuiTheme({
|
import reducers from './reducers'
|
||||||
palette: {
|
import App from './App'
|
||||||
type: 'dark', // Switching the dark mode on is a single property value change.
|
|
||||||
},
|
|
||||||
typography: { useNextVariants: true },
|
|
||||||
})
|
|
||||||
|
|
||||||
declare var document: any
|
declare var document: any
|
||||||
declare var window: any
|
|
||||||
|
|
||||||
const initialAppState = {
|
const initialAppState = {
|
||||||
settings: {
|
settings: {
|
||||||
@@ -23,9 +15,14 @@ const initialAppState = {
|
|||||||
visible: false,
|
visible: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = createStore(reducers, initialAppState)
|
const store = createStore(reducers, initialAppState)
|
||||||
window.reduxStore = store
|
|
||||||
|
const theme = createMuiTheme({
|
||||||
|
palette: {
|
||||||
|
type: 'dark',
|
||||||
|
},
|
||||||
|
typography: { useNextVariants: true },
|
||||||
|
})
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<MuiThemeProvider theme={theme}>
|
<MuiThemeProvider theme={theme}>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
addMqttConnectionEvent, backendEvents,
|
addMqttConnectionEvent, backendEvents,
|
||||||
makeConnectionStateEvent, removeConnection,
|
makeConnectionStateEvent, removeConnection,
|
||||||
makeConnectionMessageEvent, AddMqttConnection
|
makeConnectionMessageEvent, AddMqttConnection,
|
||||||
} from '../../events'
|
} from '../../events'
|
||||||
import { MqttSource, DataSource } from './DataSource'
|
import { MqttSource, DataSource } from './DataSource'
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ class ConnectionManager {
|
|||||||
|
|
||||||
public manageConnections() {
|
public manageConnections() {
|
||||||
backendEvents.subscribe(addMqttConnectionEvent, this.handleConnectionRequest)
|
backendEvents.subscribe(addMqttConnectionEvent, this.handleConnectionRequest)
|
||||||
backendEvents.subscribe(removeConnection, (connectionId) => this.removeConnection(connectionId))
|
backendEvents.subscribe(removeConnection, (connectionId: string) => this.removeConnection(connectionId))
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleConnectionRequest = (event: AddMqttConnection) => {
|
private handleConnectionRequest = (event: AddMqttConnection) => {
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
const {app, BrowserWindow} = require('electron')
|
const {app, BrowserWindow} = require('electron')
|
||||||
|
try {
|
||||||
require('./backend/build/backend/src/index.js')
|
require('./backend/build/backend/src/index.js')
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let mainWindow
|
let mainWindow
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ export const addMqttConnectionEvent: Event<AddMqttConnection> = {
|
|||||||
topic: 'connection/add/mqtt',
|
topic: 'connection/add/mqtt',
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RemoveConnection {
|
|
||||||
connectionId: string,
|
|
||||||
}
|
|
||||||
|
|
||||||
export const removeConnection: Event<string> = {
|
export const removeConnection: Event<string> = {
|
||||||
topic: 'connection/remove',
|
topic: 'connection/remove',
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user