diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 692fecd97..6e74f20a6 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { env: { browser: true, es2021: true, - "es6": true + es6: true }, extends: [ "airbnb", diff --git a/frontend/src/components/v2/Alert/Alert.stories.tsx b/frontend/src/components/v2/Alert/Alert.stories.tsx new file mode 100644 index 000000000..49e8ca43c --- /dev/null +++ b/frontend/src/components/v2/Alert/Alert.stories.tsx @@ -0,0 +1,61 @@ +import { faPlus } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import type { Meta, StoryObj } from "@storybook/react"; + +import { Alert, AlertDescription } from "./Alert"; + +const meta: Meta = { + title: "Components/Alert", + component: Alert, + tags: ["v2"] +}; + +export default meta; + +type Story = StoryObj; + +const ExampleComponent = () => this is a description; + +export const Default: Story = { + args: { + children: + } +}; + +export const Warning: Story = { + args: { + children: , + variant: "warning" + } +}; + +export const Danger: Story = { + args: { + children: , + variant: "danger" + } +}; + +export const WithCustomIcon: Story = { + args: { + children: , + variant: "warning", + icon: + } +}; + +export const WithOutIcon: Story = { + args: { + children: , + variant: "warning", + icon: null + } +}; + +export const WithOutTitle: Story = { + args: { + children: , + variant: "warning", + hideTitle: true + } +}; diff --git a/frontend/src/components/v2/Alert/Alert.tsx b/frontend/src/components/v2/Alert/Alert.tsx new file mode 100644 index 000000000..9de25193c --- /dev/null +++ b/frontend/src/components/v2/Alert/Alert.tsx @@ -0,0 +1,85 @@ +import { forwardRef } from "react"; +import { + faExclamationCircle, + faExclamationTriangle, + faInfoCircle +} from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { type VariantProps, cva } from "cva"; +import { twMerge } from "tailwind-merge"; + +const alertVariants = cva( + "w-full bg-mineshaft-800 rounded-lg border px-4 py-3 text-sm flex items-center gap-x-4", + { + variants: { + variant: { + default: "", + danger: "text-red border-red", + warning: "text-yellow border-yellow" + } + }, + defaultVariants: { + variant: "default" + } + } +); + +type AlertProps = { + title?: string; + hideTitle?: boolean; + icon?: React.ReactNode; +}; + +const variantTitleMap = { + default: "Info", + danger: "Danger", + warning: "Warning" +}; + +const variantIconMap = { + default: faInfoCircle, + danger: faExclamationCircle, + warning: faExclamationTriangle +}; + +const Alert = forwardRef< + HTMLDivElement, + React.HTMLAttributes & VariantProps & AlertProps +>(({ className, variant, title, icon, hideTitle = false, children, ...props }, ref) => { + const defaultTitle = title ?? variantTitleMap[variant ?? "default"]; + return ( +
+
+ {typeof icon !== "undefined" ? ( + <>{icon} + ) : ( + + )} +
+
+ {hideTitle ? null : ( +
+ {defaultTitle} +
+ )} + {children} +
+
+ ); +}); +Alert.displayName = "Alert"; + +const AlertDescription = forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); +AlertDescription.displayName = "AlertDescription"; + +export { Alert, AlertDescription }; diff --git a/frontend/src/components/v2/Alert/index.tsx b/frontend/src/components/v2/Alert/index.tsx new file mode 100644 index 000000000..7851a0943 --- /dev/null +++ b/frontend/src/components/v2/Alert/index.tsx @@ -0,0 +1 @@ +export { Alert, AlertDescription } from "./Alert"; diff --git a/frontend/src/components/v2/index.tsx b/frontend/src/components/v2/index.tsx index 89030931d..31e2b4e57 100644 --- a/frontend/src/components/v2/index.tsx +++ b/frontend/src/components/v2/index.tsx @@ -1,4 +1,5 @@ export * from "./Accordion"; +export * from "./Alert"; export * from "./Button"; export * from "./Card"; export * from "./Checkbox"; diff --git a/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx b/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx index fdc04af9d..fda0f6a1d 100644 --- a/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx +++ b/frontend/src/views/IntegrationsPage/IntegrationsPage.tsx @@ -202,6 +202,8 @@ export const IntegrationsPage = withProjectPermission( integrations={integrations} environments={environments} onIntegrationDelete={({ _id: id }, cb) => handleIntegrationDelete(id, cb)} + isBotActive={bot?.isActive} + workspaceId={workspaceId} /> void) => void; + isBotActive: boolean | undefined; + workspaceId: string; }; export const IntegrationsSection = ({ integrations = [], environments = [], isLoading, - onIntegrationDelete + onIntegrationDelete, + isBotActive, + workspaceId }: Props) => { const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "deleteConfirmation" ] as const); + return (
@@ -45,7 +53,22 @@ export const IntegrationsSection = ({
)} - {!isLoading && !integrations.length && ( + + {!isBotActive && ( +
+ + + All the active integrations will be disabled. Disable End-to-End Encryption in{" "} + + project settings + + to re-enable it . + + +
+ )} + + {!isLoading && !integrations.length && isBotActive && (
)} - {!isLoading && ( + {!isLoading && isBotActive && (
{integrations?.map((integration) => (
{ }; return bot ? ( -
+

End-to-End Encryption

-

+

Disabling, end-to-end encryption (E2EE) unlocks capabilities like native integrations to cloud providers as well as HTTP calls to get secrets back raw but enables the server to read/decrypt your secret values.

-

+

Note that, even with E2EE disabled, your secrets are always encrypted at rest.

{(isAllowed) => ( -
- { - await toggleBotActivate(); - }} - > - End-to-end encryption enabled - +
+
+ { + await toggleBotActivate(); + }} + > + End-to-end encryption enabled + +
+
+ + + Enabling End-to-end encryption disables all the integrations + + +
)}