fix ws send; attempt to fix missing contractsState in ws

This commit is contained in:
Iuri Matias 2018-03-12 16:46:56 -04:00
parent de01a5f9a3
commit f452357c29
2 changed files with 9 additions and 4 deletions

View File

@ -50,24 +50,28 @@ class Server {
});
});
app.ws('/dashboard', function(ws, req) {
app.ws('/embark/dashboard', function(ws, req) {
let dashboardState = { contractsState: [], environment: "", status: "", availableServices: [] };
// TODO: doesn't feel quite right, should be refactored into a shared
// dashboard state
self.events.request('setDashboardState');
self.events.on('contractsState', (contracts) => {
dashboardState.contractsState = [];
contracts.forEach(function (row) {
dashboardState.contractsState.push({contractName: row[0], address: row[1], status: row[2]});
});
ws.send(dashboardState);
ws.send(JSON.stringify(dashboardState));
});
self.events.on('status', (status) => {
dashboardState.status = status;
ws.send(dashboardState);
ws.send(JSON.stringify(dashboardState));
});
self.events.on('servicesState', (servicesState) => {
dashboardState.availableServices = servicesState;
ws.send(dashboardState);
ws.send(JSON.stringify(dashboardState));
});
});

View File

@ -1,5 +1,6 @@
pragma solidity ^0.4.17;
contract AnotherStorage {
address public simpleStorageAddress;
address simpleStorageAddress2;