-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(zimbra): add loading to datagrids
ref: MANAGER-15389 Signed-off-by: Tristan WAGNER <[email protected]>
- Loading branch information
1 parent
f366c44
commit e998cf4
Showing
7 changed files
with
110 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 13 additions & 4 deletions
17
packages/manager/apps/zimbra/src/hooks/useOrganizationsList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { | ||
useQuery, | ||
UseQueryOptions, | ||
UseQueryResult, | ||
} from '@tanstack/react-query'; | ||
import { usePlatform } from '@/hooks'; | ||
import { | ||
getZimbraPlatformOrganization, | ||
getZimbraPlatformOrganizationQueryKey, | ||
OrganizationType, | ||
} from '@/api/organization'; | ||
|
||
export const useOrganizationList = (options = {}) => { | ||
export const useOrganizationList = ( | ||
options: Omit<UseQueryOptions, 'queryKey' | 'queryFn' | 'select'> = {}, | ||
) => { | ||
const { platformId } = usePlatform(); | ||
|
||
return useQuery({ | ||
...options, | ||
queryKey: getZimbraPlatformOrganizationQueryKey(platformId), | ||
queryFn: () => getZimbraPlatformOrganization(platformId), | ||
enabled: !!platformId, | ||
}); | ||
enabled: | ||
(typeof options.enabled !== 'undefined' ? options.enabled : true) && | ||
!!platformId, | ||
}) as UseQueryResult<OrganizationType[]>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters