Skip to content
Snippets Groups Projects
Commit ed00558e authored by Sandro Weber's avatar Sandro Weber
Browse files

trying to include compiled proto, google closure refuses to load

parent 1f0f46df
No related branches found
No related tags found
No related merge requests found
...@@ -7489,6 +7489,11 @@ ...@@ -7489,6 +7489,11 @@
"slash": "^3.0.0" "slash": "^3.0.0"
} }
}, },
"google-closure-library": {
"version": "20220104.0.0",
"resolved": "https://registry.npmjs.org/google-closure-library/-/google-closure-library-20220104.0.0.tgz",
"integrity": "sha512-gHrIxIKcnn9pR/8sVwCLH6C4urmAekSYZKYzTawKG72HQsRnadXOCuRTA+kf6nagDCbsu6HzhSWA2rMBb2L1Aw=="
},
"graceful-fs": { "graceful-fs": {
"version": "4.2.6", "version": "4.2.6",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",
...@@ -11569,6 +11574,11 @@ ...@@ -11569,6 +11574,11 @@
"path-key": "^2.0.0" "path-key": "^2.0.0"
} }
}, },
"nrp-jsproto": {
"version": "1.1.1-alpha.10",
"resolved": "https://registry.npmjs.org/nrp-jsproto/-/nrp-jsproto-1.1.1-alpha.10.tgz",
"integrity": "sha512-KFe2AQuhtx4wD76PIzxlhKFXtWYeUtyqSkONA8nYvIV9HfG67q09Qcnzhl745jZHZHZMC03xj9QVEr0x5so8Cg=="
},
"nth-check": { "nth-check": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz",
......
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
<title>Neurorobotics Platform</title> <title>Neurorobotics Platform</title>
</head> </head>
<body> <body>
<script src="./google-closure-library/closure/goog/base.js"></script>
<script src="https://iam.ebrains.eu/auth/js/keycloak.js"></script> <script src="https://iam.ebrains.eu/auth/js/keycloak.js"></script>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<!-- <!--
......
...@@ -7,12 +7,12 @@ import ErrorDialog from './components/dialog/error-dialog.js'; ...@@ -7,12 +7,12 @@ import ErrorDialog from './components/dialog/error-dialog.js';
import ExperimentOverview from './components/experiment-overview/experiment-overview'; import ExperimentOverview from './components/experiment-overview/experiment-overview';
import SimulationView from './components/simulation-view/simulation-view'; import SimulationView from './components/simulation-view/simulation-view';
import NotificationDialog from './components/dialog/notification-dialog.js'; import NotificationDialog from './components/dialog/notification-dialog.js';
import MqttClientService from './services/nrp-core/mqtt-client-service'; //import MqttClientService from './services/nrp-core/mqtt-client-service';
class App extends React.Component { class App extends React.Component {
componentDidMount() { componentDidMount() {
MqttClientService.instance.connect('ws://' + window.location.hostname + ':1884'); //MqttClientService.instance.connect('ws://' + window.location.hostname + ':1884');
} }
render() { render() {
......
import React from 'react';
import MqttClientService from '../../services/nrp-core/mqtt-client-service';
export default class NrpCoreDashboard extends React.Component {
constructor(props) {
super(props);
this.mqttBrokerUrl = 'ws://' + window.location.hostname + ':1884';
}
componentDidMount() {
MqttClientService.instance.on(MqttClientService.EVENTS.CONNECTED, this.onMqttClientConnected);
MqttClientService.instance.connect(this.mqttBrokerUrl);
}
onMqttClientConnected() {
this.client.subscribe('#', (err) => {
if (err) {
console.error(err);
}
});
}
render() {
return (
<div>
{this.mqttBrokerUrl}
</div>
);
}
}
NrpCoreDashboard.CONSTANTS = Object.freeze({
TOOL_CONFIG: {
singleton: true,
flexlayoutNode: {
'type': 'tab',
'name': 'NRP-Core Dashboard',
'component': 'nrp-core-dashboard'
},
flexlayoutFactoryCb: () => {
return <NrpCoreDashboard />;
},
getIcon: () => {
return <div>
<span>NRP-Core Dashboard</span>
</div>;
}
}
});
import NrpCoreDashboard from '../nrp-core-dashboard/nrp-core-dashboard';
let _instance = null; let _instance = null;
const SINGLETON_ENFORCER = Symbol(); const SINGLETON_ENFORCER = Symbol();
...@@ -14,6 +17,7 @@ class SimulationToolsService { ...@@ -14,6 +17,7 @@ class SimulationToolsService {
for (const toolEntry in SimulationToolsService.TOOLS) { for (const toolEntry in SimulationToolsService.TOOLS) {
this.registerToolConfig(SimulationToolsService.TOOLS[toolEntry]); this.registerToolConfig(SimulationToolsService.TOOLS[toolEntry]);
} }
this.registerToolConfig(NrpCoreDashboard.CONSTANTS.TOOL_CONFIG);
} }
static get instance() { static get instance() {
...@@ -25,6 +29,8 @@ class SimulationToolsService { ...@@ -25,6 +29,8 @@ class SimulationToolsService {
} }
registerToolConfig(toolConfig) { registerToolConfig(toolConfig) {
console.info('registerToolConfig');
console.info(toolConfig);
let id = toolConfig.flexlayoutNode.component; let id = toolConfig.flexlayoutNode.component;
if (this.tools.has(id)) { if (this.tools.has(id)) {
console.warn('SimulationToolsService.registerToolConfig() - tool with ID ' + id + ' already exists'); console.warn('SimulationToolsService.registerToolConfig() - tool with ID ' + id + ' already exists');
......
import mqtt from 'mqtt'; import mqtt from 'mqtt';
import { EventEmitter } from 'events';
import 'nrp-jsproto/nrp-jsproto';
let _instance = null; let _instance = null;
const SINGLETON_ENFORCER = Symbol(); const SINGLETON_ENFORCER = Symbol();
...@@ -6,11 +9,14 @@ const SINGLETON_ENFORCER = Symbol(); ...@@ -6,11 +9,14 @@ const SINGLETON_ENFORCER = Symbol();
/** /**
* Service handling state and info of running simulations. * Service handling state and info of running simulations.
*/ */
export default class MqttClientService { export default class MqttClientService extends EventEmitter {
constructor(enforcer) { constructor(enforcer) {
super();
if (enforcer !== SINGLETON_ENFORCER) { if (enforcer !== SINGLETON_ENFORCER) {
throw new Error('Use ' + this.constructor.name + '.instance'); throw new Error('Use ' + this.constructor.name + '.instance');
} }
//console.info(proto);
} }
static get instance() { static get instance() {
...@@ -30,12 +36,6 @@ export default class MqttClientService { ...@@ -30,12 +36,6 @@ export default class MqttClientService {
}); });
this.client.on('error', this.onError); this.client.on('error', this.onError);
this.client.on('message', this.onMessage); this.client.on('message', this.onMessage);
this.client.subscribe('#', (err) => {
if (err) {
console.error(err);
}
});
} }
onError(error) { onError(error) {
...@@ -43,9 +43,15 @@ export default class MqttClientService { ...@@ -43,9 +43,15 @@ export default class MqttClientService {
} }
onMessage(topic, payload, packet) { onMessage(topic, payload, packet) {
console.info('MQTT message'); console.info('MQTT message: [topic, payload, packet]');
console.info(topic); console.info([topic, payload, packet]);
console.info(payload);
console.info(packet); /*try {
let dump =
}*/
} }
} }
MqttClientService.EVENTS = Object.freeze({
CONNECTED: 'CONNECTED'
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment