don't lazy load when searching (#31100)
fixes: #31070 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
2dc37d2513
commit
932a92a316
1 changed files with 20 additions and 10 deletions
|
@ -147,6 +147,21 @@ type GroupTreeProps = {
|
|||
|
||||
const SUBGROUP_COUNT = 50;
|
||||
|
||||
const TreeLoading = () => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
<Spinner size="sm" /> {t("spinnerLoading")}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const LOADING_TREE = [
|
||||
{
|
||||
name: <TreeLoading />,
|
||||
},
|
||||
];
|
||||
|
||||
export const GroupTree = ({
|
||||
refresh: viewRefresh,
|
||||
canViewDetails,
|
||||
|
@ -183,6 +198,7 @@ export const GroupTree = ({
|
|||
group: GroupRepresentation,
|
||||
refresh: () => void,
|
||||
): ExtendedTreeViewDataItem => {
|
||||
const hasSubGroups = group.subGroupCount;
|
||||
return {
|
||||
id: group.id,
|
||||
name: (
|
||||
|
@ -191,16 +207,10 @@ export const GroupTree = ({
|
|||
</Tooltip>
|
||||
),
|
||||
access: group.access || {},
|
||||
children: group.subGroupCount
|
||||
? [
|
||||
{
|
||||
name: (
|
||||
<>
|
||||
<Spinner size="sm" /> {t("spinnerLoading")}
|
||||
</>
|
||||
),
|
||||
},
|
||||
]
|
||||
children: hasSubGroups
|
||||
? search.length === 0
|
||||
? LOADING_TREE
|
||||
: group.subGroups?.map((g) => mapGroup(g, refresh))
|
||||
: undefined,
|
||||
action: (hasAccess("manage-users") || group.access?.manage) && (
|
||||
<GroupTreeContextMenu group={group} refresh={refresh} />
|
||||
|
|
Loading…
Reference in a new issue