mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 09:13:40 +08:00
28 lines
719 B
TypeScript
28 lines
719 B
TypeScript
import React, { FC } from 'react';
|
|
|
|
import { FolderPicker, Props as FolderPickerProps } from 'app/core/components/Select/FolderPicker';
|
|
import { PermissionLevelString } from 'app/types';
|
|
|
|
export interface Folder {
|
|
title: string;
|
|
id: number;
|
|
}
|
|
|
|
export interface RuleFolderPickerProps extends Omit<FolderPickerProps, 'initialTitle' | 'initialFolderId'> {
|
|
value?: Folder;
|
|
}
|
|
|
|
export const RuleFolderPicker: FC<RuleFolderPickerProps> = ({ value, ...props }) => {
|
|
return (
|
|
<FolderPicker
|
|
showRoot={false}
|
|
allowEmpty={true}
|
|
initialTitle={value?.title}
|
|
initialFolderId={value?.id}
|
|
accessControlMetadata
|
|
{...props}
|
|
permissionLevel={PermissionLevelString.View}
|
|
/>
|
|
);
|
|
};
|