Remove "empty payload" toggle switch

This function is redundat, simply send an empty message wil suffice
This commit is contained in:
Thomas Nordquist
2019-01-20 12:54:54 +01:00
parent 4d794205d5
commit ab83c682ac
4 changed files with 5 additions and 41 deletions

View File

@@ -39,7 +39,6 @@ interface Props {
topic?: string
payload?: string
actions: typeof publishActions
emptyPayload: boolean
retain: boolean
editorMode: string
qos: 0 | 1 | 2
@@ -164,9 +163,6 @@ class Publish extends React.Component<Props, State> {
}
private renderEditorModeSelection() {
if (this.props.emptyPayload) {
return null
}
const labelStyle = { margin: '0 8px 0 8px' }
return (
<RadioGroup
@@ -234,20 +230,13 @@ class Publish extends React.Component<Props, State> {
)
return (
<div style={{ marginTop: '8px', clear: 'both' }}>
<div style={{ width: '100%' }}>
<div style={{ width: '100%', textAlign: 'right' }}>
<FormControlLabel
style={labelStyle}
control={qosSelect}
label="QoS"
labelPlacement="start"
/>
<FormControlLabel
value="empty"
style={labelStyle}
control={<Checkbox color="primary" checked={this.props.emptyPayload} onChange={this.props.actions.toggleEmptyPayload} />}
label="no message"
labelPlacement="end"
/>
<FormControlLabel
value="retain"
style={labelStyle}
@@ -286,10 +275,6 @@ class Publish extends React.Component<Props, State> {
}
private renderEditor() {
if (this.props.emptyPayload) {
return null
}
return (
<AceEditor
mode={this.props.editorMode}
@@ -317,7 +302,6 @@ const mapStateToProps = (state: AppState) => {
return {
topic: state.publish.topic,
payload: state.publish.payload,
emptyPayload: state.publish.emptyPayload,
editorMode: state.publish.editorMode,
retain: state.publish.retain,
qos: state.publish.qos,

View File

@@ -67,7 +67,8 @@ class TreeNodeTitle extends React.Component<TreeNodeProps, {}> {
marginLeft: '5px',
display: 'inline-block',
}
return this.props.treeNode.message
return this.props.treeNode.message && this.props.treeNode.message.length > 0
? <span style={style}> = {this.props.treeNode.message.value.toString()}</span>
: null
}