mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
empty inputs form of app selector
This commit is contained in:
parent
f9f2e68bd8
commit
e53c4fc0ad
|
@ -18,7 +18,7 @@ import { SimpleSelect } from '@/app/components/base/select'
|
|||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import Radio from '@/app/components/base/radio'
|
||||
import ModelParameterModal from '@/app/components/header/account-setting/model-provider-page/model-parameter-modal'
|
||||
import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-selector'
|
||||
// import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-selector'
|
||||
import AppSelector from '@/app/components/plugins/plugin-detail-panel/app-selector'
|
||||
|
||||
type FormProps = {
|
||||
|
@ -318,34 +318,34 @@ const Form: FC<FormProps> = ({
|
|||
)
|
||||
}
|
||||
|
||||
if (formSchema.type === FormTypeEnum.toolSelector) {
|
||||
const {
|
||||
variable,
|
||||
label,
|
||||
required,
|
||||
} = formSchema as (CredentialFormSchemaTextInput | CredentialFormSchemaSecretInput)
|
||||
// if (formSchema.type === FormTypeEnum.toolSelector) {
|
||||
// const {
|
||||
// variable,
|
||||
// label,
|
||||
// required,
|
||||
// } = formSchema as (CredentialFormSchemaTextInput | CredentialFormSchemaSecretInput)
|
||||
|
||||
return (
|
||||
<div key={variable} className={cn(itemClassName, 'py-3')}>
|
||||
<div className={cn(fieldLabelClassName, 'flex items-center py-2 system-sm-semibold text-text-secondary')}>
|
||||
{label[language] || label.en_US}
|
||||
{
|
||||
required && (
|
||||
<span className='ml-1 text-red-500'>*</span>
|
||||
)
|
||||
}
|
||||
{tooltipContent}
|
||||
</div>
|
||||
<ToolSelector
|
||||
disabled={readonly}
|
||||
value={value[variable]}
|
||||
onSelect={item => handleFormChange(variable, item as any)}
|
||||
/>
|
||||
{fieldMoreInfo?.(formSchema)}
|
||||
{validating && changeKey === variable && <ValidatingTip />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
// return (
|
||||
// <div key={variable} className={cn(itemClassName, 'py-3')}>
|
||||
// <div className={cn(fieldLabelClassName, 'flex items-center py-2 system-sm-semibold text-text-secondary')}>
|
||||
// {label[language] || label.en_US}
|
||||
// {
|
||||
// required && (
|
||||
// <span className='ml-1 text-red-500'>*</span>
|
||||
// )
|
||||
// }
|
||||
// {tooltipContent}
|
||||
// </div>
|
||||
// <ToolSelector
|
||||
// disabled={readonly}
|
||||
// value={value[variable]}
|
||||
// onSelect={item => handleFormChange(variable, item as any)}
|
||||
// />
|
||||
// {fieldMoreInfo?.(formSchema)}
|
||||
// {validating && changeKey === variable && <ValidatingTip />}
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
|
||||
if (formSchema.type === FormTypeEnum.appSelector) {
|
||||
const {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
'use client'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { useAppDetail } from '@/service/use-apps'
|
||||
import type { App } from '@/types/app'
|
||||
import cn from '@/utils/classnames'
|
||||
|
||||
type Props = {
|
||||
appDetail: App
|
||||
}
|
||||
|
||||
const AppInputsPanel = ({
|
||||
appDetail,
|
||||
}: Props) => {
|
||||
const { t } = useTranslation()
|
||||
const { data: currentApp, isFetching: isLoading } = useAppDetail(appDetail.id)
|
||||
|
||||
const inputs = []
|
||||
|
||||
return (
|
||||
<div className={cn('px-4 pb-4 rounded-b-2xl border-t border-divider-subtle')}>
|
||||
{isLoading && <div className='pt-3'><Loading type='app' /></div>}
|
||||
{!isLoading && (
|
||||
<div className='mt-3 mb-2 h-6 flex items-center system-sm-semibold text-text-secondary'>{t('app.appSelector.params')}</div>
|
||||
)}
|
||||
{!isLoading && !inputs.length && (
|
||||
<div className='h-16 flex flex-col justify-center items-center'>
|
||||
<div className='text-text-tertiary system-sm-regular'>{t('app.appSelector.noParams')}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AppInputsPanel
|
|
@ -9,8 +9,7 @@ import {
|
|||
} from '@/app/components/base/portal-to-follow-elem'
|
||||
import AppTrigger from '@/app/components/plugins/plugin-detail-panel/app-selector/app-trigger'
|
||||
import AppPicker from '@/app/components/plugins/plugin-detail-panel/app-selector/app-picker'
|
||||
// import Button from '@/app/components/base/button'
|
||||
|
||||
import AppInputsPanel from '@/app/components/plugins/plugin-detail-panel/app-selector/app-inputs-panel'
|
||||
import { useAppFullList } from '@/service/use-apps'
|
||||
import type { App } from '@/types/app'
|
||||
import type {
|
||||
|
@ -65,8 +64,6 @@ const AppSelector: FC<Props> = ({
|
|||
setIsShowChooseApp(false)
|
||||
}
|
||||
|
||||
// const { data: currentApp } = useAppDetail(value?.app_id || 'empty')
|
||||
|
||||
return (
|
||||
<>
|
||||
<PortalToFollowElem
|
||||
|
@ -105,8 +102,11 @@ const AppSelector: FC<Props> = ({
|
|||
/>
|
||||
</div>
|
||||
{/* app inputs config panel */}
|
||||
<div className='px-4 py-3 flex items-center border-t border-divider-subtle'>
|
||||
</div>
|
||||
{currentAppInfo && (
|
||||
<AppInputsPanel
|
||||
appDetail={currentAppInfo}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</PortalToFollowElemContent>
|
||||
</PortalToFollowElem>
|
||||
|
|
|
@ -137,6 +137,7 @@ const translation = {
|
|||
label: 'APP',
|
||||
placeholder: 'Select an app...',
|
||||
params: 'APP PARAMETERS',
|
||||
noParams: 'No parameters needed',
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ const translation = {
|
|||
label: '应用',
|
||||
placeholder: '选择一个应用',
|
||||
params: '应用参数',
|
||||
noParams: '无需参数',
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user