diff --git a/ComponentsInitialization.js b/ComponentsInitialization.js new file mode 100644 index 0000000..9652aa2 --- /dev/null +++ b/ComponentsInitialization.js @@ -0,0 +1,68 @@ +define(function (require) { + return function (GEPPETTO) { + var ReactDOM = require('react-dom'); + var React = require('react'); + var getMuiTheme = require('material-ui/styles/getMuiTheme').default; + var MuiThemeProvider = require('material-ui/styles/MuiThemeProvider').default; + var NetPyNE = require('./NetPyNE').default; + var injectTapEventPlugin = require('react-tap-event-plugin'); + + var Utils = require('./Utils').default; + var Console = require('../../js/components/interface/console/Console'); + var TabbedDrawer = require('../../js/components/interface/drawer/TabbedDrawer'); + var PythonConsole = require('../../js/components/interface/pythonConsole/PythonConsole'); + + require('./css/netpyne.less'); + require('./css/material.less'); + require('./css/traceback.less'); + + injectTapEventPlugin(); + + const customTheme = { + palette: { + primary1Color: '#543a73', + primary2Color: '#eb557a', + primary3Color: '#ebd07a' + } + }; + + const theme = getMuiTheme(customTheme); + + function App(data = {}) { + return ( +
+ + + + + +
+ ); + } + ReactDOM.render(, document.querySelector('#mainContainer')); + + GEPPETTO.G.setIdleTimeOut(-1); + GEPPETTO.G.debug(false); //Change this to true to see messages on the Geppetto console while loading + GEPPETTO.Resources.COLORS.DEFAULT = "#6f54aa"; + GEPPETTO.trigger(GEPPETTO.Events.Show_spinner, "Initialising NetPyNE"); + + GEPPETTO.on('jupyter_geppetto_extension_ready', (data) => { + let project = { id: 1, name: 'Project', experiments: [{ "id": 1, "name": 'Experiment', "status": 'DESIGN' }] } + GEPPETTO.Manager.loadProject(project, false); + GEPPETTO.Manager.loadExperiment(1, [], []); + Utils.execPythonMessage('from netpyne_ui.netpyne_geppetto import netpyne_geppetto'); + Utils.evalPythonMessage('netpyne_geppetto.getData',[]).then((response) => { + var data = Utils.convertToJSON(response) + ReactDOM.render(, document.querySelector('#mainContainer')); + GEPPETTO.trigger("spinner:hide"); + }) + }); + }; +}); diff --git a/GeppettoConfiguration.json b/GeppettoConfiguration.json index 1fddffa..54e3cc2 100644 --- a/GeppettoConfiguration.json +++ b/GeppettoConfiguration.json @@ -1,18 +1,22 @@ { - "_README" : "http://docs.geppetto.org/en/latest/build.html", - "contextPath": "org.geppetto.frontend", - "useSsl": false, - "embedded": false, - "embedderURL": ["/"], - "rootRedirect":"", - "noTest": false, - "themes": "css/colors", - "properties": { - "title" : "geppetto", - "description": "Geppetto is an open-source platform to build web-based tools to visualize and simulate neuroscience data and models. This is a live deployment to showcase its functionalities.", - "type": "website", - "url": "http://live.geppetto.org", - "icon" :"geppetto/style/favicon.png", - "image": "http://www.geppetto.org/images/logo.png" - } -} \ No newline at end of file + "_README" : "http://docs.geppetto.org/en/latest/build.html", + "contextPath": "org.geppetto.frontend", + "useSsl": false, + "embedded": false, + "embedderURL": ["/"], + "rootRedirect":"", + "noTest": false, + "extensions": { + "geppetto-default/ComponentsInitialization": false, + "geppetto-netpyne/ComponentsInitialization": true + }, + "themes": "css/colors", + "properties": { + "title" : "NetPyNE", + "description": "NetPyNE-UI is a user interface for building, visualizing and simulationg neuronal network models using NetPyNE.", + "type": "website", + "url": "https://github.com/MetaCell/NetPyNE-UI", + "icon" :"https://d30y9cdsu7xlg0.cloudfront.net/png/38902-200.png", + "image": "http://www.geppetto.org/images/logo.png" + } +} diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 80f65a0..0000000 --- a/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -The MIT License (MIT) - -Copyright © 2011, 2017 Geppetto authors -http://geppetto.org - -All rights reserved. This program and the accompanying materials -are made available under the terms of the MIT License -which accompanies this distribution, and is available at -http://opensource.org/licenses/MIT - -Contributors: - Geppetto - http://contributors.geppetto.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Main.js b/Main.js deleted file mode 100644 index ec80a63..0000000 --- a/Main.js +++ /dev/null @@ -1,87 +0,0 @@ -global.jQuery = require("jquery"); -global.GEPPETTO_CONFIGURATION = require('./GeppettoConfiguration.json'); - -jQuery(function () { - require('geppetto-client-initialization'); - var ReactDOM = require('react-dom'); - var React = require('react'); - var getMuiTheme = require('@material-ui/core/styles/createMuiTheme').default; - var MuiThemeProvider = require('@material-ui/core/styles/MuiThemeProvider').default; - var NetPyNE = require('./NetPyNE').default; - - - var Utils = require('./Utils').default; - var Console = require('geppetto-client/js/components/interface/console/Console'); - var TabbedDrawer = require('geppetto-client/js/components/interface/drawer/TabbedDrawer'); - var PythonConsole = require('geppetto-client/js/components/interface/pythonConsole/PythonConsole'); - - require('./css/netpyne.less'); - require('./css/material.less'); - require('./css/traceback.less'); - - - const customTheme = { - palette: { - type: 'light', - primary: { - main: '#543a73', - light: '#634587', - dark: '#5e4081', - contrastText: '#fff' - }, - secondary: { - main: '#eb557a', - light: '#66d2e2', - contrastText: '#fff' - }, - text: { - primary: '#333', - secondary: '#333' - } - - }, - typography: { - htmlFontSize: 16, - fontFamily: ["Roboto", "Helvetica", "Arial", "sans-serif"] - } - }; - - const theme = getMuiTheme(customTheme); - - function App (data = {}) { - return ( -
- - - - - -
- ); - } - ReactDOM.render(, document.querySelector('#mainContainer')); - - GEPPETTO.G.setIdleTimeOut(-1); - GEPPETTO.G.debug(false); // Change this to true to see messages on the Geppetto console while loading - GEPPETTO.Resources.COLORS.DEFAULT = "#6f54aa"; - GEPPETTO.trigger(GEPPETTO.Events.Show_spinner, "Initialising NetPyNE"); - - GEPPETTO.on('jupyter_geppetto_extension_ready', data => { - let project = { id: 1, name: 'Project', experiments: [{ "id": 1, "name": 'Experiment', "status": 'DESIGN' }] } - GEPPETTO.Manager.loadProject(project, false); - GEPPETTO.Manager.loadExperiment(1, [], []); - Utils.execPythonMessage('from netpyne_ui.netpyne_geppetto import netpyne_geppetto'); - Utils.evalPythonMessage('netpyne_geppetto.getData',[]).then(response => { - var data = Utils.convertToJSON(response) - ReactDOM.render(, document.querySelector('#mainContainer')); - GEPPETTO.trigger("spinner:hide"); - }) - }); -}); \ No newline at end of file diff --git a/NetPyNE.js b/NetPyNE.js index 7ab45a4..a401579 100644 --- a/NetPyNE.js +++ b/NetPyNE.js @@ -1,9 +1,5 @@ import React from 'react'; import Toolbar from '@material-ui/core/Toolbar'; -import { ExpansionPanel, ExpansionPanelSummary, ExpansionPanelDetails } from '@material-ui/core'; -import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; -import Typography from '@material-ui/core/Typography'; - import Transition from './components/transition/Transition'; import NetPyNEPopulations from './components/definition/populations/NetPyNEPopulations'; import NetPyNECellRules from './components/definition/cellRules/NetPyNECellRules'; @@ -46,7 +42,7 @@ export default class NetPyNE extends React.Component { this.handleTabChangedByToolBar = this.handleTabChangedByToolBar.bind(this) } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { if (this.props.data != nextProps.data) { console.log("Initialising NetPyNE Tabs") @@ -104,11 +100,11 @@ export default class NetPyNE extends React.Component { })) }; - handleTransitionOptionsChange = (e, v) => { + handleTransitionOptionsChange = value => { var state = { fastForwardInstantiation: false, fastForwardSimulation: false } - if (v == 'Create and Simulate Network') { + if (value == 'Create and Simulate Network') { state = { fastForwardInstantiation: true, fastForwardSimulation: true } - } else if (v == 'Create Network') { + } else if (value == 'Create Network') { state = { fastForwardInstantiation: true, fastForwardSimulation: false } } this.setState(state) @@ -144,7 +140,16 @@ export default class NetPyNE extends React.Component { return
} else { if (this.state.value == 'define'){ - var content = this.renderModelConfiguration() + var content =
+ + + + + + + + +
} else { var content = } @@ -157,7 +162,10 @@ export default class NetPyNE extends React.Component {
- +
@@ -178,50 +186,4 @@ export default class NetPyNE extends React.Component { ) } } - - - renderModelConfiguration () { - const Expandable = ({ title, subtitle, children }) => - } - > -
- {title} - {subtitle} -
-
- {children} -
; - - - return
- - - - - - - - - - - - - - - - - - - - - - - - - - -
; - } } diff --git a/PULL_REQUEST_TEMPLATE b/PULL_REQUEST_TEMPLATE deleted file mode 100644 index f654a60..0000000 --- a/PULL_REQUEST_TEMPLATE +++ /dev/null @@ -1,2 +0,0 @@ -- [ ] Add coverage for whatever new functionality, to a JUnit test if it's backend, to a Casper Test if it's frontend -- [ ] Make sure both push and pr travis builds are passing before asking for a review diff --git a/Utils.js b/Utils.js index dbc9eed..2e6bbbd 100644 --- a/Utils.js +++ b/Utils.js @@ -132,11 +132,11 @@ const Utils = { getErrorResponse (data){ var parsedData = this.convertToJSON(data) - if (parsedData['type'] == 'ERROR'){ + if (parsedData.type && parsedData['type'] == 'ERROR') { const error = { details: parsedData['details'] } - if (parsedData.message) { + if (Object.prototype.hasOwnProperty.call(parsedData, "message")) { error["message"] = parsedData['message'] - } else if (parsedData.websocket) { + } else if (Object.prototype.hasOwnProperty.call(parsedData, "websocket")) { error["message"] = parsedData['websocket'] } return error @@ -144,7 +144,6 @@ const Utils = { return null; }, - parsePythonException (exception){ return

   },
diff --git a/WEB-INF/shiro.ini b/WEB-INF/shiro.ini
deleted file mode 100644
index ad1c16b..0000000
--- a/WEB-INF/shiro.ini
+++ /dev/null
@@ -1,16 +0,0 @@
-[main]
-
-shiro.loginUrl = /login
-
-cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
-securityManager.cacheManager = $cacheManager
-
-# Configure a Realm to connect to a user datastore.
-myRealm = org.geppetto.frontend.controllers.GeppettoRealm
-
-securityManager.realm = $myRealm
-
-[urls]
-#/logout = logout
-/login = authc
-/simulator = authc
\ No newline at end of file
diff --git a/WEB-INF/spring/app-config.xml b/WEB-INF/spring/app-config.xml
deleted file mode 100644
index a57575c..0000000
--- a/WEB-INF/spring/app-config.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-	
-	
-	
-	
-	
-
-	
-
-	
-
-	
-
-	
-
-	
-		
-			/
-		
-	
-
-	
-		
-			/build/
-		
-		
-			.vm
-		
-		
-			true
-		
-	
-
-
-	
-	
-		
-		
-		
-		
-	
-
-	
-		
-	
-	
-	
-		
-	
-
-	
-	
-
-		
-		
-		
-		
-		
-
-		
-
-	
-
-
-
-
-
-
diff --git a/WEB-INF/spring/osgi-config.xml b/WEB-INF/spring/osgi-config.xml
deleted file mode 100644
index 48eb0e3..0000000
--- a/WEB-INF/spring/osgi-config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-    
-    
-
-	
-
diff --git a/WEB-INF/web.ejs b/WEB-INF/web.ejs
deleted file mode 100644
index 7643e91..0000000
--- a/WEB-INF/web.ejs
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-    org.geppetto.frontend
-
-    
-        contextClass
-        org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext
-    
-    
-        contextConfigLocation
-        /WEB-INF/spring/*.xml
-    
-
-    
-		org.springframework.web.context.request.RequestContextListener
-	
-    
-        org.springframework.web.context.ContextLoaderListener
-    
-    
-        org.apache.shiro.web.env.EnvironmentLoaderListener
-    
-
-    
-        springdispatcher
-        org.springframework.web.servlet.DispatcherServlet
-        
-            contextClass
-            org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext
-        
-        
-            contextConfigLocation
-            /WEB-INF/spring/*.xml
-        
-        1
-    
-
-    
-        springdispatcher
-        /
-    
-
-    
-   		json
-    	application/json
-	
-    
-        
-        TestServlet
-        TestServlet
-        org.geppetto.frontend.TestServlet
-    
-    
-        TestServlet
-        /TestServlet
-    
-
-    
-        ShiroFilter
-        org.apache.shiro.web.servlet.ShiroFilter
-    
-
-    
-        ShiroFilter
-        /*
-        REQUEST
-        FORWARD
-        INCLUDE
-        ERROR
-    
-
-    <% if ((htmlWebpackPlugin.options.GEPPETTO_CONFIGURATION.embedded == true) && (htmlWebpackPlugin.options.GEPPETTO_CONFIGURATION.embedderURL != "/")) { %>
-    
-	  CorsFilter
-	  org.apache.catalina.filters.CorsFilter
-	  
-		cors.allowed.origins
-		<%= htmlWebpackPlugin.options.GEPPETTO_CONFIGURATION.embedderURL %>
-	  
-	
-	
-	  CorsFilter
-	  /*
-	
-	<% } %>
-
-
-    <% if (htmlWebpackPlugin.options.GEPPETTO_CONFIGURATION.useSsl == true) { %>
-    
-        
-            securedapp
-            /*
-        
-        
-            NONE
-        
-    
-    <% } %>
-
-
diff --git a/WEB-INF/web.xml b/WEB-INF/web.xml
index 0c7a30e..1250132 100644
--- a/WEB-INF/web.xml
+++ b/WEB-INF/web.xml
@@ -1,81 +1,85 @@
-
-
-
-    org.geppetto.frontend
-
-    
-        contextClass
-        org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext
-    
-    
-        contextConfigLocation
-        /WEB-INF/spring/*.xml
-    
-
-    
-		org.springframework.web.context.request.RequestContextListener
-	
-    
-        org.springframework.web.context.ContextLoaderListener
-    
-    
-        org.apache.shiro.web.env.EnvironmentLoaderListener
-    
-
-    
-        springdispatcher
-        org.springframework.web.servlet.DispatcherServlet
-        
-            contextClass
-            org.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext
-        
-        
-            contextConfigLocation
-            /WEB-INF/spring/*.xml
-        
-        1
-    
-
-    
-        springdispatcher
-        /
-    
-
-    
-   		json
-    	application/json
-	
-    
-        
-        TestServlet
-        TestServlet
-        org.geppetto.frontend.TestServlet
-    
-    
-        TestServlet
-        /TestServlet
-    
-
-    
-        ShiroFilter
-        org.apache.shiro.web.servlet.ShiroFilter
-    
-
-    
-        ShiroFilter
-        /*
-        REQUEST
-        FORWARD
-        INCLUDE
-        ERROR
-    
-
-    
-
-
-    
-
-
+Html Webpack Plugin:
+
+  Error: Child compilation failed:
+  Module build failed (from ./node_modules/html-webpack-plugin/lib/loader.js):
+  Error: ENOENT: no such file or directory, open '/home/user/netpyne/webapp/WEB-  INF/web.ejs':
+  Error: ENOENT: no such file or directory, open '/home/user/netpyne/webapp/WEB-  INF/web.ejs'
+  
+  - compiler.js:79 
+    [webapp]/[html-webpack-plugin]/lib/compiler.js:79:16
+  
+  - Compiler.js:339 
+    [webapp]/[webpack]/lib/Compiler.js:339:11
+  
+  - Compiler.js:664 
+    [webapp]/[webpack]/lib/Compiler.js:664:15
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compiler.js:661 
+    [webapp]/[webpack]/lib/Compiler.js:661:31
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compilation.js:1395 
+    [webapp]/[webpack]/lib/Compilation.js:1395:35
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compilation.js:1386 
+    [webapp]/[webpack]/lib/Compilation.js:1386:32
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compilation.js:1381 
+    [webapp]/[webpack]/lib/Compilation.js:1381:36
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compilation.js:1377 
+    [webapp]/[webpack]/lib/Compilation.js:1377:32
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compilation.js:1314 Compilation.seal
+    [webapp]/[webpack]/lib/Compilation.js:1314:27
+  
+  - Compiler.js:658 
+    [webapp]/[webpack]/lib/Compiler.js:658:18
+  
+  - Compilation.js:1234 
+    [webapp]/[webpack]/lib/Compilation.js:1234:4
+  
+  
+  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
+    [webapp]/[webpack]/[tapable]/lib/Hook.js:154:20
+  
+  - Compilation.js:1226 Compilation.finish
+    [webapp]/[webpack]/lib/Compilation.js:1226:28
+  
+  - Compiler.js:655 
+    [webapp]/[webpack]/lib/Compiler.js:655:17
+  
+  
+  - Compilation.js:1158 
+    [webapp]/[webpack]/lib/Compilation.js:1158:12
+  
+  - Compilation.js:1070 
+    [webapp]/[webpack]/lib/Compilation.js:1070:9
+  
+  - task_queues.js:79 processTicksAndRejections
+    internal/process/task_queues.js:79:11
+  
+
\ No newline at end of file diff --git a/components/Application.js b/components/Application.js deleted file mode 100644 index 8153bd6..0000000 --- a/components/Application.js +++ /dev/null @@ -1,144 +0,0 @@ -import React, { Component } from 'react'; -import Logo from 'geppetto-client/js/components/interface/logo/Logo'; -import Share from 'geppetto-client/js/components/interface/share/Share'; -import Canvas from 'geppetto-client/js/components/interface/3dCanvas/Canvas'; -import SpotLight from 'geppetto-client/js/components/interface/spotlight/spotlight'; -import LinkButton from 'geppetto-client/js/components/interface/linkButton/LinkButton'; -import TabbedDrawer from 'geppetto-client/js/components/interface/drawer/TabbedDrawer'; -import ControlPanel from 'geppetto-client/js/components/interface/controlPanel/controlpanel'; -import SimulationControls from 'geppetto-client/js/components/interface/simulationControls/ExperimentControls'; -import ForegroundControls from 'geppetto-client/js/components/interface/foregroundControls/ForegroundControls'; - -const Home = require('geppetto-client/js/components/interface/home/HomeButton'); -const Console = require('geppetto-client/js/components/interface/console/Console'); -const SaveControl = require('geppetto-client/js/components/interface/save/SaveControl'); -const ExperimentsTable = require('geppetto-client/js/components/interface/experimentsTable/ExperimentsTable'); - -var $ = require('jquery'); -var GEPPETTO = require('geppetto'); - -require('../css/Application.less'); - -export default class Application extends Component { - - constructor (props) { - super(props); - - this.state = {}; - - this.voltage_color = this.voltage_color.bind(this); - - this.passThroughDataFilter = function (entities) { - return entities; - }; - } - - voltage_color (x) { - x = (x + 0.07) / 0.1; // normalization - if (x < 0) { - x = 0; - } - if (x > 1) { - x = 1; - } - if (x < 0.25) { - return [0, x * 4, 1]; - } else if (x < 0.5) { - return [0, 1, (1 - (x - 0.25) * 4)]; - } else if (x < 0.75) { - return [(x - 0.5) * 4, 1, 0]; - } else { - return [1, (1 - (x - 0.75) * 4), 0]; - } - } - - /* React functions */ - - componentWillMount () { - window.voltage_color = function (x) { - return this.voltage_color(x); - }.bind(this); - } - - componentDidMount () { - GEPPETTO.G.setIdleTimeOut(-1); - GEPPETTO.G.enableLocalStorage(false); - - if (this.refs.canvasRef !== undefined) { - this.refs.canvasRef.displayAllInstances(); - } - - if (this.refs.controlPanelRef !== undefined) { - this.refs.controlPanelRef.setDataFilter(this.passThroughDataFilter); - } - - if (this.refs.spotlightRef !== undefined) { - this.refs.spotlightRef.addSuggestion(GEPPETTO.Spotlight.plotSample, GEPPETTO.Resources.PLAY_FLOW); - } - } - - render () { - - return ( -
- -
- ); - } -} diff --git a/components/base/SelectField.js b/components/base/SelectField.js deleted file mode 100644 index 9b770a6..0000000 --- a/components/base/SelectField.js +++ /dev/null @@ -1,31 +0,0 @@ -import React, { Component } from 'react'; -import InputLabel from '@material-ui/core/InputLabel'; -import FormHelperText from '@material-ui/core/FormHelperText'; -import FormControl from '@material-ui/core/FormControl'; -import Select from '@material-ui/core/Select'; - -export default class SelectField extends Component{ - constructor (props){ - super(props); - } - - render () { - const { id, label, children, ...selectProps } = this.props; - return - {label} - - { - selectProps.errorText ? {selectProps.errorText } : '' - } - - ; - } - -} diff --git a/components/definition/cellRules/NetPyNECellRule.js b/components/definition/cellRules/NetPyNECellRule.js index 730752a..1eeb3c7 100644 --- a/components/definition/cellRules/NetPyNECellRule.js +++ b/components/definition/cellRules/NetPyNECellRule.js @@ -1,19 +1,16 @@ import React from 'react'; import MenuItem from '@material-ui/core/MenuItem'; import TextField from '@material-ui/core/TextField'; -import SelectField from '../../base/SelectField'; + import Button from '@material-ui/core/Button'; import Utils from '../../../Utils'; import NetPyNEField from '../../general/NetPyNEField'; +import Select from '../../general/Select'; import NetPyNECoordsRange from '../../general/NetPyNECoordsRange'; import Dialog from '@material-ui/core/Dialog/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability'); -var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(SelectField); +var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(Select); export default class NetPyNECellRule extends React.Component { @@ -69,7 +66,7 @@ export default class NetPyNECellRule extends React.Component { this.updateTimer = setTimeout(updateMethod, 1000); } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { this.setState({ currentName: nextProps.name }); } @@ -78,10 +75,11 @@ export default class NetPyNECellRule extends React.Component { -1} + checked={selected.indexOf(name) > -1} value={name} - >{name} + > + {name} + )); } @@ -97,18 +95,12 @@ export default class NetPyNECellRule extends React.Component { var title = this.state.errorMessage; var children = this.state.errorDetails; var dialogPop = (this.state.errorMessage != undefined ? - {title} - - - {children} - - - - { actions } - - + {children} : undefined ) diff --git a/components/definition/cellRules/NetPyNECellRules.js b/components/definition/cellRules/NetPyNECellRules.js index 418f377..3bb9c75 100644 --- a/components/definition/cellRules/NetPyNECellRules.js +++ b/components/definition/cellRules/NetPyNECellRules.js @@ -2,7 +2,7 @@ import React from 'react'; import Button from '@material-ui/core/Button'; import ContentAdd from '@material-ui/icons/Add'; import NavigationMoreHoriz from '@material-ui/icons/MoreHoriz'; - +import { Card, CardHeader, CardContent } from '@material-ui/core'; import FloatingActionButton from '@material-ui/core/Fab'; import NetPyNECellRule from './NetPyNECellRule'; import NetPyNEThumbnail from '../../general/NetPyNEThumbnail'; @@ -13,10 +13,6 @@ import NetPyNENewMechanism from './sections/mechanisms/NetPyNENewMechanism'; import NetPyNEMechanismThumbnail from './sections/mechanisms/NetPyNEMechanismThumbnail'; import NavigationChevronRight from '@material-ui/icons/ChevronRight'; import Dialog from '@material-ui/core/Dialog/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; import Utils from '../../../Utils'; import NetPyNEHome from '../../general/NetPyNEHome'; @@ -38,9 +34,8 @@ const styles = { marginLeft: '15px', float: 'left', borderRadius: 25, - boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 6px 0 rgba(0, 0, 0, 0.19)' - }, - icon: { borderRadius: 25 } + boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.2), 0 3px 6px 0 rgba(0, 0, 0, 0.19)', + } } } @@ -475,13 +470,13 @@ export default class NetPyNECellRules extends React.Component { } } else { if (page == "sections" ) { - return + return } else { if (selectedCellRule) { if (!!model && !!model[selectedCellRule] && Object.keys(model[selectedCellRule]['secs']).length > 0){ - return + return } else { - return + return } } else { return '' @@ -497,21 +492,23 @@ export default class NetPyNECellRules extends React.Component { let selection = null; let container = null; - const actions = @@ -637,9 +633,19 @@ export default class NetPyNECellRules extends React.Component {
{ selection }
- {dialogPop} - + ); + return ( + + + {content} + {dialogPop} + + ); } } diff --git a/components/definition/cellRules/sections/NetPyNESection.js b/components/definition/cellRules/sections/NetPyNESection.js index 302fb16..7ff89e8 100644 --- a/components/definition/cellRules/sections/NetPyNESection.js +++ b/components/definition/cellRules/sections/NetPyNESection.js @@ -1,17 +1,13 @@ import React from 'react'; import MenuItem from '@material-ui/core/MenuItem'; import TextField from '@material-ui/core/TextField'; -import SelectField from '../../../base/SelectField'; import FontIcon from '@material-ui/core/Icon'; import CardContent from '@material-ui/core/CardContent'; import { BottomNavigation, BottomNavigationAction } from '@material-ui/core'; +import Select from '../../../general/Select'; import ListComponent from '../../../general/List'; import NetPyNEField from '../../../general/NetPyNEField'; import Dialog from '@material-ui/core/Dialog/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; import Button from '@material-ui/core/Button'; import Utils from '../../../../Utils'; @@ -19,7 +15,10 @@ import Utils from '../../../../Utils'; var PythonControlledCapability = require('geppetto-client/js/communication/geppettoJupyter/PythonControlledCapability'); var PythonControlledTextField = PythonControlledCapability.createPythonControlledControl(TextField); var PythonControlledListComponent = PythonControlledCapability.createPythonControlledControl(ListComponent); -var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(SelectField); +var PythonMethodControlledSelectField = PythonControlledCapability.createPythonControlledControlWithPythonDataFetch(Select); + +const hoverColor = '#66d2e2'; +const changeColor = 'rgb(0, 188, 212)'; export default class NetPyNESection extends React.Component { @@ -69,14 +68,13 @@ export default class NetPyNESection extends React.Component { return )} onClick={() => this.select(index, sectionId)} /> } - componentWillReceiveProps (nextProps) { + UNSAFE_componentWillReceiveProps (nextProps) { this.setState({ currentName: nextProps.name }); } @@ -87,7 +85,6 @@ export default class NetPyNESection extends React.Component { id={name + "MenuItem"} key={name} value={name} - primaryText={name} > {name} @@ -108,23 +105,17 @@ export default class NetPyNESection extends React.Component { var children = this.state.errorDetails; var dialogPop = (this.state.errorMessage != undefined ? - {title} - - - {children} - - - - { actions } - + {children} : undefined ); - var content; + var content =
; var that = this; if (this.state.sectionId == "General") { content = ( @@ -200,8 +191,8 @@ export default class NetPyNESection extends React.Component { return (
- - + + {bottomNavigationItems} diff --git a/components/definition/cellRules/sections/NetPyNESectionThumbnail.js b/components/definition/cellRules/sections/NetPyNESectionThumbnail.js index e2e8a55..b1171f2 100644 --- a/components/definition/cellRules/sections/NetPyNESectionThumbnail.js +++ b/components/definition/cellRules/sections/NetPyNESectionThumbnail.js @@ -37,7 +37,7 @@ export default class NetPyNESectionThumbnail extends React.Component { let label; if (isHovered && selected) { - label = + label = } else { label = name.length > 14 ? `${name.slice(0,10)}...` : name } @@ -46,7 +46,7 @@ export default class NetPyNESectionThumbnail extends React.Component { + + + ); } } diff --git a/components/general/FileBrowser.js b/components/general/FileBrowser.js index 8d67e11..06c4f2e 100644 --- a/components/general/FileBrowser.js +++ b/components/general/FileBrowser.js @@ -2,14 +2,15 @@ import React from 'react'; import Tree from 'geppetto-client/js/components/interface/tree/Tree' import Utils from '../../Utils'; import Button from '@material-ui/core/Button'; -import IconButton from '@material-ui/core/IconButton'; -import FontIcon from '@material-ui/core/Icon'; -import { walk, changeNodeAtPath } from 'react-sortable-tree'; +import { changeNodeAtPath } from 'react-sortable-tree'; import Dialog from '@material-ui/core/Dialog'; + import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; + +import IconButton from '@material-ui/core/IconButton'; +import Icon from '@material-ui/core/Icon'; +import { walk } from 'react-sortable-tree'; export default class FileBrowser extends React.Component { @@ -34,11 +35,11 @@ export default class FileBrowser extends React.Component { rowInfo.node.children = dirList; rowInfo.node.expanded = true; rowInfo.node.load = true; - var newTreeData = changeNodeAtPath({ - treeData: treeData, - path: rowInfo.path, - newNode: rowInfo.node, - getNodeKey: ({ treeIndex }) => treeIndex + var newTreeData = changeNodeAtPath({ + treeData: treeData, + path: rowInfo.path, + newNode: rowInfo.node, + getNodeKey: ({ treeIndex }) => treeIndex }); } else { var newTreeData = dirList; @@ -61,11 +62,6 @@ export default class FileBrowser extends React.Component { } } - componentDidUpdate (prevProps, prevState) { - if (prevProps.open == false && this.props.open) { - this.getDirList([]); - } - } getSelectedFiles () { const nodes = {} if (!this.refs.tree) { @@ -85,10 +81,15 @@ export default class FileBrowser extends React.Component { return nodes } + componentDidUpdate (prevProps, prevState) { + if (prevProps.open == false && this.props.open) { + this.getDirList([]); + } + } handleMoveUp (reset = false) { var path = this.refs.tree.state.treeData[0].path.split("/").slice(0, -2).join('/') || '/' - + if (reset) { path = window.currentFolder } @@ -114,69 +115,58 @@ export default class FileBrowser extends React.Component { this.props.onRequestClose() } + render () { const actions = [ , ]; - + var selectMessage = this.props.exploreOnlyDirs ? "Select a folder. " : "Select a file. "; return ( - this.props.onRequestClose()} > - - - {selectMessage} - - - -
- {selectMessage} - These paths are relative to:
-
- {this.currentFolder || window.currentFolder} - { - this.handleMoveUp() - }} - tooltip='Enclosing Folder' - tooltipPosition={'top-right'} - > - - - { - this.handleMoveUp(true) - }} - tooltip='Home folder' - tooltipPosition={'top-right'} - > - - -
+ +
+ {selectMessage} + These paths are relative to:
+
+ {this.currentFolder || window.currentFolder} + this.handleMoveUp()} + tooltip-data='Enclosing Folder' + > + + + this.handleMoveUp(true)} + tooltip-data='Home folder' + > + +
- + +
< Tree id="TreeContainerCutting" style={{ width: "100%", height: "400px", float: 'left' }} @@ -189,10 +179,8 @@ export default class FileBrowser extends React.Component { />
- { actions } + {actions} - -
) } diff --git a/components/general/List.js b/components/general/List.js index 1707d8f..bc47488 100644 --- a/components/general/List.js +++ b/components/general/List.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import TextField from '@material-ui/core/TextField'; import IconButton from '@material-ui/core/IconButton'; -import FontIcon from '@material-ui/core/Icon'; +import Icon from '@material-ui/core/Icon'; /** * Generic List/Dict Component @@ -207,22 +207,26 @@ export default class ListComponent extends Component { } else { var value = this.state.children[key]; } - return
- - this.removeChild(key)} - tooltip='Remove item from the list' + return ( +
- - -
+ + this.removeChild(key)} + tooltip-data='Remove item from the list' + > + + +
+ ) }); return ( @@ -234,18 +238,19 @@ export default class ListComponent extends Component { onKeyPress={e => e.key === 'Enter' ? this.addChild() : null } value={this.state.newItemValue} style={{ width: '100%' }} - error={Boolean(this.state.newItemErrorText)} helperText={this.state.newItemErrorText} /> - {!this.state.newItemErrorText - && - - + {!this.state.newItemErrorText + && ( + + + + ) } {childrenWithExtraProp.length > 0 &&
{childrenWithExtraProp}
} diff --git a/components/general/NetPyNEAddNew.js b/components/general/NetPyNEAddNew.js index 786cd03..03c0eb5 100644 --- a/components/general/NetPyNEAddNew.js +++ b/components/general/NetPyNEAddNew.js @@ -20,7 +20,6 @@ export default class NetPyNEAddNew extends React.Component { return ( this.setState({ rangeType: event.target.value })} > {this.createMenuItems()} diff --git a/components/general/NetPyNEField.js b/components/general/NetPyNEField.js index cb2752a..7c2b582 100644 --- a/components/general/NetPyNEField.js +++ b/components/general/NetPyNEField.js @@ -1,13 +1,14 @@ import React, { Component } from 'react'; import Dialog from '@material-ui/core/Dialog'; +import Button from '@material-ui/core/Button'; +import MenuItem from '@material-ui/core/MenuItem'; +import Utils from '../../Utils'; + + import DialogActions from '@material-ui/core/DialogActions'; import DialogContent from '@material-ui/core/DialogContent'; import DialogContentText from '@material-ui/core/DialogContentText'; import DialogTitle from '@material-ui/core/DialogTitle'; -import FlatButton from '@material-ui/core/Button'; -import MenuItem from '@material-ui/core/MenuItem'; -import FormControlLabel from '@material-ui/core/FormControlLabel'; -import Utils from '../../Utils'; export default class NetPyNEField extends Component { constructor (props) { @@ -63,34 +64,46 @@ export default class NetPyNEField extends Component { render () { var help = Utils.getMetadataField(this.props.id, "help"); if (help != undefined && help != '') { - var helpComponent =
- - - NetPyNE Help - - - {this.state.helpText} - - - - Got it - - - -
+ var helpComponent = ( +
+