remove callback works now haha lol
This commit is contained in:
parent
ecc2f4d851
commit
988ab1c683
3 changed files with 5 additions and 13 deletions
|
|
@ -47,11 +47,12 @@ interface Props {
|
||||||
devices: Device[];
|
devices: Device[];
|
||||||
permissions: pond.Permission[];
|
permissions: pond.Permission[];
|
||||||
refreshCallback: () => void;
|
refreshCallback: () => void;
|
||||||
|
removeCallback?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function GroupActions(props: Props) {
|
export default function GroupActions(props: Props) {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { group, permissions, refreshCallback, devices } = props;
|
const { group, permissions, refreshCallback, devices, removeCallback } = props;
|
||||||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
||||||
const [groupSettingsOpen, setGroupSettingsOpen] = useState(false);
|
const [groupSettingsOpen, setGroupSettingsOpen] = useState(false);
|
||||||
const [shareOpen, setShareOpen] = useState(false);
|
const [shareOpen, setShareOpen] = useState(false);
|
||||||
|
|
@ -142,6 +143,7 @@ export default function GroupActions(props: Props) {
|
||||||
isDialogOpen={groupSettingsOpen}
|
isDialogOpen={groupSettingsOpen}
|
||||||
refreshCallback={refreshCallback}
|
refreshCallback={refreshCallback}
|
||||||
closeDialogCallback={() => setGroupSettingsOpen(false)}
|
closeDialogCallback={() => setGroupSettingsOpen(false)}
|
||||||
|
removeGroupCallback={removeCallback}
|
||||||
groupDevices={devices}
|
groupDevices={devices}
|
||||||
/>
|
/>
|
||||||
<ShareObject
|
<ShareObject
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ export default function GroupSettings(props: Props) {
|
||||||
// Update ref when prop changes
|
// Update ref when prop changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("Updating removeCallbackRef with:", removeGroupCallback);
|
console.log("Updating removeCallbackRef with:", removeGroupCallback);
|
||||||
removeCallbackRef.current = removeGroupCallback;
|
if (removeGroupCallback) removeCallbackRef.current = removeGroupCallback;
|
||||||
}, [removeGroupCallback]);
|
}, [removeGroupCallback]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -492,23 +492,13 @@ export default function Devices() {
|
||||||
onRowClick={toDevice}
|
onRowClick={toDevice}
|
||||||
setSearchText={setSearch}
|
setSearchText={setSearch}
|
||||||
isLoading={devicesLoading}
|
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
|
<ProvisionDevice
|
||||||
isOpen={isProvisionDialogOpen}
|
isOpen={isProvisionDialogOpen}
|
||||||
refreshCallback={loadDevices}
|
refreshCallback={loadDevices}
|
||||||
closeDialogCallback={closeProvisionDialog}
|
closeDialogCallback={closeProvisionDialog}
|
||||||
/>
|
/>
|
||||||
<GroupSettings
|
|
||||||
initialGroup={selectedGroup}
|
|
||||||
mode={groupSettingsMode}
|
|
||||||
isDialogOpen={groupSettingsIsOpen}
|
|
||||||
closeDialogCallback={closeGroupSettings}
|
|
||||||
refreshCallback={loadDevices}
|
|
||||||
canEdit={true}
|
|
||||||
groupDevices={devices}
|
|
||||||
removeGroupCallback={removeGroupCallback}
|
|
||||||
/>
|
|
||||||
</PageContainer>
|
</PageContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue