New status channel works.
parent
6d61aaf852
commit
2c9d645856
|
@ -51,7 +51,7 @@
|
|||
"css-loader": "2.1.0",
|
||||
"enzyme": "3.8.0",
|
||||
"enzyme-adapter-react-16": "1.7.1",
|
||||
"farmbot": "7.0.0-rc3",
|
||||
"farmbot": "7.0.0-rc5",
|
||||
"farmbot-toastr": "1.0.3",
|
||||
"fastclick": "1.0.6",
|
||||
"file-loader": "3.0.1",
|
||||
|
|
|
@ -178,7 +178,7 @@ const attachEventListeners =
|
|||
bot.on("sent", onSent(bot.client));
|
||||
bot.on("logs", onLogs(dispatch, getState));
|
||||
bot.on("legacy_status", onLegacyStatus(dispatch, getState));
|
||||
bot.on("status", onStatus(dispatch, getState));
|
||||
bot.on("status_v8", onStatus(dispatch, getState));
|
||||
bot.on("malformed", onMalformed);
|
||||
bot.client.on("message", autoSync(dispatch, getState));
|
||||
bot.client.on("reconnect", onReconnect);
|
||||
|
|
|
@ -2,7 +2,6 @@ import { generateReducer } from "../redux/generate_reducer";
|
|||
import { Actions } from "../constants";
|
||||
import { ConnectionState, EdgeStatus } from "./interfaces";
|
||||
import { computeBestTime } from "./reducer_support";
|
||||
import { padEnd } from "lodash";
|
||||
import { TaggedDevice } from "farmbot";
|
||||
import { SyncBodyContents } from "../sync/actions";
|
||||
import { arrayUnwrap } from "../resources/util";
|
||||
|
@ -13,19 +12,9 @@ export const DEFAULT_STATE: ConnectionState = {
|
|||
"user.api": undefined
|
||||
};
|
||||
|
||||
const debugState = { lastLog: "" };
|
||||
|
||||
export let connectivityReducer =
|
||||
generateReducer<ConnectionState>(DEFAULT_STATE)
|
||||
.add<EdgeStatus>(Actions.NETWORK_EDGE_CHANGE, (s, { payload }) => {
|
||||
const x = s[payload.name];
|
||||
const from = padEnd((x && x.state) || "unknown", 7);
|
||||
const to = padEnd(payload.status.state, 5);
|
||||
const log = `${from} ➡️ ${to} (${payload.why})`;
|
||||
if (debugState.lastLog !== log && payload.name == "bot.mqtt") {
|
||||
console.log(log);
|
||||
debugState.lastLog = log;
|
||||
}
|
||||
s[payload.name] = payload.status;
|
||||
return s;
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue