From 5844efdbbb6bfd6f9cea9a024ee84934bc398038 Mon Sep 17 00:00:00 2001 From: Sonja Happ Date: Fri, 19 Jun 2020 09:34:46 +0200 Subject: [PATCH] Removed plot-table widget as it is redundant to plot widget #218 --- .../widget/edit-widget-control-creator.js | 1 - src/ic/ic-data-data-manager.js | 2 +- src/styles/widgets.css | 64 --------- .../edit-widget-control-creator.js | 8 -- src/widget/widget-factory.js | 11 -- src/widget/widget-toolbox.js | 1 - src/widget/widget.js | 11 -- src/widget/widgets/plot-table.js | 130 ------------------ 8 files changed, 1 insertion(+), 227 deletions(-) delete mode 100644 src/widget/widgets/plot-table.js diff --git a/src/__tests__/widget/edit-widget-control-creator.js b/src/__tests__/widget/edit-widget-control-creator.js index 73efcd9..7f1dded 100644 --- a/src/__tests__/widget/edit-widget-control-creator.js +++ b/src/__tests__/widget/edit-widget-control-creator.js @@ -30,7 +30,6 @@ describe('edit widget control creator', () => { { args: { widgetType: 'Table' }, result: { controlNumber: 2, controlTypes: [EditWidgetCheckboxControl] } }, { args: { widgetType: 'Image' }, result: { controlNumber: 2, controlTypes: [EditFileWidgetControl, EditWidgetAspectControl] } }, { args: { widgetType: 'Gauge' }, result: { controlNumber: 6, controlTypes: [EditWidgetTextControl, EditWidgetSignalControl, EditWidgetCheckboxControl, EditWidgetColorZonesControl, EditWidgetMinMaxControl] } }, - { args: { widgetType: 'PlotTable' }, result: { controlNumber: 5, controlTypes: [EditWidgetSignalsControl, EditWidgetTextControl, EditWidgetTimeControl, EditWidgetMinMaxControl] } }, { args: { widgetType: 'Slider' }, result: { controlNumber: 9, controlTypes: [EditWidgetTextControl, EditWidgetOrientation, EditWidgetSignalControl, EditWidgetCheckboxControl, EditWidgetCheckboxControl, EditWidgetMinMaxControl, EditWidgetNumberControl, EditWidgetNumberControl] } }, { args: { widgetType: 'Button' }, result: { controlNumber: 6, controlTypes: [EditWidgetTextControl, EditWidgetSignalControl, EditWidgetCheckboxControl, EditWidgetNumberControl, EditWidgetNumberControl] } }, { args: { widgetType: 'Box' }, result: { controlNumber: 2, controlTypes: [EditWidgetColorControl, EditWidgetColorControl] } }, diff --git a/src/ic/ic-data-data-manager.js b/src/ic/ic-data-data-manager.js index 5aebae9..2e09a7c 100644 --- a/src/ic/ic-data-data-manager.js +++ b/src/ic/ic-data-data-manager.js @@ -58,7 +58,7 @@ class IcDataDataManager { if (socket == null) { return false; } - + console.log("Sending to IC", identifier, "message: ", message); const data = this.messageToBuffer(message); socket.send(data); diff --git a/src/styles/widgets.css b/src/styles/widgets.css index 4e367a3..192acdd 100644 --- a/src/styles/widgets.css +++ b/src/styles/widgets.css @@ -115,65 +115,6 @@ div[class*="-widget"] .btn[disabled], .btn.disabled, div[class*="-widget"] input /* End edit menu: Colors */ -/* PlotTable widget */ -.plot-table-widget, .plot-widget, .value-widget, .image-widget, .label-widget { - width: 100%; - height: 100%; - padding: 3px 6px; -} - -.plot-table-widget { - display: -webkit-flex; - display: flex; - flex-direction: column; -} - -.plot-table-widget .content { - -webkit-flex: 1 0 auto; - flex: 1 0 auto; - display: -webkit-flex; - display: flex; - flex-direction: column; -} - -.table-plot-row { - -webkit-flex: 1 0 auto; - flex: 1 0 auto; - display: -webkit-flex; - display: flex; -} - -.plot-table-widget .widget-table { - -webkit-flex: 1 0 auto; - flex: 1 0 auto; - flex-basis: 90px; - max-width: 50%; - display: flex; - flex-direction: column; - justify-content: center; - margin-right: 10px; -} - -.plot-table-widget small { - text-align: center; -} - -.plot-table-widget .checkbox label { - height: 100%; - width: 100%; - padding: 6px 12px; - overflow-x: hidden; -} - -.plot-table-widget .btn { - padding: 0px; -} - -.plot-table-widget input[type="checkbox"] { - display: none; -} -/* End PlotTable Widget */ - /* Plot Widget */ .plot-widget { display: -webkit-flex; @@ -438,8 +379,3 @@ div[class*="-widget"] label { border: 2px solid; } /* End box widget */ - -.plot-table-widget .widget-plot { - -webkit-flex: 1 0 auto; - flex: 1 0 auto; -} diff --git a/src/widget/edit-widget/edit-widget-control-creator.js b/src/widget/edit-widget/edit-widget-control-creator.js index 5c12734..90ded85 100644 --- a/src/widget/edit-widget/edit-widget-control-creator.js +++ b/src/widget/edit-widget/edit-widget-control-creator.js @@ -97,14 +97,6 @@ export default function CreateControls(widgetType = null, widget = null, session handleChange(e)} /> ); break; - case 'PlotTable': - DialogControls.push( - handleChange(e)} />, - handleChange(e)} />, - handleChange(e)} />, - handleChange(e)} /> - ); - break; case 'Slider': DialogControls.push( handleChange(e)} />, diff --git a/src/widget/widget-factory.js b/src/widget/widget-factory.js index 4586464..1360988 100644 --- a/src/widget/widget-factory.js +++ b/src/widget/widget-factory.js @@ -105,17 +105,6 @@ class WidgetFactory { widget.customProperties.fontColor = 0; widget.customProperties.resizeTopBottomLock = true; break; - case 'PlotTable': - widget.customProperties.ylabel = ''; - widget.minWidth = 200; - widget.minHeight = 100; - widget.width = 600; - widget.height = 300; - widget.customProperties.time = 60; - widget.customProperties.yMin = 0; - widget.customProperties.yMax = 10; - widget.customProperties.yUseMinMax = false; - break; case 'Image': widget.minWidth = 20; widget.minHeight = 20; diff --git a/src/widget/widget-toolbox.js b/src/widget/widget-toolbox.js index 820b02a..60be4af 100644 --- a/src/widget/widget-toolbox.js +++ b/src/widget/widget-toolbox.js @@ -45,7 +45,6 @@ class WidgetToolbox extends React.Component { - diff --git a/src/widget/widget.js b/src/widget/widget.js index 809c65a..11fe5c2 100644 --- a/src/widget/widget.js +++ b/src/widget/widget.js @@ -35,7 +35,6 @@ import WidgetValue from './widgets/value'; import WidgetPlot from './widgets/plot'; import WidgetTable from './widgets/table'; import WidgetLabel from './widgets/label'; -import WidgetPlotTable from './widgets/plot-table'; import WidgetImage from './widgets/image'; import WidgetButton from './widgets/button'; import WidgetInput from './widgets/input'; @@ -170,16 +169,6 @@ class Widget extends React.Component { return - } else if (widget.type === 'PlotTable') { - return this.props.onWidgetStatusChange(w, this.props.index)} - paused={this.props.paused} - /> } else if (widget.type === 'Image') { return . - ******************************************************************************/ - -import React, { Component } from 'react'; -import { FormGroup } from 'react-bootstrap'; -import Plot from '../widget-plot/plot'; -import PlotLegend from '../widget-plot/plot-legend'; - -class WidgetPlotTable extends Component { - constructor(props) { - super(props); - this.state = { - signals: [], - data: [] - }; - } - - static getDerivedStateFromProps(props, state){ - let intersection = [] - let data = []; - let signalID, sig; - for (signalID of props.widget.signalIDs) { - for (sig of props.signals) { - if (signalID === sig.id) { - intersection.push(sig); - - // sig is a selected signal, get data - // determine ID of infrastructure component related to signal (via config) - let icID = props.icIDs[sig.id] - - // distinguish between input and output signals - if (sig.direction === "out") { - if (props.data[icID] != null && props.data[icID].output != null && props.data[icID].output.values != null) { - if (props.data[icID].output.values[sig.index-1] !== undefined) { - data.push(props.data[icID].output.values[sig.index-1]); - } - } - } else if (sig.direction === "in") { - if (props.data[icID] != null && props.data[icID].input != null && props.data[icID].input.values != null) { - if (props.data[icID].input.values[sig.index-1] !== undefined) { - data.push(props.data[icID].input.values[sig.index-1]); - } - } - } - } // sig is selected signal - } // loop over props.signals - } // loop over selected signals - - return {signals: intersection, data: data} - } - - // updateSignalSelection(signal, checked) { - // // Update the selected signals and propagate to parent component - // var new_widget = Object.assign({}, this.props.widget, { - // checkedSignals: checked ? this.state.signals.concat(signal) : this.state.signals.filter((idx) => idx !== signal) - // }); - // this.props.onWidgetChange(new_widget); - // } - - render() { - let checkBoxes = []; - - let showLegend = false; - if (this.state.signals.length > 0) { - - showLegend = true; - - // Create checkboxes using the signal indices from component config - // checkBoxes = this.state.signals.map((signal) => { - // let checked = this.state.signals.indexOf(signal) > -1; - // let chkBxClasses = classNames({ - // 'btn': true, - // 'btn-default': true, - // 'active': checked - // }); - // return this.updateSignalSelection(signal, e.target.checked)}> {signal.name} - // }); - } - - return ( -
-
-
-
- {checkBoxes.length > 0 ? ( - - {checkBoxes} - - ) : (Use edit menu to change selected signals.) - } -
- -
- -
-
- {showLegend ? ( - ) : (
) - } -
-
- ); - } -} -export default WidgetPlotTable;