NestedFolderPicker: Only display provisioning icon on root folder (#110784)

NestedFolderPicker: only display provisioning icon on root folder
This commit is contained in:
Yunwen Zheng
2025-09-09 09:34:19 -04:00
committed by GitHub
parent b462cfc7f7
commit 496e504b70
5 changed files with 8 additions and 2 deletions
@@ -1,3 +1,5 @@
import { memo } from 'react';
import { t } from '@grafana/i18n';
import { Badge, Stack } from '@grafana/ui';
import { ManagerKind } from 'app/features/apiserver/types';
@@ -11,7 +13,7 @@ export interface Props {
folder?: FolderDTO | DashboardViewItem;
}
export function FolderRepo({ folder }: Props) {
export const FolderRepo = memo(function FolderRepo({ folder }: Props) {
// skip rendering if:
// folder is not present
// folder have parentUID
@@ -47,7 +49,7 @@ export function FolderRepo({ folder }: Props) {
/>
</Stack>
);
}
});
function getShouldSkipRender(folder: FolderDTO | DashboardViewItem | undefined, isProvisionedInstance?: boolean) {
// Skip render if parentUID is present, then we should skip rendering. we only display icon for root folders
@@ -233,6 +233,7 @@ export function NestedFolderPicker({
kind: 'folder' as const,
title: item.title,
uid: item.uid,
parentUID: item.parentUID,
},
})) ?? [];
}
@@ -139,6 +139,7 @@ export function useFoldersQueryAppPlatform({
uid: name,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
managedBy: item.metadata?.annotations?.[AnnoKeyManagerKind] as ManagerKind | undefined,
parentUID: item.parentUID,
},
};
@@ -160,6 +160,7 @@ export function useFoldersQueryLegacy({
title: item.title,
uid: item.uid,
managedBy: item.managedBy,
parentUID: item.parentUid,
},
};
+1
View File
@@ -6,6 +6,7 @@ export interface FolderListItemDTO {
uid: string;
title: string;
managedBy?: ManagerKind;
parentUid?: string;
}
export type FolderParent = Pick<FolderDTO, 'title' | 'uid' | 'url'>;