fix: use constant url for bitbucket update/create secret

This commit is contained in:
Scott Wilson
2024-11-11 10:56:26 -08:00
parent d4c911a28f
commit 7b8551f883
11 changed files with 29 additions and 41 deletions

View File

@@ -7,7 +7,7 @@ import Select, {
Props
} from "react-select";
import { faCheckCircle, faCircleXmark } from "@fortawesome/free-regular-svg-icons";
import { faChevronDown, faX } from "@fortawesome/free-solid-svg-icons";
import { faChevronDown, faXmark } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { twMerge } from "tailwind-merge";
@@ -30,7 +30,7 @@ const ClearIndicator = <T,>(props: ClearIndicatorProps<T>) => {
const MultiValueRemove = (props: MultiValueRemoveProps) => {
return (
<components.MultiValueRemove {...props}>
<FontAwesomeIcon icon={faX} size="xs" />
<FontAwesomeIcon icon={faXmark} size="xs" />
</components.MultiValueRemove>
);
};
@@ -46,10 +46,10 @@ const Option = <T,>({ isSelected, children, ...props }: OptionProps<T>) => {
);
};
export const MultiSelect = <T,>({ isMulti = true, ...props }: Props<T>) => (
export const FilterableSelect = <T,>({ isMulti, closeMenuOnSelect, ...props }: Props<T>) => (
<Select
isMulti={isMulti}
closeMenuOnSelect={false}
closeMenuOnSelect={closeMenuOnSelect ?? !isMulti}
hideSelectedOptions={false}
unstyled
styles={{

View File

@@ -0,0 +1 @@
export * from "./FilterableSelect";

View File

@@ -1 +0,0 @@
export * from "./MultiSelect";

View File

@@ -11,6 +11,7 @@ export * from "./Drawer";
export * from "./Dropdown";
export * from "./EmailServiceSetupModal";
export * from "./EmptyState";
export * from "./FilterableSelect";
export * from "./FontAwesomeSymbol";
export * from "./FormControl";
export * from "./HoverCardv2";
@@ -18,7 +19,6 @@ export * from "./IconButton";
export * from "./Input";
export * from "./Menu";
export * from "./Modal";
export * from "./MultiSelect";
export * from "./NoticeBanner";
export * from "./Pagination";
export * from "./Popoverv2";

View File

@@ -282,7 +282,7 @@ export const AppLayout = ({ children }: LayoutProps) => {
);
const { data: projectTemplates = [] } = useListProjectTemplates({
enabled: canReadProjectTemplates && subscription?.projectTemplates
enabled: Boolean(canReadProjectTemplates && subscription?.projectTemplates)
});
const onCreateProject = async ({ name, addMembers, kmsKeyId, template }: TAddProjectFormData) => {

View File

@@ -10,9 +10,9 @@ import {
Button,
Card,
CardTitle,
FilterableSelect,
FormControl,
Input,
MultiSelect,
Spinner
} from "@app/components/v2";
import { useWorkspace } from "@app/context";
@@ -174,9 +174,7 @@ export default function BitBucketCreateIntegrationPage() {
isError={Boolean(error)}
label="Project Environment"
>
<MultiSelect
closeMenuOnSelect
isMulti={false}
<FilterableSelect
getOptionValue={(option) => option.slug}
value={value}
getOptionLabel={(option) => option.name}
@@ -210,9 +208,7 @@ export default function BitBucketCreateIntegrationPage() {
isError={Boolean(error)}
label="Bitbucket Workspace"
>
<MultiSelect
closeMenuOnSelect
isMulti={false}
<FilterableSelect
getOptionValue={(option) => option.slug}
value={value}
getOptionLabel={(option) => option.name}
@@ -231,9 +227,7 @@ export default function BitBucketCreateIntegrationPage() {
name="targetRepo"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<FormControl errorText={error?.message} isError={Boolean(error)} label="Bitbucket Repo">
<MultiSelect
closeMenuOnSelect
isMulti={false}
<FilterableSelect
getOptionValue={(option) => option.appId!}
value={value}
getOptionLabel={(option) => option.name}
@@ -252,9 +246,7 @@ export default function BitBucketCreateIntegrationPage() {
name="scope"
render={({ field: { value, onChange }, fieldState: { error } }) => (
<FormControl errorText={error?.message} isError={Boolean(error)} label="Scope">
<MultiSelect
closeMenuOnSelect
isMulti={false}
<FilterableSelect
value={value}
getOptionValue={(option) => option.value}
getOptionLabel={(option) => option.label}
@@ -275,9 +267,7 @@ export default function BitBucketCreateIntegrationPage() {
isError={Boolean(error)}
label="Bitbucket Deployment Environment"
>
<MultiSelect
closeMenuOnSelect
isMulti={false}
<FilterableSelect
getOptionValue={(option) => option.uuid}
value={value}
getOptionLabel={(option) => option.name}

View File

@@ -589,7 +589,7 @@ const OrganizationPage = () => {
);
const { data: projectTemplates = [] } = useListProjectTemplates({
enabled: canReadProjectTemplates && subscription?.projectTemplates
enabled: Boolean(canReadProjectTemplates && subscription?.projectTemplates)
});
const isAddingProjectsAllowed = subscription?.workspaceLimit

View File

@@ -15,10 +15,10 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
FilterableSelect,
FormControl,
Modal,
ModalContent,
MultiSelect
ModalContent
} from "@app/components/v2";
import { useOrganization, useWorkspace } from "@app/context";
import {
@@ -153,7 +153,7 @@ export const AddMemberModal = ({ popUp, handlePopUpToggle }: Props) => {
errorText={errors.orgMemberships?.[0]?.message}
label="Invite users to project"
>
<MultiSelect
<FilterableSelect
className="w-full"
placeholder="Add one or more users..."
isMulti

View File

@@ -6,7 +6,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, MultiSelect } from "@app/components/v2";
import { Button, FilterableSelect, FormControl, Input } from "@app/components/v2";
import { InfisicalSecretInput } from "@app/components/v2/InfisicalSecretInput";
import { ProjectPermissionActions, ProjectPermissionSub, useProjectPermission } from "@app/context";
import { getKeyValue } from "@app/helpers/parseEnvVar";
@@ -148,7 +148,7 @@ export const CreateSecretForm = ({
)
}
>
<MultiSelect
<FilterableSelect
className="w-full"
placeholder="Select tags to assign to secret..."
isMulti

View File

@@ -10,10 +10,10 @@ import { createNotification } from "@app/components/notifications";
import {
Button,
Checkbox,
FilterableSelect,
FormControl,
FormLabel,
Input,
MultiSelect,
Tooltip
} from "@app/components/v2";
import { InfisicalSecretInput } from "@app/components/v2/InfisicalSecretInput";
@@ -249,7 +249,7 @@ export const CreateSecretForm = ({ secretPath = "/", getSecretByKey, onClose }:
)
}
>
<MultiSelect
<FilterableSelect
className="w-full"
placeholder="Select tags to assign to secrets..."
isMulti