From 02dff7f7a8d126b76141dd45d5be6884d90c2dc0 Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Sun, 22 Jul 2018 11:14:53 -0500 Subject: [PATCH] WIP #264 working on runExperiment config update. --- src/plugins/InstallRuntime/configWidget.js | 2 +- src/plugins/RunExperiment/configWidget.js | 96 +++++++++------- src/plugins/RunExperiment/metadata.json | 127 ++++++++++----------- 3 files changed, 115 insertions(+), 110 deletions(-) diff --git a/src/plugins/InstallRuntime/configWidget.js b/src/plugins/InstallRuntime/configWidget.js index e037d27b..c6ac7ce6 100644 --- a/src/plugins/InstallRuntime/configWidget.js +++ b/src/plugins/InstallRuntime/configWidget.js @@ -131,7 +131,7 @@ define([ "displayName": "User for " + hostName, "description": "Select User for Host deployment or Disabled to exclude host.", "value": users[0] || disabledMessage, - valueItems: users.concat(disabledMessage), + "valueItems": users.concat(disabledMessage), "valueType": "string" }; diff --git a/src/plugins/RunExperiment/configWidget.js b/src/plugins/RunExperiment/configWidget.js index ffb1eb93..b0021f67 100644 --- a/src/plugins/RunExperiment/configWidget.js +++ b/src/plugins/RunExperiment/configWidget.js @@ -69,11 +69,7 @@ define([ // for each container create sortable selection of nodes for ordering their starting var containerNodeMap = _containerNodeMap; var containerConfig = self.makeContainerConfig( containerNodeMap ); - pluginMetadata.configStructure = containerConfig.concat(pluginMetadata.configStructure); - - // how do we want to do debugging? - var debugConfig = self.makeDebugConfig( containerNodeMap ); - pluginMetadata.configStructure = debugConfig.concat(pluginMetadata.configStructure); + pluginMetadata.configStructure = [containerConfig].concat(pluginMetadata.configStructure); // figure out their users var hostUserMap = self.makeHostUserMap( hosts, users ); @@ -84,7 +80,11 @@ define([ // where do we want to spawn roscore? var rosCoreConfig = self.makeRosCoreConfig( hosts ); - pluginMetadata.configStructure = rosCoreConfig.concat(pluginMetadata.configStructure); + pluginMetadata.configStructure = [rosCoreConfig].concat(pluginMetadata.configStructure); + + // how do we want to do debugging? + var debugConfig = self.makeDebugConfig( containerNodeMap ); + pluginMetadata.configStructure = pluginMetadata.configStructure.concat(debugConfig); var pluginDialog = new PluginConfigDialog({client: self._client}); pluginDialog.show(globalConfigStructure, pluginMetadata, prevPluginConfig, callback); @@ -197,29 +197,25 @@ define([ }; ConfigWidget.prototype.makeContainerConfig = function( containerNodeMap ) { - var self = this, - config = []; - - var tmpl = { - "name": "", - "displayName": "", - "description": "Sort the nodes in the order you wish to start them, top to bottom.", - "value": "", - "valueType": "sortable", - "valueItems": [ - ] - }; - - Object.keys(containerNodeMap).map(function(containerPath) { - var containerTmpl = Object.assign({}, tmpl); - containerTmpl.name = 'Container:'+containerPath; - containerTmpl.displayName = containerNodeMap[ containerPath ].name; - containerTmpl.valueItems = containerNodeMap[ containerPath ].nodes; + var self = this; - config.push(containerTmpl); + return Object.keys(containerNodeMap).reduce(function(o, containerPath) { + var tmpl = { + "name": containerPath, + "displayName": containerNodeMap[ containerPath ].name, + "description": "Sort the nodes in the order you wish to start them, top to bottom.", + "value": "", + "valueType": "sortable", + "valueItems": containerNodeMap[ containerPath ].nodes + }; + o.configStructure.push(tmpl); + return o; + }, { + "name": "containerConfig", + "displayName": "Container Configuration", + "valueType": "header", + "configStructure": [] }); - - return config; }; ConfigWidget.prototype.makeHostConfig = function( hostUserMap ) { @@ -255,8 +251,7 @@ define([ }; ConfigWidget.prototype.makeRosCoreConfig = function( hosts ) { - var self = this, - config = []; + var self = this; var hostNames = [ 'Any' ]; hostNames = hostNames.concat( @@ -266,19 +261,38 @@ define([ ); hostNames.push('None'); - - var tmpl = { - "name": "rosCoreHost", - "displayName": "ROS Core Host", - "description": "Select Host / Any / None to select where and whether to spawn ROS Core / ROS Master.", - "value": hostNames[0], - "valueType": "string", - "valueItems": hostNames - }; - config.push(tmpl); - - return config; + return { + "name": "rosCoreConfig", + "displayName": "ROS Core Config", + "valueType": "header", + "configStructure": [ + { + "name": "rosCoreHost", + "displayName": "ROS Core Host", + "description": "Select Host / Any / None to select where and whether to spawn ROS Core / ROS Master.", + "value": hostNames[0], + "valueType": "string", + "valueItems": hostNames + }, + { + "name": "rosMasterURI", + "displayName": "ROS Master URI.", + "description": "Connect to provided ROS MASTER URI if ROS Core Host is set to 'None'. Has the form of 'http://:'", + "value": "", + "valueType": "string", + "readOnly": false + }, + { + "name": "rosNamespace", + "displayName": "ROS Namespace.", + "description": "Sets the ROS_NAMESPACE for the experiment.", + "value": "", + "valueType": "string", + "readOnly": false + }, + ] + }; }; return ConfigWidget; diff --git a/src/plugins/RunExperiment/metadata.json b/src/plugins/RunExperiment/metadata.json index bda610c5..4be2acf3 100644 --- a/src/plugins/RunExperiment/metadata.json +++ b/src/plugins/RunExperiment/metadata.json @@ -4,80 +4,71 @@ "version": "1.0.0", "description": "Maps the containers to available hosts and runs the experiment.", "icon": { - "class": "glyphicon glyphicon-ok-circle", - "src": "" + "class": "glyphicon glyphicon-ok-circle", + "src": "" }, "disableServerSideExecution": false, "disableBrowserSideExecution": false, "configWidget": "plugin/RunExperiment/RunExperiment/configWidget", "configStructure": [ - { - "name": "rosMasterURI", - "displayName": "ROS Master URI.", - "description": "Connect to provided ROS MASTER URI if ROS Core Host is set to 'None'. Has the form of 'http://:'", - "value": "", - "valueType": "string", - "readOnly": false - }, - { - "name": "rosNamespace", - "displayName": "ROS Namespace.", - "description": "Sets the ROS_NAMESPACE for the experiment.", - "value": "", - "valueType": "string", - "readOnly": false - }, - { - "name": "waitTime", - "displayName": "Wait Time (s)", - "description": "How long to wait (in seconds) between spawning of processes.", - "value": 0, + { + "name": "rosbridge", + "displayName": "ROS Bridge Config", + "valueType": "header", + "configStructure": [ + { + "name": "spawn", + "displayName": "Spawn ROSBridge server.", + "description": "If true, it will spawn a ROS Bridge server on the ROSMOD server that connects to the system", + "value": false, + "valueType": "boolean", + "readOnly": false + }, + { + "name": "port", + "displayName": " ROSBridge server port.", + "description": "What port number should we give ROSBridge server? Leave blank for a randomly assigned port", + "value": 0, + "minValue": 0, + "maxValue": 65535, + "valueType": "integer", + "readOnly": false + }, + { + "name": "IP", + "displayName": " ROSBridge server IP.", + "description": "What is the ROS_IP of the rosbridge server - this is the IP that the nodes in the system will use to connect to the rosbridge server.", + "value": "127.0.0.1", + "valueType": "string", + "readOnly": false + } + ] + }, + { + "name": "waitTime", + "displayName": "Wait Time (s)", + "description": "How long to wait (in seconds) between spawning of processes.", + "value": 0, "minValue": 0, "maxValue": 200, - "valueType": "integer", - "readOnly": false - }, - { - "name": "forceIsolation", - "displayName": "Force Isolation.", - "description": "If true, enforces that the spawned processes must run on hosts which are not currently running other ROSMOD processes.", - "value": true, - "valueType": "boolean", - "readOnly": false - }, - { - "name": "spawnROSBridge", - "displayName": "Spawn ROSBridge server.", - "description": "If true, it will spawn a ROS Bridge server on the ROSMOD server that connects to the system", - "value": false, - "valueType": "boolean", - "readOnly": false - }, - { - "name": "rosBridgePort", - "displayName": " ROSBridge server port.", - "description": "What port number should we give ROSBridge server? Leave blank for a randomly assigned port", - "value": 0, - "minValue": 0, - "maxValue": 65535, - "valueType": "integer", - "readOnly": false - }, - { - "name": "rosBridgeServerIp", - "displayName": " ROSBridge server IP.", - "description": "What is the ROS_IP of the rosbridge server - this is the IP that the nodes in the system will use to connect to the rosbridge server.", - "value": "127.0.0.1", - "valueType": "string", - "readOnly": false - }, - { - "name": "returnZip", - "displayName": "Zip and return generated artifacts.", - "description": "If true, it enables the client to download a zip of the artifacts.", - "value": false, - "valueType": "boolean", - "readOnly": false - } + "valueType": "integer", + "readOnly": false + }, + { + "name": "forceIsolation", + "displayName": "Force Isolation.", + "description": "If true, enforces that the spawned processes must run on hosts which are not currently running other ROSMOD processes.", + "value": true, + "valueType": "boolean", + "readOnly": false + }, + { + "name": "returnZip", + "displayName": "Zip and return generated artifacts.", + "description": "If true, it enables the client to download a zip of the artifacts.", + "value": false, + "valueType": "boolean", + "readOnly": false + } ] }