Files
grafana/public/app/features/alerting/unified/components/rule-editor/RuleFolderPicker.tsx

30 lines
739 B
TypeScript
Raw Normal View History

import React from 'react';
import { FolderPicker, Props as FolderPickerProps } from 'app/core/components/Select/FolderPicker';
import { PermissionLevelString } from 'app/types';
2021-04-14 15:57:36 +03:00
export interface Folder {
title: string;
id: number;
}
export interface RuleFolderPickerProps extends Omit<FolderPickerProps, 'initialTitle' | 'initialFolderId'> {
2021-04-14 15:57:36 +03:00
value?: Folder;
}
export function RuleFolderPicker(props: RuleFolderPickerProps) {
const { value } = props;
return (
<FolderPicker
showRoot={false}
allowEmpty={true}
initialTitle={value?.title}
initialFolderId={value?.id}
accessControlMetadata
{...props}
permissionLevel={PermissionLevelString.View}
customAdd={true}
/>
);
}