diff --git a/webapp/packages/core-blocks/src/FormControls/Combobox.tsx b/webapp/packages/core-blocks/src/FormControls/Combobox.tsx index a71710b364..6aecf71585 100644 --- a/webapp/packages/core-blocks/src/FormControls/Combobox.tsx +++ b/webapp/packages/core-blocks/src/FormControls/Combobox.tsx @@ -142,6 +142,7 @@ type BaseProps = Omit, searchable?: boolean; defaultValue?: TKey; loading?: boolean; + description?: string; keySelector?: (item: TValue, index: number) => TKey; valueSelector?: (item: TValue) => string; titleSelector?: (item: TValue) => string | undefined; @@ -187,6 +188,7 @@ export const Combobox: ComboboxType = observer(function Combobox({ readOnly, disabled, inline, + description, keySelector = v => v, valueSelector = v => v, iconSelector, @@ -421,6 +423,11 @@ export const Combobox: ComboboxType = observer(function Combobox({ }))} + {description && ( + + {description} + + )} ); }); diff --git a/webapp/packages/plugin-projects/src/ProjectSelect.tsx b/webapp/packages/plugin-projects/src/ProjectSelect.tsx index 959dbb2cc0..c7f3c036b6 100644 --- a/webapp/packages/plugin-projects/src/ProjectSelect.tsx +++ b/webapp/packages/plugin-projects/src/ProjectSelect.tsx @@ -14,12 +14,13 @@ import { CachedMapAllKey } from '@cloudbeaver/core-sdk'; interface Props { value: string | null; - filter?: (project: ProjectInfo) => boolean; - onChange: (value: string) => void; autoHide?: boolean; readOnly?: boolean; disabled?: boolean; inline?: boolean; + onChange: (value: string) => void; + filter?: (project: ProjectInfo) => boolean; + descriptionGetter?: (projects: ProjectInfo[], possibleOptions: string[]) => string | undefined; } export const ProjectSelect = observer(function ProjectSelect({ @@ -30,6 +31,7 @@ export const ProjectSelect = observer(function ProjectSelect({ disabled, inline, onChange, + descriptionGetter, }: Props) { const translate = useTranslate(); @@ -64,6 +66,8 @@ export const ProjectSelect = observer(function ProjectSelect({ return null; } + const description = descriptionGetter?.(projects, possibleOptions); + return ( (p.canEditResources && p.id === (payload.projectId ?? p.id))} + descriptionGetter={(_, options) => options.length <= 1 ? translate('plugin_resource_manager_save_script_project_restriction_descripion') : undefined} autoHide - onChange={projectId => {state.projectId = projectId;}} + onChange={projectId => { state.projectId = projectId; }} /> diff --git a/webapp/packages/plugin-resource-manager/src/locales/en.ts b/webapp/packages/plugin-resource-manager/src/locales/en.ts index 117b264a9d..7404351fcc 100644 --- a/webapp/packages/plugin-resource-manager/src/locales/en.ts +++ b/webapp/packages/plugin-resource-manager/src/locales/en.ts @@ -19,4 +19,5 @@ export default [ ['plugin_resource_manager_script_delete_confirmation', 'You are going to delete "{arg:name}". Are you sure?'], ['plugin_resource_manager_script_not_found_message', 'The script was probably removed or renamed. The last known value will be used'], ['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()@" and can\'t start with a dot'], + ['plugin_resource_manager_save_script_project_restriction_descripion', "The script's project can't be different from the connection's project"], ]; \ No newline at end of file diff --git a/webapp/packages/plugin-resource-manager/src/locales/it.ts b/webapp/packages/plugin-resource-manager/src/locales/it.ts index 117b264a9d..7404351fcc 100644 --- a/webapp/packages/plugin-resource-manager/src/locales/it.ts +++ b/webapp/packages/plugin-resource-manager/src/locales/it.ts @@ -19,4 +19,5 @@ export default [ ['plugin_resource_manager_script_delete_confirmation', 'You are going to delete "{arg:name}". Are you sure?'], ['plugin_resource_manager_script_not_found_message', 'The script was probably removed or renamed. The last known value will be used'], ['plugin_resource_manager_script_name_invalid_characters_message', 'Script\'s name may contain the following symbols "_-$.()@" and can\'t start with a dot'], + ['plugin_resource_manager_save_script_project_restriction_descripion', "The script's project can't be different from the connection's project"], ]; \ No newline at end of file diff --git a/webapp/packages/plugin-resource-manager/src/locales/ru.ts b/webapp/packages/plugin-resource-manager/src/locales/ru.ts index adde81fb51..10b5f45462 100644 --- a/webapp/packages/plugin-resource-manager/src/locales/ru.ts +++ b/webapp/packages/plugin-resource-manager/src/locales/ru.ts @@ -19,4 +19,5 @@ export default [ ['plugin_resource_manager_script_delete_confirmation', 'Вы удаляете "{arg:name}". Удалить?'], ['plugin_resource_manager_script_not_found_message', 'Возможно скрипт был удален или переименован. Будет использовано последнее известное значение'], ['plugin_resource_manager_script_name_invalid_characters_message', 'Имя скрипта может содержать следующие символы "_-$.()@" и не может начинаться с точки'], + ['plugin_resource_manager_save_script_project_restriction_descripion', 'Проект скрипта не может отличаться от проекта подключения'], ]; \ No newline at end of file diff --git a/webapp/packages/plugin-resource-manager/src/locales/zh.ts b/webapp/packages/plugin-resource-manager/src/locales/zh.ts index 981059f1d7..8bb79fee31 100644 --- a/webapp/packages/plugin-resource-manager/src/locales/zh.ts +++ b/webapp/packages/plugin-resource-manager/src/locales/zh.ts @@ -19,4 +19,5 @@ export default [ ['plugin_resource_manager_script_delete_confirmation', '你确定要删除"{arg:name}"吗?'], ['plugin_resource_manager_script_not_found_message', '脚本可能被删除或重命名,将使用最后的有效值'], ['plugin_resource_manager_script_name_invalid_characters_message', '脚本名称中可以使用字符"_-$.()@" 但不能以"."开头'], + ['plugin_resource_manager_save_script_project_restriction_descripion', "The script's project can't be different from the connection's project"], ];