diff --git a/eslint-suppressions.json b/eslint-suppressions.json index ced0d27afe..183560f81b 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -3167,11 +3167,6 @@ "count": 2 } }, - "web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts": { "erasable-syntax-only/enums": { "count": 1 diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx index 459b657f3f..af52ec14f0 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/common-modal.spec.tsx @@ -1,6 +1,6 @@ +import type * as React from 'react' import type { TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' import { act, fireEvent, render, screen, waitFor } from '@testing-library/react' -import * as React from 'react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { SupportedCreationMethods } from '@/app/components/plugins/types' import { TriggerCredentialTypeEnum } from '@/app/components/workflow/block-selector/types' @@ -134,36 +134,6 @@ vi.mock('@langgenius/dify-ui/toast', () => ({ }), })) -vi.mock('@/app/components/base/modal/modal', () => ({ - default: ({ - children, - onClose, - onConfirm, - title, - confirmButtonText, - bottomSlot, - size, - disabled, - }: { - children: React.ReactNode - onClose: () => void - onConfirm: () => void - title: string - confirmButtonText: string - bottomSlot?: React.ReactNode - size?: string - disabled?: boolean - }) => ( -
-
{title}
-
{children}
-
{bottomSlot}
- - -
- ), -})) - type MockFormValuesConfig = { values: Record isCheckValidated: boolean diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx index 15d3417c9b..502cf73d54 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx @@ -1,8 +1,15 @@ 'use client' import type { TriggerSubscriptionBuilder } from '@/app/components/workflow/block-selector/types' +import { Button } from '@langgenius/dify-ui/button' +import { cn } from '@langgenius/dify-ui/cn' +import { + Dialog, + DialogCloseButton, + DialogContent, + DialogTitle, +} from '@langgenius/dify-ui/dialog' import { useTranslation } from 'react-i18next' import { EncryptedBottom } from '@/app/components/base/encrypted-bottom' -import Modal from '@/app/components/base/modal/modal' import { SupportedCreationMethods } from '@/app/components/plugins/types' import { ConfigurationStepContent, @@ -48,46 +55,93 @@ export const CommonCreateModal = ({ onClose, createType, builder }: Props) => { const isApiKeyType = createType === SupportedCreationMethods.APIKEY const isVerifyStep = currentStep === ApiKeyStep.Verify const isConfigurationStep = currentStep === ApiKeyStep.Configuration + const isDisabled = isVerifyingCredentials || isBuilding + const modalSize = createType === SupportedCreationMethods.MANUAL ? 'md' : 'sm' return ( - : null} - size={createType === SupportedCreationMethods.MANUAL ? 'md' : 'sm'} - containerClassName="min-h-[360px]" - clickOutsideNotClose - > - {isApiKeyType && } + + +
+
+ + {t(MODAL_TITLE_KEY_MAP[createType], { ns: 'pluginTrigger' })} + + +
- {isVerifyStep && ( - - )} +
+ {isApiKeyType && } - {isConfigurationStep && ( - - )} - + {isVerifyStep && ( + + )} + + {isConfigurationStep && ( + + )} +
+ +
+
+ + +
+
+ + {isVerifyStep && ( +
+ +
+ )} +
+
+
) }