-
- {iconSrc ? (
-
- ) : (
-
+
+
+
+ {iconSrc ? (
+
+ ) : (
+
+ )}
+
+
{name}
+ {category && (
+
{category}
)}
-
-
{name}
- {category &&
{category}}
+
+
- {showSwitch && (
-
- )}
+ {showSwitch &&
+ (hasSwitchDisabledReason ? (
+
+
+ {switchDisabledReason}
+
+ ) : (
+ switchControl
+ ))}
>
)}
diff --git a/web/app/components/app/access-point/shared/access-point-status.ts b/web/app/components/base/access-point/status.ts
similarity index 100%
rename from web/app/components/app/access-point/shared/access-point-status.ts
rename to web/app/components/base/access-point/status.ts
diff --git a/web/app/components/app/access-point/shared/access-point-url.tsx b/web/app/components/base/access-point/url.tsx
similarity index 75%
rename from web/app/components/app/access-point/shared/access-point-url.tsx
rename to web/app/components/base/access-point/url.tsx
index cd90c57c111..678946d64bc 100644
--- a/web/app/components/app/access-point/shared/access-point-url.tsx
+++ b/web/app/components/base/access-point/url.tsx
@@ -3,38 +3,53 @@
import { Button, buttonVariants } from '@langgenius/dify-ui/button'
import { cn } from '@langgenius/dify-ui/cn'
import { IconButton } from '@langgenius/dify-ui/icon-button'
+import { Tooltip, TooltipContent, TooltipTrigger } from '@langgenius/dify-ui/tooltip'
import { useTranslation } from 'react-i18next'
import { CopyFeedback } from '@/app/components/base/copy-feedback'
import ShareQRCode from '@/app/components/base/qrcode'
-import { AccessPointEndpoint } from './access-point-card'
+import { AccessPointEndpoint } from './card'
type AccessPointUrlProps = {
enabled: boolean
label: string
unavailableLabel: string
value: string
+ copiedLabel?: string
copyDisabled?: boolean
+ copyLabel?: string
loading?: boolean
unavailable?: boolean
showOpen?: boolean
showQrCode?: boolean
showRegenerate?: boolean
openUrl?: string
+ onCopyError?: () => void
onRegenerate?: () => void
+ openDisabledReason?: string
openLabel?: string
+ qrCodeDownloadLabel?: string
+ qrCodeLabel?: string
+ qrCodeScanLabel?: string
regenerateLabel?: string
regenerateDisabled?: boolean
regenerating?: boolean
}
export function AccessPointUrl({
+ copiedLabel,
+ copyDisabled = false,
+ copyLabel,
enabled,
label,
loading = false,
- copyDisabled = false,
+ onCopyError,
onRegenerate,
+ openDisabledReason,
openLabel,
openUrl,
+ qrCodeDownloadLabel,
+ qrCodeLabel,
+ qrCodeScanLabel,
regenerateDisabled = false,
regenerateLabel,
regenerating = false,
@@ -47,6 +62,26 @@ export function AccessPointUrl({
}: AccessPointUrlProps) {
const { t } = useTranslation()
const detailsAvailable = !loading && !unavailable
+ const disabledOpenButton = (
+
+ )
+ const disabledOpenAction = openDisabledReason ? (
+
+
+ {openDisabledReason}
+
+ ) : (
+ disabledOpenButton
+ )
const disabledActions = (
@@ -82,7 +117,13 @@ export function AccessPointUrl({
) : (
-
+
)}
{showQrCode &&
(copyDisabled ? (
@@ -90,7 +131,12 @@ export function AccessPointUrl({