diff --git a/package-lock.json b/package-lock.json
index e347c77..38ab3e8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -42,7 +42,7 @@
"mui-tel-input": "^7.0.0",
"notistack": "^3.0.1",
"openweathermap-ts": "^1.2.10",
- "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
+ "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#object_status",
"query-string": "^9.2.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
diff --git a/package.json b/package.json
index fc7a1ac..3cf9d54 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
"mui-tel-input": "^7.0.0",
"notistack": "^3.0.1",
"openweathermap-ts": "^1.2.10",
- "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
+ "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#object_status",
"query-string": "^9.2.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
diff --git a/src/gate/GateList.tsx b/src/gate/GateList.tsx
index 5c548e2..bdf58c2 100644
--- a/src/gate/GateList.tsx
+++ b/src/gate/GateList.tsx
@@ -11,8 +11,10 @@ import ResponsiveTable, { Column } from "common/ResponsiveTable";
import AddGateFab from "./AddGateFab";
import GateSettings from "./GateSettings";
import { useGateAPI, useGlobalState } from "providers";
-import { Settings } from "@mui/icons-material";
+import { CheckCircleOutline, DoNotDisturb, ErrorOutline, RemoveCircleOutline, Settings } from "@mui/icons-material";
import { cloneDeep } from "lodash";
+import moment from "moment";
+import { pond } from "protobuf-ts/pond";
interface Props {
//gates: Gate[];
@@ -89,6 +91,19 @@ export default function GateList(props: Props) {
setPageSize(event.target.value);
};
+ const displayPCAStatus = (state: pond.PCAState) => {
+ switch(state){
+ case pond.PCAState.PCA_STATE_IN_BOUNDS:
+ return
+ case pond.PCAState.PCA_STATE_OUT_BOUNDS:
+ return
+ case pond.PCAState.PCA_STATE_OFF:
+ return
+ default:
+ return
+ }
+ }
+
const desktopCols = (): Column[] => {
return [
{
@@ -151,6 +166,29 @@ export default function GateList(props: Props) {
)
},
+ {
+ title: "PCA Status",
+ render: gate => (
+
+ {displayPCAStatus(gate.status.pcaState)}
+
+ )
+ },
+ {
+ title: "Last FLow",
+ render: gate => (
+
+
+ Last Flow:
+ {gate.status.lastMassAirflow.toFixed(2)}
+
+
+ Last Reading:
+ {gate.status.lastUpdate !== "" ? moment(gate.status.lastUpdate).fromNow() : "No Reading Yet"}
+
+
+ )
+ }
]
}
const mobileCols = (): Column[] => {
@@ -162,13 +200,16 @@ export default function GateList(props: Props) {
{gate.name}
- {
- event.stopPropagation()
- setSelectedGate(gate)
- setGateDialog(true)
- }}>
-
-
+
+ {displayPCAStatus(gate.status.pcaState)}
+ {
+ event.stopPropagation()
+ setSelectedGate(gate)
+ setGateDialog(true)
+ }}>
+
+
+
)
}
@@ -198,6 +239,14 @@ export default function GateList(props: Props) {
PCA Unit:
{gate.settings.pcaType !== "" ? gate.settings.pcaType : "None"}
+
+ Last Flow:
+ {gate.status.lastMassAirflow}
+
+
+ Last Reading:
+ {gate.status.lastUpdate !== "" ? moment(gate.status.lastUpdate).fromNow() : "No PCA reading yet"}
+
//
diff --git a/src/models/Device.ts b/src/models/Device.ts
index f4ea4ee..7b25c13 100644
--- a/src/models/Device.ts
+++ b/src/models/Device.ts
@@ -176,12 +176,23 @@ export class Device {
case pond.DevicePlatform.DEVICE_PLATFORM_V2_WIFI_BLUE:
case pond.DevicePlatform.DEVICE_PLATFORM_V2_CELLULAR_BLUE:
case pond.DevicePlatform.DEVICE_PLATFORM_V2_ETHERNET_BLUE:
- max = this.status.firmwareVersion >= "2.1.9" ? 4 : 2;
+ max = this.versionComparison(this.status.firmwareVersion, "2.1.9") ? 4 : 2;
}
return max
}
private versionComparison(deviceVersion: string, requiredVersion: string): boolean {
+ // Feature explicitly not supported on this platform
+ if (!requiredVersion || requiredVersion === "N/A") {
+ return false;
+ }
+
+ // Device firmware missing / unset
+ if (!deviceVersion || deviceVersion.trim() === "") {
+ return false;
+ }
+
+ //compare the versions
const parse = (v: string) => {
const [core, pre] = v.split("-");
const parts = core.split(".").map(n => parseInt(n, 10));
diff --git a/src/models/Gate.ts b/src/models/Gate.ts
index 8842e68..ccd0e77 100644
--- a/src/models/Gate.ts
+++ b/src/models/Gate.ts
@@ -5,22 +5,24 @@ import { or } from "utils/types";
export class Gate {
public settings: pond.GateSettings = pond.GateSettings.create();
+ public status: pond.GateStatus = pond.GateStatus.create();
public name: string = "Gate";
public key: string = "";
public preferences: any = {};
public gateMutations: any = {};
- public pcaState: pond.PCAState = pond.PCAState.PCA_STATE_UNKNOWN;
+ // public pcaState: pond.PCAState = pond.PCAState.PCA_STATE_UNKNOWN;
public static create(pb?: pond.Gate): Gate {
let my = new Gate();
if (pb) {
let g = pond.Gate.fromObject(pb);
my.settings = pond.GateSettings.fromObject(cloneDeep(or(g.settings, {})));
+ my.status = pond.GateStatus.fromObject(cloneDeep(or(g.status, {})));
my.name = g.name;
my.key = g.key;
my.preferences = g.componentPreferences;
my.gateMutations = g.gateMutations;
- my.pcaState = g.pcaState;
+ // my.pcaState = g.pcaState;
}
return my;
}
@@ -77,7 +79,7 @@ export class Gate {
}
public gateMarkerColour(): string {
- switch (this.pcaState) {
+ switch (this.status.pcaState) {
case pond.PCAState.PCA_STATE_OFF:
return "grey";
case pond.PCAState.PCA_STATE_IN_BOUNDS:
diff --git a/src/objects/objectInteractions/NewObjectInteraction.tsx b/src/objects/objectInteractions/NewObjectInteraction.tsx
index 8e76c25..64a63b0 100644
--- a/src/objects/objectInteractions/NewObjectInteraction.tsx
+++ b/src/objects/objectInteractions/NewObjectInteraction.tsx
@@ -179,7 +179,6 @@ export default function NewObjectInteraction(props: Props){
setNewAlertComponentType(quack.ComponentType.COMPONENT_TYPE_INVALID);
setConditions([]);
setSelectedAlertComponents([]);
- setValidOptions([])
setValidComponents([])
setValStrings(["0", "0"]);
setNumConditions(0)
diff --git a/src/pages/Device.tsx b/src/pages/Device.tsx
index d96a05c..0a47a05 100644
--- a/src/pages/Device.tsx
+++ b/src/pages/Device.tsx
@@ -128,9 +128,8 @@ export default function DevicePage() {
interaction.settings.nodeOne > interaction.settings.nodeTwo &&
interaction.settings.nodeTwo !== 0
) {
- //flip operator and send negative comparitor to save
+ //flip operator to display what is actually happening
interaction.settings.conditions.forEach(condition => {
- //coming back from the backend as a string for some reason
if (condition.comparison === quack.RelationalOperator.RELATIONAL_OPERATOR_GREATER_THAN) {
condition.comparison = quack.RelationalOperator.RELATIONAL_OPERATOR_LESS_THAN;
} else {
diff --git a/src/pages/Terminals.tsx b/src/pages/Terminals.tsx
index dd90aac..94464d5 100644
--- a/src/pages/Terminals.tsx
+++ b/src/pages/Terminals.tsx
@@ -182,7 +182,6 @@ export default function Terminals(props: Props) {
if(loading) return
setLoading(true)
terminalAPI.listTerminals(200, 0, "asc", "name", undefined, as).then(resp => {
- console.log(resp.data)
if(resp.data.terminals){
setTerminals(resp.data.terminals.map(a => Terminal.any(a)));
}
diff --git a/src/providers/pond/gateAPI.tsx b/src/providers/pond/gateAPI.tsx
index 5b07606..ac63bb0 100644
--- a/src/providers/pond/gateAPI.tsx
+++ b/src/providers/pond/gateAPI.tsx
@@ -138,6 +138,7 @@ export default function GateProvider(props: PropsWithChildren) {
return new Promise>((resolve, reject) => {
get(url).then(resp => {
resp.data = pond.ListGatesResponse.fromObject(resp.data)
+ console.log(resp)
return resolve(resp)
}).catch(err => {
return reject(err)