Merge branch 'master' into onewire_detect

This commit is contained in:
csawatzky 2025-11-03 10:51:29 -06:00
commit 6b0dd9ff41
9 changed files with 48 additions and 6 deletions

View file

@ -8,6 +8,8 @@ import { pond } from "protobuf-ts/pond";
import { useEffect, useState } from "react";
import { getSignatureAccentColour } from "services/whiteLabel";
import NotificationDrawer from "./NotificationDrawer";
import { useTeamAPI } from "providers";
import { cloneDeep } from "lodash";
const useStyles = makeStyles((theme: Theme) => ({
@ -55,7 +57,9 @@ export default function HeaderButtons(props: Props) {
const [hasNewNotifications, setHasNewNotifications] = useState(false);
const [chatDrawerOpen, setChatDrawerOpen] = useState(false);
const [notificationDrawerOpen, setNotificationDrawerOpen] = useState<boolean>(false);
const classes = useStyles();
const teamAPI = useTeamAPI();
useEffect(() => {
if (!team) return;
@ -66,6 +70,8 @@ export default function HeaderButtons(props: Props) {
setHasNewChats(true);
return;
}
console.log(team.preferences.chatViewedTimestamp)
console.log(team.settings.lastChatTimestamp)
let viewMoment = moment(team.preferences.chatViewedTimestamp);
let chatMoment = moment(team.settings.lastChatTimestamp);
if (viewMoment.diff(chatMoment) < 0) {
@ -154,13 +160,29 @@ export default function HeaderButtons(props: Props) {
)
}
const onChatClose = () => {
setChatDrawerOpen(false)
let newTeamPrefs = cloneDeep(team.preferences)
newTeamPrefs.chatViewedTimestamp = new Date().toISOString();
teamAPI
.updatePreferences(
team.key(),
newTeamPrefs,
// getContextKeys(),
// getContextTypes()
)
.then(() => {
// setTeamPrefs(newTeamPrefs);
});
}
return (
<>
{chatButton()}
{team && team.settings && team.settings.key && (
<ChatDrawer
open={chatDrawerOpen}
onClose={() => setChatDrawerOpen(false)}
onClose={onChatClose}
team={team}
/>
)}

View file

@ -75,7 +75,7 @@ export default function ChatMessage(props: Props) {
return mappedPerm; // Return null for invalid keys
}).filter(Boolean); // Optionally filter out any null values
} else {
console.error("data.permissions is not an array or does not exist");
// console.error("data.permissions is not an array or does not exist");
perms = [];
}
return perms

View file

@ -518,7 +518,8 @@ export default function ComponentSettings(props: Props) {
}
const supportsExpansion = () => {
return (formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE &&
return ((formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE ||
formComponent.settings.type === quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE) &&
formComponent.settings.addressType === quack.AddressType.ADDRESS_TYPE_I2C)
}

View file

@ -253,7 +253,9 @@ export default function DevicePage() {
let id: quack.IComponentID = quack.ComponentID.fromObject({
type: c.settings.type,
addressType: c.settings.addressType,
address: c.settings.address
address: c.settings.address,
expansionLine: c.settings.expansionLine,
muxLine: c.settings.muxLine
});
let filteredInteractions = interactions.filter(interaction => {
let isSource = false;

View file

@ -15,7 +15,9 @@ export function sameComponentID(
const sameType: boolean = id1.type === id2.type;
const sameAddressType: boolean = id1.addressType === id2.addressType;
const sameAddress: boolean = (!id1.address && !id2.address) || id1.address === id2.address;
return sameType && sameAddressType && sameAddress;
const sameExpansion: boolean = (!id1.expansionLine && !id2.expansionLine) || id1.expansionLine === id2.expansionLine;
const sameMux: boolean = (!id1.muxLine && !id2.muxLine) || id1.muxLine === id2.muxLine;
return sameType && sameAddressType && sameAddress && sameExpansion && sameMux;
}
export function getComponentIDString(component?: Component): string {

View file

@ -170,6 +170,7 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
let firstTime: Moment | undefined;
let lastTime: Moment | undefined;
let valMap: Map<number, number[]> = new Map<number, number[]>();
if(measurement.type === quack.MeasurementType.MEASUREMENT_TYPE_PPM){
measurement.values.forEach((vals, i) => {
let avgVals: Point[] = [];
let newLineData: LineData = {
@ -205,6 +206,14 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
valMap = new Map<number, number[]>();
}
});
} else {
chartData = simpleLineChartData(
quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE,
measurement,
smoothingAverages,
filters
);
}
} else {
chartData = simpleLineChartData(
quack.ComponentType.COMPONENT_TYPE_DRAGER_GAS_DONGLE,

View file

@ -63,6 +63,11 @@ const subtypes = [
key: quack.BooleanOutputSubtype.BOOLEAN_OUTPUT_SUBTYPE_EXHAUST_FAN,
value: "BOOLEAN_OUTPUT_SUBTYPE_FAN",
friendlyName: "Exhaust Fan"
} as Subtype,
{
key: quack.BooleanOutputSubtype.BOOLEAN_OUTPUT_SUBTYPE_ALARM,
value: "BOOLEAN_OUTPUT_SUBTYPE_ALARM",
friendlyName: "Alarm"
} as Subtype
];

View file

@ -176,6 +176,7 @@ export class MeasurementDescriber {
this.details.unit = "mV";
this.details.graph = GraphType.MULTILINE;
this.details.unit = "mV";
this.details.decimals = 0
// this.details.nodeDetails = {
// colours: ["white", "black", "red", "blue"],
// labels: ["millivolt1", "millivolt2", "millivolt3", "millivolt4"]