Adds tests for action creators and reducers

This commit is contained in:
Patrick McDonagh
2018-04-12 18:33:35 -05:00
parent 6f7381c75d
commit 8d208906c8
31 changed files with 2458 additions and 121 deletions

View File

@@ -4,18 +4,26 @@ const { Controller, Tag } = require("ethernet-ip");
const _ = require("lodash");
const { app, BrowserWindow, ipcMain } = electron;
const tagList = require("./tagList.json");
// To avoid being garbage collected
let mainWindow;
let PLC;
const tagList = require("./tagList.json");
app.on("ready", () => {
mainWindow = new BrowserWindow({});
mainWindow = new BrowserWindow({
width: 1000,
height: 1000
});
mainWindow.loadURL(`file://${__dirname}/app/index.html`);
initPLC("10.20.4.36", tagList.scan_list);
// Wait for allowing react app to fully load
// before starting to send initalized data.
setTimeout(() => {
initPLC("10.20.4.36", tagList.scan_list);
}, 2000);
});
@@ -41,9 +49,11 @@ function initPLC(ipAddress, tagList){
const properties = { ...PLC.properties, ipAddress};
mainWindow.webContents.send("plc:connected", properties);
PLC.scan().catch((err) => {
mainWindow.webContents.send("plc:error", err.message);
console.log(err);
});
}).catch((err) => {
mainWindow.webContents.send("plc:error", err.message);
console.log(err);
});
@@ -62,6 +72,7 @@ function initPLC(ipAddress, tagList){
}
ipcMain.on("plc:initialize", (event, ipAddress, tagList) =>{
// console.log("plc:initialize", ipAddress, tagList);
initPLC(ipAddress, tagList);