From 686b4b8e0e41437b119f1367ddc0567d0eeff5ac Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 16 Jul 2025 13:58:17 +0800 Subject: [PATCH] fix: style --- .../plugin-auth/authorize/add-api-key-button.tsx | 3 +++ .../plugin-auth/authorize/add-oauth-button.tsx | 13 +++++++------ .../plugin-auth/authorize/api-key-modal.tsx | 8 ++++---- .../plugins/plugin-auth/authorize/index.tsx | 4 ++++ .../authorize/oauth-client-settings.tsx | 12 ++++++------ .../plugins/plugin-auth/authorized-in-node.tsx | 2 ++ .../plugins/plugin-auth/authorized/index.tsx | 16 ++++++++-------- .../plugins/plugin-auth/hooks/use-plugin-auth.ts | 7 ++++++- .../plugins/plugin-auth/plugin-auth-in-agent.tsx | 3 +++ .../plugins/plugin-auth/plugin-auth.tsx | 3 +++ 10 files changed, 46 insertions(+), 25 deletions(-) diff --git a/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx index 4de5110e65..295fc4fa9d 100644 --- a/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/add-api-key-button.tsx @@ -12,12 +12,14 @@ export type AddApiKeyButtonProps = { buttonVariant?: ButtonProps['variant'] buttonText?: string disabled?: boolean + onUpdate?: () => void } const AddApiKeyButton = ({ pluginPayload, buttonVariant = 'secondary-accent', buttonText = 'use api key', disabled, + onUpdate, }: AddApiKeyButtonProps) => { const [isApiKeyModalOpen, setIsApiKeyModalOpen] = useState(false) @@ -36,6 +38,7 @@ const AddApiKeyButton = ({ setIsApiKeyModalOpen(false)} + onUpdate={onUpdate} /> ) } diff --git a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx index f9061a6045..5cb474f1bb 100644 --- a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx +++ b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx @@ -21,7 +21,6 @@ import Badge from '@/app/components/base/badge' import { useGetPluginOAuthClientSchemaHook, useGetPluginOAuthUrlHook, - useInvalidPluginCredentialInfoHook, } from '../hooks/use-credential' import type { FormSchema } from '@/app/components/base/form/types' import { FormTypeEnum } from '@/app/components/base/form/types' @@ -37,6 +36,7 @@ export type AddOAuthButtonProps = { buttonRightClassName?: string dividerClassName?: string disabled?: boolean + onUpdate?: () => void } const AddOAuthButton = ({ pluginPayload, @@ -47,6 +47,7 @@ const AddOAuthButton = ({ buttonRightClassName, dividerClassName, disabled, + onUpdate, }: AddOAuthButtonProps) => { const { t } = useTranslation() const renderI18nObject = useRenderI18nObject() @@ -61,17 +62,16 @@ const AddOAuthButton = ({ redirect_uri, } = data || {} const isConfigured = is_system_oauth_params_exists || Object.keys(client_params || {}).length > 0 - const invalidatePluginCredentialInfo = useInvalidPluginCredentialInfoHook(pluginPayload) const handleOAuth = useCallback(async () => { const { authorization_url } = await getPluginOAuthUrl() if (authorization_url) { openOAuthPopup( authorization_url, - invalidatePluginCredentialInfo, + () => onUpdate?.(), ) } - }, [getPluginOAuthUrl, invalidatePluginCredentialInfo]) + }, [getPluginOAuthUrl, onUpdate]) const renderCustomLabel = useCallback((item: FormSchema) => { return ( @@ -177,14 +177,14 @@ const AddOAuthButton = ({