mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Add proper data checks output widgets
This commit is contained in:
parent
66f00767d7
commit
9d869daa0f
4 changed files with 4 additions and 3 deletions
|
@ -44,6 +44,8 @@ class WidgetGauge extends Component {
|
|||
|
||||
// update value
|
||||
if (nextProps.data == null || nextProps.data[simulator] == null
|
||||
|| nextProps.data[simulator].output == null
|
||||
|| nextProps.data[simulator].output.values == null
|
||||
|| nextProps.data[simulator].output.values.length === 0
|
||||
|| nextProps.data[simulator].output.values[0].length === 0) {
|
||||
this.setState({ value: 0 });
|
||||
|
|
|
@ -42,7 +42,7 @@ class WidgetLamp extends Component {
|
|||
const simulator = nextProps.simulationModel.simulator;
|
||||
|
||||
// update value
|
||||
if (nextProps.data == null || nextProps.data[simulator] == null || nextProps.data[simulator].output.values == null) {
|
||||
if (nextProps.data == null || nextProps.data[simulator] == null || nextProps.data[simulator].output == null || nextProps.data[simulator].output.values == null) {
|
||||
this.setState({ value: '' });
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class WidgetPlot extends React.Component {
|
|||
const simulator = nextProps.simulationModel.simulator;
|
||||
|
||||
// Proceed if a simulation with models and a simulator are available
|
||||
if (simulator && nextProps.data[simulator] != null && nextProps.data[simulator] != null) {
|
||||
if (simulator && nextProps.data[simulator] != null && nextProps.data[simulator] != null && nextProps.data[simulator].output != null && nextProps.data[simulator].output.values != null) {
|
||||
const chosenSignals = nextProps.widget.signals;
|
||||
|
||||
const data = nextProps.data[simulator].output.values.filter((values, index) => (
|
||||
|
|
|
@ -46,7 +46,6 @@ class WidgetTable extends Component {
|
|||
if (nextProps.data == null
|
||||
|| nextProps.data[simulator] == null
|
||||
|| nextProps.data[simulator].output == null
|
||||
|| nextProps.data[simulator].output.length === 0
|
||||
|| nextProps.data[simulator].output.values.length === 0
|
||||
|| nextProps.data[simulator].output.values[0].length === 0) {
|
||||
// clear values
|
||||
|
|
Loading…
Add table
Reference in a new issue