瀏覽代碼

fix: diplay all helpfields (#23348)

Signed-off-by: jingfelix <jingfelix@outlook.com>
tags/1.7.2
Tianyi Jing 2 月之前
父節點
當前提交
8041808b53
沒有連結到貢獻者的電子郵件帳戶。

+ 17
- 0
web/app/components/base/form/components/base/base-field.tsx 查看文件

memo, memo,
useMemo, useMemo,
} from 'react' } from 'react'
import { RiExternalLinkLine } from '@remixicon/react'
import type { AnyFieldApi } from '@tanstack/react-form' import type { AnyFieldApi } from '@tanstack/react-form'
import { useStore } from '@tanstack/react-form' import { useStore } from '@tanstack/react-form'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
</div> </div>
) )
} }
{
formSchema.url && (
<a
className='system-xs-regular mt-4 flex items-center text-text-accent'
href={formSchema?.url}
target='_blank'
>
<span className='break-all'>
{renderI18nObject(formSchema?.help as any)}
</span>
{
<RiExternalLinkLine className='ml-1 h-3 w-3' />
}
</a>
)
}
</div> </div>
</div> </div>
) )

+ 1
- 16
web/app/components/plugins/plugin-auth/authorize/api-key-modal.tsx 查看文件

useState, useState,
} from 'react' } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { RiExternalLinkLine } from '@remixicon/react'
import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security' import { Lock01 } from '@/app/components/base/icons/src/vender/solid/security'
import Modal from '@/app/components/base/modal/modal' import Modal from '@/app/components/base/modal/modal'
import { CredentialTypeEnum } from '../types' import { CredentialTypeEnum } from '../types'
useGetPluginCredentialSchemaHook, useGetPluginCredentialSchemaHook,
useUpdatePluginCredentialHook, useUpdatePluginCredentialHook,
} from '../hooks/use-credential' } from '../hooks/use-credential'
import { useRenderI18nObject } from '@/hooks/use-i18n'


export type ApiKeyModalProps = { export type ApiKeyModalProps = {
pluginPayload: PluginPayload pluginPayload: PluginPayload
acc[schema.name] = schema.default acc[schema.name] = schema.default
return acc return acc
}, {} as Record<string, any>) }, {} as Record<string, any>)
const helpField = formSchemas.find(schema => schema.url && schema.help)
const renderI18nObject = useRenderI18nObject()
const { mutateAsync: addPluginCredential } = useAddPluginCredentialHook(pluginPayload) const { mutateAsync: addPluginCredential } = useAddPluginCredentialHook(pluginPayload)
const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload) const { mutateAsync: updatePluginCredential } = useUpdatePluginCredentialHook(pluginPayload)
const formRef = useRef<FormRefObject>(null) const formRef = useRef<FormRefObject>(null)
onClose={onClose} onClose={onClose}
onCancel={onClose} onCancel={onClose}
footerSlot={ footerSlot={
helpField && (
<a
className='system-xs-regular mr-2 flex items-center py-2 text-text-accent'
href={helpField?.url}
target='_blank'
>
<span className='break-all'>
{renderI18nObject(helpField?.help as any)}
</span>
<RiExternalLinkLine className='ml-1 h-3 w-3' />
</a>
)
(<div></div>)
} }
bottomSlot={ bottomSlot={
<div className='flex items-center justify-center bg-background-section-burn py-3 text-xs text-text-tertiary'> <div className='flex items-center justify-center bg-background-section-burn py-3 text-xs text-text-tertiary'>

+ 0
- 17
web/app/components/plugins/plugin-auth/authorize/oauth-client-settings.tsx 查看文件

useRef, useRef,
useState, useState,
} from 'react' } from 'react'
import { RiExternalLinkLine } from '@remixicon/react'
import { import {
useForm, useForm,
useStore, useStore,
} from '@/app/components/base/form/types' } from '@/app/components/base/form/types'
import { useToastContext } from '@/app/components/base/toast' import { useToastContext } from '@/app/components/base/toast'
import Button from '@/app/components/base/button' import Button from '@/app/components/base/button'
import { useRenderI18nObject } from '@/hooks/use-i18n'


type OAuthClientSettingsProps = { type OAuthClientSettingsProps = {
pluginPayload: PluginPayload pluginPayload: PluginPayload
defaultValues: editValues || defaultValues, defaultValues: editValues || defaultValues,
}) })
const __oauth_client__ = useStore(form.store, s => s.values.__oauth_client__) const __oauth_client__ = useStore(form.store, s => s.values.__oauth_client__)
const helpField = schemas.find(schema => schema.url && schema.help)
const renderI18nObject = useRenderI18nObject()
return ( return (
<Modal <Modal
title={t('plugin.auth.oauthClientSettings')} title={t('plugin.auth.oauthClientSettings')}
defaultValues={editValues || defaultValues} defaultValues={editValues || defaultValues}
disabled={disabled} disabled={disabled}
/> />
{
helpField && __oauth_client__ === 'custom' && (
<a
className='system-xs-regular mt-4 flex items-center text-text-accent'
href={helpField?.url}
target='_blank'
>
<span className='break-all'>
{renderI18nObject(helpField?.help as any)}
</span>
<RiExternalLinkLine className='ml-1 h-3 w-3' />
</a>
)}
</> </>
</Modal> </Modal>
) )

Loading…
取消
儲存