Merge branch 'dev_environment' of gitlab.com:brandx/bxt-app into dev_environment

This commit is contained in:
csawatzky 2025-04-28 10:48:18 -06:00
commit ef4a09856e
8 changed files with 54 additions and 36 deletions

View file

@ -141,7 +141,6 @@ export default function Devices() {
};
const removeGroupCallback = useCallback(() => {
console.log("Remove callback");
let newGroups = [...groups];
newGroups.splice(parseInt(tab), 1);
setGroups(newGroups);
@ -149,6 +148,16 @@ export default function Devices() {
setGroupSettingsIsOpen(false);
}, [groups, tab]); // Include dependencies
const addGroupCallback = useCallback((groupSettings: pond.GroupSettings) => {
let newGroups = [...groups];
let group = pond.Group.create({
settings: groupSettings
})
newGroups.push(Group.create(group))
setGroups(newGroups);
// setTab(groups.length.toString())
}, [groups, tab]); // Include dependencies
const openGroupSettings = (
group: Group | undefined,
mode: "add" | "update" | "remove" | undefined
@ -162,7 +171,6 @@ export default function Devices() {
setGroupSettingsIsOpen(false);
setGroupSettingsMode(undefined);
setSelectedGroup(undefined);
console.log("close callback")
};
const getKeys = () => {
@ -197,7 +205,9 @@ export default function Devices() {
orderGroup,
orderGroupBy,
searchGroup,
undefined
undefined,
getKeys(),
getTypes(),
).then(resp => {
let newGroups: Group[] = []
resp.data.groups?.forEach((group: pond.Group) => {
@ -210,7 +220,6 @@ export default function Devices() {
}
const loadDevices = () => {
console.log("load callback")
setDevicesLoading(true)
deviceAPI.list(
limit,
@ -492,22 +501,24 @@ export default function Devices() {
onRowClick={toDevice}
setSearchText={setSearch}
isLoading={devicesLoading}
actions={getGroup() && <GroupActions group={getGroup()} permissions={groupPermissions} devices={devices} refreshCallback={loadDevices}/>}
actions={getGroup() && <GroupActions removeCallback={removeGroupCallback} group={getGroup()} permissions={groupPermissions} devices={devices} refreshCallback={loadDevices}/>}
/>
<ProvisionDevice
isOpen={isProvisionDialogOpen}
refreshCallback={loadDevices}
closeDialogCallback={closeProvisionDialog}
/>
{/* This GroupSettings is used for adding */}
<GroupSettings
initialGroup={selectedGroup}
mode={groupSettingsMode}
isDialogOpen={groupSettingsIsOpen}
closeDialogCallback={closeGroupSettings}
refreshCallback={loadDevices}
refreshCallback={() => {}}
canEdit={true}
groupDevices={devices}
removeGroupCallback={removeGroupCallback}
addGroupCallback={addGroupCallback}
/>
</PageContainer>
)