2025-07-18 16:40:57 +08:00
|
|
|
import { t } from '@grafana/i18n';
|
2025-08-29 22:43:48 +08:00
|
|
|
import { ManagerKind } from 'app/features/apiserver/types';
|
|
|
|
import { DashboardsTreeItem } from 'app/features/browse-dashboards/types';
|
2025-07-18 16:40:57 +08:00
|
|
|
|
2025-08-29 22:43:48 +08:00
|
|
|
export const getRootFolderItem = (): DashboardsTreeItem => ({
|
2025-07-03 22:15:23 +08:00
|
|
|
isOpen: true,
|
|
|
|
level: 0,
|
|
|
|
item: {
|
|
|
|
kind: 'folder' as const,
|
2025-07-18 16:40:57 +08:00
|
|
|
title: t('browse-dashboards.folder-picker.root-title', 'Dashboards'),
|
2025-07-03 22:15:23 +08:00
|
|
|
uid: '',
|
|
|
|
},
|
2025-07-18 16:40:57 +08:00
|
|
|
});
|
2025-08-29 22:43:48 +08:00
|
|
|
|
|
|
|
export const getCustomRootFolderItem = ({
|
|
|
|
title,
|
|
|
|
managedBy,
|
|
|
|
uid,
|
|
|
|
}: {
|
2025-09-02 21:55:59 +08:00
|
|
|
title?: string;
|
2025-08-29 22:43:48 +08:00
|
|
|
managedBy?: ManagerKind;
|
|
|
|
uid?: string;
|
|
|
|
}): DashboardsTreeItem => ({
|
|
|
|
isOpen: true,
|
|
|
|
level: 0,
|
|
|
|
item: {
|
|
|
|
kind: 'folder' as const,
|
2025-09-02 21:55:59 +08:00
|
|
|
title: title || '',
|
2025-08-29 22:43:48 +08:00
|
|
|
uid: uid || '',
|
|
|
|
managedBy,
|
|
|
|
},
|
|
|
|
});
|