changed type name to select item

Signed-off-by: lukzerom <lukzerom@gmail.com>
This commit is contained in:
lukzerom
2021-12-14 17:49:16 +01:00
parent 45ddfa099b
commit faaa7f009c
3 changed files with 11 additions and 6 deletions
@@ -102,7 +102,7 @@ const useStyles = makeStyles(
{ name: 'BackstageSelect' },
);
export type Item = {
export type SelectItem = {
label: string;
value: string | number;
};
@@ -111,7 +111,7 @@ export type Selection = string | string[] | number | number[];
export type SelectProps = {
multiple?: boolean;
items: Item[];
items: SelectItem[];
label: string;
placeholder?: string;
selected?: Selection;
@@ -16,10 +16,10 @@
export { SelectComponent as Select } from './Select';
export type {
Item,
SelectClassKey,
SelectInputBaseClassKey,
Selection,
SelectItem,
} from './Select';
export type { ClosedDropdownClassKey } from './static/ClosedDropdown';
export type { OpenedDropdownClassKey } from './static/OpenedDropdown';
@@ -13,7 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Item, Progress, Select, Selection } from '@backstage/core-components';
import {
Progress,
Select,
Selection,
SelectItem,
} from '@backstage/core-components';
import { useApi } from '@backstage/core-plugin-api';
import { scmIntegrationsApiRef } from '@backstage/integration-react';
import FormControl from '@material-ui/core/FormControl';
@@ -237,13 +242,13 @@ export const RepoUrlPicker = ({
return <Progress />;
}
const hostsOptions: Item[] = integrations
const hostsOptions: SelectItem[] = integrations
? integrations
.filter(i => allowedHosts?.includes(i.host))
.map(i => ({ label: i.title, value: i.host }))
: [{ label: 'Loading...', value: 'loading' }];
const ownersOptions: Item[] = allowedOwners
const ownersOptions: SelectItem[] = allowedOwners
? allowedOwners.map(i => ({ label: i, value: i }))
: [{ label: 'Loading...', value: 'loading' }];