fixed issue with adding devices to group

This commit is contained in:
Carter 2025-04-29 10:45:24 -06:00
parent 765ac72431
commit 539dd667c7
3 changed files with 13 additions and 24 deletions

View file

@ -278,7 +278,6 @@ export default function SmartBreadcrumb(props: Props) {
const breadcrumbLinks = (): ReactNode[] => {
const breadcrumbMap = getBreadcrumbMap();
//console.log(breadcrumbMap)
let links: ReactNode[] = [];
let pathnames = location.pathname.split("/").filter((x: any) => x);
@ -288,24 +287,15 @@ export default function SmartBreadcrumb(props: Props) {
return [linkComponent("/", "Dashboard", true)];
}
// if (prependPaths) pathnames.unshift(...prependPaths)
// if (prependPaths) pathnames.push(...prependPaths)
if (prependPaths) pathnames.splice(pathnames.length - 1, 0, ...prependPaths);
//console.log(pathnames)
pathnames.forEach((_value: any, index: any) => {
const lastPath = index === pathnames.length - 1;
//console.log(lastPath)
const to = `/${pathnames.slice(0, index + 1).join("/")}`;
//console.log("to: " + to)
let label = breadcrumbMap[to];
//console.log("label: "+label)
let result = to.split("/").filter(str => str !== "");
//console.log("result: " + result.toString())
if (!label) {
//console.log("no label")
if (result.length > 1) {
if (result[result.length - 1] !== "components") {
label = breadcrumbMap["/" + result[result.length - 1]];
@ -317,12 +307,10 @@ export default function SmartBreadcrumb(props: Props) {
}
if (!blacklist.includes(to) && label) {
//console.log("push link")
links.push(linkComponent(to, label, lastPath));
}
});
//console.log(links)
return links;
};

View file

@ -151,7 +151,6 @@ export default function GroupSettings(props: Props) {
.then((response: any) => {
success(groupName + " was successfully created");
close();
console.log(response)
group.settings.groupId = parseInt(response.data.id)
if (addGroupCallback) addGroupCallback(group.settings)
else refreshCallback();
@ -232,9 +231,11 @@ export default function GroupSettings(props: Props) {
};
const changeDevices = (device: number) => {
console.log("change")
let updatedGroup = Group.clone(group);
const exists = updatedGroup.settings.devices.includes(device);
if (exists) {
console.log("exists")
updatedGroup.settings.devices = updatedGroup.settings.devices.filter(
groupDevice => groupDevice !== device
);
@ -328,7 +329,7 @@ export default function GroupSettings(props: Props) {
<Checkbox
edge="end"
onChange={() => changeDevices(device.id())}
checked={groupDeviceNumbers.includes(device.id())}
checked={group.settings.devices.includes(device.id())}
inputProps={{ "aria-labelledby": label }}
disabled={!canEdit}
/>

View file

@ -77,16 +77,16 @@ export default function GroupsPage() {
const columns = (): Column<pond.Group>[] => {
return [
{
title: "Size",
render: (group) => {
return (
<Box className={classes.smallCellContainer}>
{group.settings?.devices?.length ? group.settings.devices.length : 0}
</Box>
)
}
},
// {
// title: "Size",
// render: (group) => {
// return (
// <Box className={classes.smallCellContainer}>
// {group.settings?.devices?.length ? group.settings.devices.length : 0}
// </Box>
// )
// }
// },
{
title: "Group Name",
render: (group) => {