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