diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js
index 968f141..9bbe661 100644
--- a/src/dashboard/dashboard.js
+++ b/src/dashboard/dashboard.js
@@ -57,6 +57,7 @@ class Dashboard extends React.Component {
prevState = {};
}
const sessionToken = LoginStore.getState().token;
+
let dashboard = Map();
console.log("dashboard calculate state was called: " + props.match.params.dashboard);
let dashboards = DashboardStore.getState()
@@ -82,7 +83,7 @@ class Dashboard extends React.Component {
});
}
- let files = FileStore.getState();
+ /*let files = FileStore.getState();
if(files.length === 0){
AppDispatcher.dispatch({
@@ -90,7 +91,7 @@ class Dashboard extends React.Component {
token: sessionToken,
param: '?objectID=1&objectType=widget'
});
- }
+ }*/
console.log("here are the widgets: ");
@@ -141,7 +142,7 @@ class Dashboard extends React.Component {
*/
}
let widgets = {};
-
+
for (let widget of dashboard.get('widgets')) {
widgets[Dashboard.lastWidgetKey] = widget;
console.log(" the last widgetKey: " + Dashboard.lastWidgetKey);
@@ -170,10 +171,10 @@ class Dashboard extends React.Component {
sessionToken: sessionToken,
projects: null, //ProjectStore.getState(),
simulations: null, //SimulationStore.getState(),
- files: FileStore.getState(),
+ files: null,
- project: prevState.project || null,
- simulation: prevState.simulation || null,
+ project: null,
+ simulation: null,
simulationModels,
editing: prevState.editing || false,
paused: prevState.paused || false,
@@ -196,19 +197,20 @@ class Dashboard extends React.Component {
}
//!!!won't work anymore
- /* componentDidMount() {
+ componentWillMount() {
//document.addEventListener('keydown', this.handleKeydown.bind(this));
console.log("problem in componentdidmount");
if (this.state.dashboard.has('id') === false) {
AppDispatcher.dispatch({
type: 'dashboards/start-load',
- data: this.props.match.params.dashboard,
- token: this.state.sessionToken
+ token: this.state.sessionToken,
+ param: '?scenarioID=1',
});
+
}
}
-
+/*
componentWillUnmount() {
//document.removeEventListener('keydown', this.handleKeydown.bind(this));
diff --git a/src/widget/widget.js b/src/widget/widget.js
index 698611c..e7b8363 100644
--- a/src/widget/widget.js
+++ b/src/widget/widget.js
@@ -84,12 +84,14 @@ class Widget extends React.Component {
AppDispatcher.dispatch({
type: 'files/start-load',
- token: this.state.sessionToken
+ token: this.state.sessionToken,
+ param: '?objectID=1&objectType=widget'
});
AppDispatcher.dispatch({
type: 'simulationModels/start-load',
- token: this.state.sessionToken
+ token: this.state.sessionToken,
+ param: '?scenarioID=1'
});
}
@@ -116,6 +118,8 @@ class Widget extends React.Component {
createWidget(widget) {
let simulationModel = null;
+ console.log("createwidget was called");
+ console.log(" the widget type is: " + widget.type);
for (let model of this.state.simulationModels) {
if (model._id !== widget.simulationModel) {
continue;
@@ -123,7 +127,7 @@ class Widget extends React.Component {
simulationModel = model;
}
-
+ //all types are lowercase!!! at least slider is
if (widget.type === 'CustomAction') {
return
} else if (widget.type === 'Action') {
@@ -147,6 +151,7 @@ class Widget extends React.Component {
} else if (widget.type === 'NumberInput') {
return this.inputDataChanged(widget, value)} />
} else if (widget.type === 'Slider') {
+ console.log("inside slider: simulationModel: " + simulationModel);
return this.props.onWidgetStatusChange(w, this.props.index) } onInputChanged={value => this.inputDataChanged(widget, value)} />
} else if (widget.type === 'Gauge') {
return
@@ -160,9 +165,10 @@ class Widget extends React.Component {
return null;
}
-
+ rn
render() {
+ console.log("!!!render Widget was called");
const element = this.createWidget(this.props.data);
if (this.props.editing) {
diff --git a/src/widget/widgets/gauge.js b/src/widget/widgets/gauge.js
index d1baa50..25cacf6 100644
--- a/src/widget/widgets/gauge.js
+++ b/src/widget/widgets/gauge.js
@@ -33,7 +33,7 @@ class WidgetGauge extends Component {
this.state = {
value: 0,
minValue: null,
- maxValue: null
+ maxValue: null
};
}
diff --git a/src/widget/widgets/label.js b/src/widget/widgets/label.js
index f53eb18..c9cafdf 100644
--- a/src/widget/widgets/label.js
+++ b/src/widget/widgets/label.js
@@ -26,8 +26,8 @@ import EditWidgetColorControl from '../edit-widget-color-control';
class WidgetLabel extends Component {
render() {
const style = {
- fontSize: this.props.widget.textSize + 'px',
- color: EditWidgetColorControl.ColorPalette[this.props.widget.fontColor]
+ fontSize: this.props.widget.customProperties.textSize + 'px',
+ color: EditWidgetColorControl.ColorPalette[this.props.widget.customProperties.fontColor]
};
return (
diff --git a/src/widget/widgets/slider.js b/src/widget/widgets/slider.js
index 4212eef..d00f9f7 100644
--- a/src/widget/widgets/slider.js
+++ b/src/widget/widgets/slider.js
@@ -39,19 +39,22 @@ class WidgetSlider extends Component {
super(props);
this.state = {
- unit: ''
+ unit: 'bla',
+
};
}
componentWillReceiveProps(nextProps) {
+ console.log("componentwillreceiveprops calle, next props: ");
+ console.log(nextProps);
if (nextProps.simulationModel == null) {
return;
}
// Update value
- if (nextProps.widget.default_value && this.state.value === undefined) {
+ if (nextProps.widget.customProperties.default_value && this.state.value === undefined) {
this.setState({
- value: nextProps.widget.default_value,
+ value: nextProps.widget.customProperties.default_value,
});
}
@@ -63,7 +66,7 @@ class WidgetSlider extends Component {
}
// Check if the orientation changed, update the size if it did
- if (this.props.widget.orientation !== nextProps.widget.orientation) {
+ if (this.props.widget.customProperties.orientation !== nextProps.widget.customProperties.orientation) {
let baseWidget = nextProps.widget;
// Exchange dimensions and constraints
@@ -94,11 +97,15 @@ class WidgetSlider extends Component {
}
render() {
- let isVertical = this.props.widget.orientation === WidgetSlider.OrientationTypes.VERTICAL.value;
+ console.log("render of slider was called");
+ console.log(this.props.widget);
+ console.log("the maxRange is : " + this.props.widget.customProperties.rangeMax);
+ let isVertical = this.props.widget.customProperties.orientation === WidgetSlider.OrientationTypes.VERTICAL.value;
+ console.log("this state has the value: " + this.state.value);
let fields = {
name: this.props.widget.name,
- control: this.valueIsChanging(v) } onAfterChange={ (v) => this.valueChanged(v) }/>,
+ control: this.valueIsChanging(v) } onAfterChange={ (v) => this.valueChanged(v) }/>,
value: { format('.3s')(Number.parseFloat(this.state.value)) },
unit: { this.state.unit }
}
@@ -111,7 +118,7 @@ class WidgetSlider extends Component {
});
return (
- this.props.widget.orientation === WidgetSlider.OrientationTypes.HORIZONTAL.value? (
+ !isVertical? (
{ fields.control }