mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
fix(secret-sync): allow users to input custom branch names as Vercel only send a max of 100 with no pagination available
This commit is contained in:
+25
-5
@@ -6,6 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||||||
|
|
||||||
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
|
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
|
||||||
import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
|
import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
|
||||||
|
import { CreatableSelect } from "@app/components/v2/CreatableSelect";
|
||||||
import {
|
import {
|
||||||
TVercelConnectionApp,
|
TVercelConnectionApp,
|
||||||
useVercelConnectionListOrganizations
|
useVercelConnectionListOrganizations
|
||||||
@@ -174,17 +175,36 @@ export const VercelSyncFields = () => {
|
|||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
label="Vercel Preview Branch (Optional)"
|
label="Vercel Preview Branch (Optional)"
|
||||||
>
|
>
|
||||||
<FilterableSelect
|
<CreatableSelect
|
||||||
menuPlacement="top"
|
className="w-full"
|
||||||
|
placeholder="Select a branch..."
|
||||||
isLoading={isProjectsLoading && Boolean(connectionId) && Boolean(currentApp)}
|
isLoading={isProjectsLoading && Boolean(connectionId) && Boolean(currentApp)}
|
||||||
isDisabled={!connectionId || !currentApp}
|
isDisabled={!connectionId || !currentApp}
|
||||||
|
options={previewBranchOptions}
|
||||||
|
menuPlacement="top"
|
||||||
value={previewBranchOptions.find((branch) => branch.id === value) ?? null}
|
value={previewBranchOptions.find((branch) => branch.id === value) ?? null}
|
||||||
onChange={(option) => onChange((option as SingleValue<{ id: string }>)?.id || "")}
|
onChange={(option) => onChange((option as SingleValue<{ id: string }>)?.id || "")}
|
||||||
options={previewBranchOptions}
|
onCreateOption={(option) => {
|
||||||
placeholder="Select a branch..."
|
onChange(option);
|
||||||
|
if (!option || option.trim() === "") return;
|
||||||
|
previewBranchOptions.push({ id: option, name: option });
|
||||||
|
}}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
getNewOptionData={(inputValue, _optionLabel) => {
|
||||||
|
return {
|
||||||
|
id: inputValue,
|
||||||
|
name: `Use custom input "${inputValue}" - press Enter`
|
||||||
|
};
|
||||||
|
}}
|
||||||
getOptionLabel={(option) => option.name}
|
getOptionLabel={(option) => option.name}
|
||||||
getOptionValue={(option) => option?.id || ""}
|
getOptionValue={(option) => option?.id || ""}
|
||||||
isClearable
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
isValidNewOption={(inputValue, _value, _options, _accessors) => {
|
||||||
|
return (
|
||||||
|
inputValue.trim().length > 0 &&
|
||||||
|
previewBranchOptions.filter((branch) => branch.id === inputValue).length === 0
|
||||||
|
);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user