diff --git a/public/app-config.js b/public/app-config.js new file mode 100644 index 0000000000000000000000000000000000000000..603329e61d2425ef3e1e676f58334d7b3e93d8f3 --- /dev/null +++ b/public/app-config.js @@ -0,0 +1,6 @@ +window.appConfig = { + nestDesktop: { + enabled: false, + url: "http://localhost:8000" + } +} \ No newline at end of file diff --git a/public/index.html b/public/index.html index 141a45a57899c0219880663c0b6d4d013329f20e..0ec66c0d51da4c243e01b9246f458ddf3fb06cae 100644 --- a/public/index.html +++ b/public/index.html @@ -30,6 +30,7 @@ <body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> + <script type="text/javascript" src="%PUBLIC_URL%/app-config.js"></script> <!-- This HTML file is a template. If you open it directly in the browser, you will see an empty page. diff --git a/src/components/experiment-workbench/experiment-tools-service.js b/src/components/experiment-workbench/experiment-tools-service.js index aa98743f45db90fbb5a9d099c3ec62c9a4b3cd36..11bc6db62a627168d86f366407503ea4b8332ec0 100644 --- a/src/components/experiment-workbench/experiment-tools-service.js +++ b/src/components/experiment-workbench/experiment-tools-service.js @@ -3,6 +3,7 @@ import FlexLayout from 'flexlayout-react'; import DescriptionIcon from '@material-ui/icons/Description'; import ListAltIcon from '@material-ui/icons/ListAlt'; +const appConfig = window.appConfig; import NrpCoreDashboard from '../nrp-core-dashboard/nrp-core-dashboard'; import TransceiverFunctionEditor from '../tf-editor/tf-editor'; import XpraView from '../xpra/xpra-view'; @@ -111,8 +112,8 @@ ExperimentToolsService.CONSTANTS = Object.freeze({ ExperimentToolsService.TOOLS = Object.freeze({ // NEST_DESKTOP: { // singleton: true, + // type: ExperimentToolsService.CONSTANTS.TOOL_TYPE.FLEXLAYOUT_TAB, // flexlayoutNode: { - // 'type': 'tab', // 'name': 'NEST Desktop', // 'component': 'nest-desktop' // }, @@ -134,7 +135,7 @@ ExperimentToolsService.TOOLS = Object.freeze({ 'name': 'NRP-Core Docs', 'component': 'nrp-core-docu' }, - flexlayoutFactoryCb: () => { + flexlayoutFactoryCb: () => { return <iframe src='https://hbpneurorobotics.bitbucket.io/index.html' title='NRP-Core Documentation' />; }, @@ -187,8 +188,8 @@ ExperimentToolsService.TOOLS = Object.freeze({ 'name': 'Edit experiment files', 'component': 'TransceiverFunctionEditor' }, - flexlayoutFactoryCb: () => { - return <TransceiverFunctionEditor/>; + flexlayoutFactoryCb: () => { + return <TransceiverFunctionEditor />; }, getIcon: () => { return <ListAltIcon/>; @@ -196,7 +197,29 @@ ExperimentToolsService.TOOLS = Object.freeze({ isShown: () => { return true; } + }, + NEST_DESKTOP: { + singleton: true, + type: SIM_TOOL.TOOL_TYPE.FLEXLAYOUT_TAB, + flexlayoutNode: { + 'name': 'NEST Desktop', + 'component': 'nest-desktop' + }, + flexlayoutFactoryCb: () => { + return <iframe src={appConfig.nestDesktop.url} title='NEST Desktop' />; + }, + getIcon: () => { + return <div> + <img src={'https://www.nest-simulator.org/wp-content/uploads/2015/03/nest_logo.png'} + alt="NEST Desktop" + style={{width: 40+ 'px', height: 20 + 'px'}} /> + </div>; + }, + isShown: () => { + return appConfig && appConfig.nestDesktop && appConfig.nestDesktop.enabled; + } } }); + export default ExperimentToolsService;