* Add source * Update filters * Exclude all namespace endpoints * Remove watch endpoints * Exclude collection endpoint * Update arg names * Add parser script * Update spec * Update @rtk-query/codegen-openapi * Update params for list endpoints * Use new hooks and types in hooks * alternative operation ID * alternative operation ID * alt operation * alt operation * Move some transformations to BE * Update endpoints * Update types after generation * Remove spec and generated endpoints * Add tags automatically * Update pkg/services/apiserver/builder/helper.go Co-authored-by: Ryan McKinley <ryantxu@gmail.com> * add static openapi * Use generated spec --------- Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
26 lines
650 B
TypeScript
26 lines
650 B
TypeScript
import { Combobox, Spinner } from '@grafana/ui';
|
|
import { ComboboxBaseProps } from '@grafana/ui/src/components/Combobox/Combobox';
|
|
|
|
import { useListRepositoryQuery } from './api';
|
|
|
|
export function RepositorySelect(props: Pick<ComboboxBaseProps<string>, 'value' | 'onChange'>) {
|
|
const listQuery = useListRepositoryQuery();
|
|
|
|
if (listQuery.isLoading) {
|
|
return <Spinner />;
|
|
}
|
|
|
|
return (
|
|
<Combobox
|
|
{...props}
|
|
placeholder={'Select a repository'}
|
|
options={
|
|
listQuery.data?.items?.map((repo) => ({
|
|
label: repo.spec?.title,
|
|
value: repo.metadata?.name ?? '',
|
|
})) || []
|
|
}
|
|
/>
|
|
);
|
|
}
|