mirror of https://github.com/grafana/grafana.git
NestedFolderPicker: Only display provisioning icon on root folder (#110784)
NestedFolderPicker: only display provisioning icon on root folder
This commit is contained in:
parent
b462cfc7f7
commit
496e504b70
|
|
@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export interface FolderListItemDTO {
|
|||
uid: string;
|
||||
title: string;
|
||||
managedBy?: ManagerKind;
|
||||
parentUid?: string;
|
||||
}
|
||||
|
||||
export type FolderParent = Pick<FolderDTO, 'title' | 'uid' | 'url'>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue