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 SUBGROUP_COUNT = 50;
|
||||||
|
|
||||||
|
const TreeLoading = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Spinner size="sm" /> {t("spinnerLoading")}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const LOADING_TREE = [
|
||||||
|
{
|
||||||
|
name: <TreeLoading />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export const GroupTree = ({
|
export const GroupTree = ({
|
||||||
refresh: viewRefresh,
|
refresh: viewRefresh,
|
||||||
canViewDetails,
|
canViewDetails,
|
||||||
|
@ -183,6 +198,7 @@ export const GroupTree = ({
|
||||||
group: GroupRepresentation,
|
group: GroupRepresentation,
|
||||||
refresh: () => void,
|
refresh: () => void,
|
||||||
): ExtendedTreeViewDataItem => {
|
): ExtendedTreeViewDataItem => {
|
||||||
|
const hasSubGroups = group.subGroupCount;
|
||||||
return {
|
return {
|
||||||
id: group.id,
|
id: group.id,
|
||||||
name: (
|
name: (
|
||||||
|
@ -191,16 +207,10 @@ export const GroupTree = ({
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
),
|
),
|
||||||
access: group.access || {},
|
access: group.access || {},
|
||||||
children: group.subGroupCount
|
children: hasSubGroups
|
||||||
? [
|
? search.length === 0
|
||||||
{
|
? LOADING_TREE
|
||||||
name: (
|
: group.subGroups?.map((g) => mapGroup(g, refresh))
|
||||||
<>
|
|
||||||
<Spinner size="sm" /> {t("spinnerLoading")}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: undefined,
|
: undefined,
|
||||||
action: (hasAccess("manage-users") || group.access?.manage) && (
|
action: (hasAccess("manage-users") || group.access?.manage) && (
|
||||||
<GroupTreeContextMenu group={group} refresh={refresh} />
|
<GroupTreeContextMenu group={group} refresh={refresh} />
|
||||||
|
|
Loading…
Reference in a new issue