mirror of https://github.com/langgenius/dify.git
fix: add i18n key
This commit is contained in:
parent
270fd9cb07
commit
4ec23eea00
|
|
@ -202,7 +202,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BU
|
|||
onClick={onClickCreate}
|
||||
className={cn(
|
||||
'float-right',
|
||||
shape === 'circle' && '!rounded-full border-[0.5px] border-components-button-secondary-border-hover bg-components-button-secondary-bg-hover text-components-button-secondary-accent-text shadow-xs',
|
||||
shape === 'circle' && '!rounded-full border-[0.5px] border-components-button-secondary-border-hover bg-components-button-secondary-bg-hover text-components-button-secondary-accent-text shadow-xs hover:border-components-button-secondary-border-disabled hover:bg-components-button-secondary-bg-disabled hover:text-components-button-secondary-accent-text-disabled',
|
||||
)}
|
||||
state={subscriptionCount >= MAX_COUNT ? ActionButtonState.Disabled : ActionButtonState.Default}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -185,12 +185,12 @@ export const OAuthClientSettingsModal = ({ oauthConfig, onClose, showOAuthCreate
|
|||
)
|
||||
}
|
||||
>
|
||||
<span className='system-sm-semibold mb-2 text-text-secondary'>OAuth Client</span>
|
||||
<div className='system-sm-medium mb-2 text-text-secondary'>{t('pluginTrigger.subscription.addType.options.oauth.clientTitle')}</div>
|
||||
<div className='mb-4 flex w-full items-start justify-between gap-2'>
|
||||
{[ClientTypeEnum.Default, ClientTypeEnum.Custom].map(option => (
|
||||
<OptionCard
|
||||
key={option}
|
||||
title={option}
|
||||
title={t(`pluginTrigger.subscription.addType.options.oauth.${option}`)}
|
||||
onSelect={() => setClientType(option)}
|
||||
selected={clientType === option}
|
||||
className="flex-1"
|
||||
|
|
|
|||
|
|
@ -31,18 +31,18 @@ const SubscriptionTriggerButton: React.FC<SubscriptionTriggerButtonProps> = ({
|
|||
if (!selectedId) {
|
||||
if (isOpen) {
|
||||
return {
|
||||
label: t('workflow.nodes.triggerPlugin.selectSubscription'),
|
||||
label: t('pluginTrigger.subscription.selectPlaceholder'),
|
||||
color: 'yellow' as const,
|
||||
}
|
||||
}
|
||||
return {
|
||||
label: 'No subscription selected',
|
||||
label: t('pluginTrigger.subscription.noSubscriptionSelected'),
|
||||
color: 'red' as const,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
label: subscriptions?.find(sub => sub.id === selectedId)?.name || '--',
|
||||
label: subscriptions?.find(sub => sub.id === selectedId)?.name || t('pluginTrigger.subscription.selectPlaceholder'),
|
||||
color: 'green' as const,
|
||||
}
|
||||
}, [selectedId, subscriptions, t, isOpen])
|
||||
|
|
@ -57,7 +57,7 @@ const SubscriptionTriggerButton: React.FC<SubscriptionTriggerButtonProps> = ({
|
|||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
<RiWebhookLine className='h-3.5 w-3.5 shrink-0 text-text-secondary' />
|
||||
<RiWebhookLine className={cn('h-3.5 w-3.5 shrink-0 text-text-secondary', statusConfig.color === 'red' && 'text-components-button-destructive-secondary-text')} />
|
||||
<span className={cn('system-xs-medium truncate text-components-button-ghost-text', statusConfig.color === 'red' && 'text-components-button-destructive-secondary-text')}>
|
||||
{statusConfig.label}
|
||||
</span>
|
||||
|
|
@ -65,6 +65,7 @@ const SubscriptionTriggerButton: React.FC<SubscriptionTriggerButtonProps> = ({
|
|||
className={cn(
|
||||
'ml-auto h-4 w-4 shrink-0 text-text-quaternary transition-transform',
|
||||
isOpen && 'rotate-180',
|
||||
statusConfig.color === 'red' && 'text-components-button-destructive-secondary-text',
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ const NodeAuth: FC<NodeAuthProps> = ({ data, onAuthorizationChange, onSubscripti
|
|||
<SubscriptionMenu
|
||||
// @ts-expect-error TODO: fix this
|
||||
payload={data}
|
||||
selectedSubscriptionId={data.subscription_id}
|
||||
onSubscriptionSelect={({ id, name }) => onSubscriptionChange?.(id, name)}
|
||||
/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,23 +1,25 @@
|
|||
'use client'
|
||||
|
||||
import { useLanguage } from '@/app/components/header/account-setting/model-provider-page/hooks'
|
||||
import { SubscriptionSelectorEntry } from '@/app/components/plugins/plugin-detail-panel/subscription-list/selector-entry'
|
||||
import { usePluginStore } from '@/app/components/plugins/plugin-detail-panel/subscription-list/store'
|
||||
import { memo, useEffect } from 'react'
|
||||
import type { PluginTriggerNodeType } from '../types'
|
||||
import useConfig from '../use-config'
|
||||
|
||||
export const SubscriptionMenu = memo(({ payload, selectedSubscriptionId, onSubscriptionSelect }: {
|
||||
export const SubscriptionMenu = memo(({ payload, onSubscriptionSelect }: {
|
||||
payload: PluginTriggerNodeType,
|
||||
selectedSubscriptionId?: string,
|
||||
onSubscriptionSelect: ({ id, name }: { id: string, name: string }) => void
|
||||
}) => {
|
||||
// @ts-expect-error TODO: fix this
|
||||
const { currentProvider } = useConfig(payload.id as string, payload)
|
||||
const { setDetail } = usePluginStore()
|
||||
const language = useLanguage()
|
||||
|
||||
useEffect(() => {
|
||||
if (currentProvider) {
|
||||
setDetail({
|
||||
name: currentProvider.label[language],
|
||||
plugin_id: currentProvider.plugin_id || '',
|
||||
provider: currentProvider.name,
|
||||
declaration: {
|
||||
|
|
@ -34,7 +36,7 @@ export const SubscriptionMenu = memo(({ payload, selectedSubscriptionId, onSubsc
|
|||
|
||||
return (
|
||||
<SubscriptionSelectorEntry
|
||||
selectedId={selectedSubscriptionId}
|
||||
selectedId={payload.subscription_id}
|
||||
onSelect={onSubscriptionSelect}
|
||||
/>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ const translation = {
|
|||
createSuccess: 'Subscription created successfully',
|
||||
createFailed: 'Failed to create subscription',
|
||||
maxCount: 'Max {{num}} subscriptions',
|
||||
selectPlaceholder: 'Select subscription',
|
||||
noSubscriptionSelected: 'No subscription selected',
|
||||
list: {
|
||||
title: 'Subscriptions',
|
||||
addButton: 'Add',
|
||||
|
|
@ -62,6 +64,9 @@ const translation = {
|
|||
title: 'Via OAuth',
|
||||
description: 'Authorize with third-party platform to create subscription',
|
||||
clientSettings: 'OAuth Client Settings',
|
||||
clientTitle: 'OAuth Client',
|
||||
default: 'Default',
|
||||
custom: 'Custom',
|
||||
},
|
||||
manual: {
|
||||
title: 'Manual Setup',
|
||||
|
|
@ -123,15 +128,6 @@ const translation = {
|
|||
manual: {
|
||||
title: 'Manual Setup',
|
||||
description: 'Configure your webhook subscription manually',
|
||||
instruction: {
|
||||
title: 'Setup Instructions',
|
||||
step1: '1. Copy the callback URL below',
|
||||
step2: '2. Go to your third-party platform webhook settings',
|
||||
step3: '3. Add the callback URL as a webhook endpoint',
|
||||
step4: '4. Configure the events you want to receive',
|
||||
step5: '5. Test the webhook by triggering an event',
|
||||
step6: '6. Return here to verify the webhook is working and complete setup',
|
||||
},
|
||||
logs: {
|
||||
title: 'Request Logs',
|
||||
request: 'Request',
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ const translation = {
|
|||
createSuccess: '订阅创建成功',
|
||||
createFailed: '订阅创建失败',
|
||||
maxCount: '最多 {{num}} 个订阅',
|
||||
selectPlaceholder: '选择订阅',
|
||||
noSubscriptionSelected: '未选择订阅',
|
||||
list: {
|
||||
title: '订阅列表',
|
||||
addButton: '添加',
|
||||
|
|
@ -62,6 +64,9 @@ const translation = {
|
|||
title: '通过 OAuth',
|
||||
description: '与第三方平台授权以创建订阅',
|
||||
clientSettings: 'OAuth 客户端设置',
|
||||
clientTitle: 'OAuth 客户端',
|
||||
default: '默认',
|
||||
custom: '自定义',
|
||||
},
|
||||
manual: {
|
||||
title: '手动设置',
|
||||
|
|
@ -92,8 +97,8 @@ const translation = {
|
|||
title: '通过API密钥创建',
|
||||
verify: {
|
||||
title: '验证凭据',
|
||||
description: '请提供您的API凭据以验证访问权限',
|
||||
error: '凭据验证失败,请检查您的API密钥。',
|
||||
description: '请提供您的 API 凭据以验证访问权限',
|
||||
error: '凭据验证失败,请检查您的 API 密钥。',
|
||||
success: '凭据验证成功',
|
||||
},
|
||||
configuration: {
|
||||
|
|
@ -102,9 +107,9 @@ const translation = {
|
|||
},
|
||||
},
|
||||
oauth: {
|
||||
title: '通过OAuth创建',
|
||||
title: '通过 OAuth 创建',
|
||||
authorization: {
|
||||
title: 'OAuth授权',
|
||||
title: 'OAuth 授权',
|
||||
description: '授权 Dify 访问您的账户',
|
||||
redirectUrl: '重定向 URL',
|
||||
redirectUrlHelp: '在您的 OAuth 应用配置中使用此 URL',
|
||||
|
|
@ -123,15 +128,6 @@ const translation = {
|
|||
manual: {
|
||||
title: '手动设置',
|
||||
description: '手动配置您的 Webhook 订阅',
|
||||
instruction: {
|
||||
title: '设置说明',
|
||||
step1: '1. 复制下方的回调URL',
|
||||
step2: '2. 前往您的第三方平台Webhook设置',
|
||||
step3: '3. 将回调URL添加为Webhook端点',
|
||||
step4: '4. 配置您想要接收的事件',
|
||||
step5: '5. 通过触发事件来测试Webhook',
|
||||
step6: '6. 返回此处验证Webhook正常工作并完成设置',
|
||||
},
|
||||
logs: {
|
||||
title: '请求日志',
|
||||
request: '请求',
|
||||
|
|
|
|||
Loading…
Reference in New Issue