CB-2783 show description when only one possible project (#1356)

This commit is contained in:
alex
2022-12-13 22:05:04 +03:00
committed by GitHub
parent 23d028ccb9
commit 034a343fd7
7 changed files with 20 additions and 3 deletions
@@ -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 (
<Combobox
name='projectId'
@@ -78,6 +82,7 @@ export const ProjectSelect = observer(function ProjectSelect({
disabled={disabled}
loading={projectsLoader.isLoading()}
inline={inline}
description={description}
tiny
fill
onSelect={handleProjectSelect}