mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-24 17:51:14 +02:00
* fix: general select component typings * custom multi-select for projects * autocomplete element for token projects * project multi-select with error handling * projects in tokens list update * multi-project tokens - select all button * fix conflicting typescript changes * improve multi-projects tokens form after review * refactor multi-project select code structure * test api token list projects column element * simplify test renderer
47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import useFeatureTypes from 'hooks/api/getters/useFeatureTypes/useFeatureTypes';
|
|
import GeneralSelect, {
|
|
ISelectOption,
|
|
} from 'component/common/GeneralSelect/GeneralSelect';
|
|
|
|
const FeatureTypeSelect = ({
|
|
// @ts-expect-error
|
|
editable,
|
|
// @ts-expect-error
|
|
value,
|
|
// @ts-expect-error
|
|
id,
|
|
// @ts-expect-error
|
|
label,
|
|
// @ts-expect-error
|
|
onChange,
|
|
...rest
|
|
}) => {
|
|
const { featureTypes } = useFeatureTypes();
|
|
|
|
const options: ISelectOption[] = featureTypes.map(t => ({
|
|
key: t.id,
|
|
label: t.name,
|
|
title: t.description,
|
|
}));
|
|
|
|
if (!options.some(o => o.key === value)) {
|
|
options.push({ key: value, label: value });
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<GeneralSelect
|
|
disabled={!editable}
|
|
options={options}
|
|
value={value}
|
|
onChange={onChange}
|
|
label={label}
|
|
id={id}
|
|
{...rest}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default FeatureTypeSelect;
|