feat(gitops): add autocomplete to ref selector [EE-6245] (#10935)

pull/11031/head
Chaim Lev-Ari 10 months ago committed by GitHub
parent 2826a4ce39
commit 1561814fe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,7 +1,7 @@
import { StackId } from '@/react/common/stacks/types';
import { useGitRefs } from '@/react/portainer/gitops/queries/useGitRefs';
import { Select } from '@@/form-components/Input';
import { PortainerSelect } from '@@/form-components/PortainerSelect';
import { getAuthentication } from '../utils';
@ -43,6 +43,11 @@ export function RefSelector({
refs.unshift('refs/heads/main');
}
if (refs.includes('refs/heads/master')) {
refs.splice(refs.indexOf('refs/heads/master'), 1);
refs.unshift('refs/heads/master');
}
return refs.map((t: string) => ({
value: t,
label: t,
@ -58,12 +63,11 @@ export function RefSelector({
);
return (
<Select
<PortainerSelect
value={value}
options={refs || [{ value: 'refs/heads/main', label: 'refs/heads/main' }]}
onChange={(e) => onChange(e.target.value)}
onChange={(e) => e && onChange(e)}
data-cy="component-gitRefInput"
required
/>
);
}

Loading…
Cancel
Save