Skip to content

Commit

Permalink
Merge pull request #827 from openworm/development
Browse files Browse the repository at this point in the history
Release 0.4.1
  • Loading branch information
tarelli authored Sep 4, 2018
2 parents ac67ac6 + 0eb0b8e commit d091f65
Show file tree
Hide file tree
Showing 25 changed files with 621 additions and 502 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.geppetto</groupId>
<artifactId>frontend</artifactId>
<version>0.4.0</version>
<version>0.4.1</version>
<name>Geppetto Frontend</name>
<packaging>war</packaging>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public void runExperiment(String requestID, long experimentID, long projectId)
* @param dataSourceId
* @param variableId
*/
public void fetchVariable(String requestID, Long projectId, String dataSourceId, String variableId)
public void fetchVariable(String requestID, Long projectId, String dataSourceId, String[] variableId)
{
IGeppettoProject geppettoProject = retrieveGeppettoProject(projectId);
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ class GeppettoModelAPIParameters
String dataSourceId;
List<String> paths;
String path;
String variableId;
String[] variableId;
List<RunnableQueryDT> runnableQueries;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/common/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ define(function (require) {
* @param variableId
* @param datasourceId
*/
fetchVariable: function (variableId, datasourceId, callback) {
if (!window.Model.hasOwnProperty(variableId)) {
fetchVariables: function (variableIds, datasourceId, callback) {
if (!window.Model.hasOwnProperty(variableIds)) {
var params = {};
params["projectId"] = Project.getId();
params["variableId"] = variableId;
params["variableId"] = variableIds;
params["dataSourceId"] = datasourceId;

var requestID = GEPPETTO.MessageSocket.send("fetch_variable", params, callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ define(function (require, exports, module) {
}
else {
if (this.component != undefined) {
if (this.component.state.value != value || this.component.state.searchText != value) {
if (this.component.state.value !== value || this.component.state.searchText !== value) {
this.component.setState({ value: value, searchText: value, checked: (value || value == "True") });
}
}
Expand Down Expand Up @@ -297,4 +297,4 @@ define(function (require, exports, module) {
LabelSync: LabelSync,
DropDownSync: DropDownSync
};
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ define(function (require) {
GEPPETTO.ComponentFactory.removeExistingComponent(this.state.componentType, this);
}

componentWillUnmount(){
componentWillUnmount() {
this.disconnectFromPython();
}

componentWillReceiveProps(nextProps) {
this.disconnectFromPython();
this.id = (nextProps.id == undefined) ? nextProps.model : nextProps.id;
Expand Down Expand Up @@ -125,28 +125,39 @@ define(function (require) {
}
break;
}
if (this.props.validate) {
this.props.validate(this.state.value).then((errorState) => {
this.setState(errorState);
});
}
}



updatePythonValue(newValue) {
this.setState({ value: newValue, searchText: newValue, checked: newValue });

if (this.props.prePythonSyncProcessing!==undefined) {
newValue = this.props.prePythonSyncProcessing(newValue);
}
//whenever we invoke syncValueWithPython we will propagate the Javascript value of the model to Python
if (this.syncValueWithPython) {
// this.syncValueWithPython((event.target.type == 'number') ? parseFloat(this.state.value) : this.state.value, this.props.requirement);
switch (this.props.realType) {
case 'float':
newValue = parseFloat(newValue)
if (!isNaN(newValue) && newValue !== '') {
newValue = parseFloat(newValue)
}
break;
case 'dict':
newValue = JSON.parse(newValue)
if (typeof newValue === 'string') {
newValue = JSON.parse(newValue)
}
break;
default:
break;
}
this.syncValueWithPython(newValue, window.requirement);
if (newValue !== '') {
this.syncValueWithPython(newValue, window.requirement);
}
}

this.setState({ value: newValue, searchText: newValue, checked: newValue });
this.forceUpdate();
}

Expand All @@ -155,43 +166,36 @@ define(function (require) {
if (this.updateTimer != undefined) {
clearTimeout(this.updateTimer);
}
this.updateTimer = setTimeout(updateMethod, 500);
this.updateTimer = setTimeout(updateMethod, 1000);
}

// Default handle (mainly textfields and dropdowns)
handleChange(event, index, value) {
var that = this;
var targetValue = value;
if (event != null && event.target.value != undefined) {
targetValue = event.target.value;
}
this.setState({ value: targetValue });
var v = value
this.triggerUpdate(function () {
// For textfields value is retrived from the event. For dropdown value is retrieved from the value
that.updatePythonValue(targetValue);
});

if (this.props.validate) {
this.props.validate(targetValue).then((errorState) => {
this.setState(errorState);
});
}

// For textfields value is retrieved from the event. For dropdown value is retrieved from the value
this.triggerUpdate(() => this.updatePythonValue(targetValue));
}

// Autocomplete handle
handleUpdateInput(value) {
var that = this;
var v = value
this.triggerUpdate(function () {
that.updatePythonValue(value);
});
this.triggerUpdate(() => this.updatePythonValue(value));
}

//Checkbox
handleUpdateCheckbox(event, isInputChecked) {
var that = this;
var c = isInputChecked;
this.triggerUpdate(function () {
that.updatePythonValue(isInputChecked);
});
this.triggerUpdate(() => this.updatePythonValue(isInputChecked));
}


render() {
const wrappedComponentProps = Object.assign({}, this.props);
if (wrappedComponentProps.key == undefined) {
Expand All @@ -206,7 +210,12 @@ define(function (require) {
delete wrappedComponentProps.modelName;
delete wrappedComponentProps.dimensionType;
delete wrappedComponentProps.noStyle;
delete wrappedComponentProps.validate;
delete wrappedComponentProps.prePythonSyncProcessing;

if (wrappedComponentProps.realType == 'func' || wrappedComponentProps.realType == 'float') {
wrappedComponentProps['errorText'] = this.state.errorMsg;
}
if (WrappedComponent.name != 'ListComponent') {
delete wrappedComponentProps.realType;
}
Expand Down Expand Up @@ -354,6 +363,9 @@ define(function (require) {
wrappedComponentProps['value'] = this.state.value;
delete wrappedComponentProps.model;
delete wrappedComponentProps.postProcessItems;
delete wrappedComponentProps.validate;
delete wrappedComponentProps.prePythonSyncProcessing;

if (this.props.postProcessItems) {
var items = this.props.postProcessItems(this.state.pythonData, this.state.value);
}
Expand All @@ -369,4 +381,4 @@ define(function (require) {
return PythonControlledControlWithPythonDataFetch;
},
}
})
})
4 changes: 4 additions & 0 deletions src/main/webapp/js/components/interface/console/console.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@import "./../../../../style/less/components/colors";

#commandInputArea {
color: @primary_color;
}

.consoleContainer {
height: 100%;
}
Expand Down
23 changes: 14 additions & 9 deletions src/main/webapp/js/components/interface/drawer/DrawerButton.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Button component used in the tabbed drawer to
* Button component used in the tabbed drawer to
* select the child component to display.
*
* @author Dario Del Piano
Expand All @@ -16,7 +16,8 @@ define(function (require) {
super(props);
this.state = {
mouseOver: false,
buttonActived: false}
activeButton: false
}

this.activeButton = this.activeButton.bind(this);
}
Expand All @@ -25,18 +26,22 @@ define(function (require) {
// the props labelKey is passed as parameter to the TabbedDrawer component to let it known
// which button has been selected.
activeButton() {
if((this.props.labelKey === this.props.selectedTab) && this.props.drawerOpened)
this.setState({buttonActived: true,
mouseOver: false});
else
this.setState({buttonActived: false,
mouseOver: false});
if ((this.props.labelKey === this.props.selectedTab) && this.props.drawerOpened)
this.setState({
activeButton: true,
mouseOver: false
});
else
this.setState({
activeButton: false,
mouseOver: false
});
this.props.functionDrawer(this.props.labelKey);
}

render() {
var buttonStyle = "tabButton";
if(this.props.labelKey === this.props.selectedTab) {
if (this.props.labelKey === this.props.selectedTab) {
buttonStyle = " tabButton selectedTab";
}
return (
Expand Down
Loading

0 comments on commit d091f65

Please sign in to comment.