mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
feat: integration preview page
This commit is contained in:
@ -1,17 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import Main from '@/app/components/explore/try-app/app/index'
|
|
||||||
|
|
||||||
export type IInstalledAppProps = {
|
|
||||||
params: {
|
|
||||||
appId: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function InstalledApp({ params }: IInstalledAppProps) {
|
|
||||||
const appId = (await params).appId
|
|
||||||
return (
|
|
||||||
<Main appId={appId} />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default InstalledApp
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import Main from '@/app/components/app/configuration/preview'
|
|
||||||
|
|
||||||
export type IPreviewProps = {
|
|
||||||
params: {
|
|
||||||
appId: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function Preview({ params }: IPreviewProps) {
|
|
||||||
const appId = (await params).appId
|
|
||||||
return (
|
|
||||||
<Main appId={appId} />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Preview
|
|
||||||
@ -7,6 +7,7 @@ import Button from '../../base/button'
|
|||||||
import { RiCloseLine } from '@remixicon/react'
|
import { RiCloseLine } from '@remixicon/react'
|
||||||
import AppInfo from './app-info'
|
import AppInfo from './app-info'
|
||||||
import App from './app'
|
import App from './app'
|
||||||
|
import Preview from './preview'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
appId: string
|
appId: string
|
||||||
@ -18,7 +19,6 @@ const TryApp: FC<Props> = ({
|
|||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
const [type, setType] = useState<TypeEnum>(TypeEnum.TRY)
|
const [type, setType] = useState<TypeEnum>(TypeEnum.TRY)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isShow
|
isShow
|
||||||
@ -42,7 +42,7 @@ const TryApp: FC<Props> = ({
|
|||||||
</div>
|
</div>
|
||||||
{/* Main content */}
|
{/* Main content */}
|
||||||
<div className='mt-2 flex grow justify-between space-x-2'>
|
<div className='mt-2 flex grow justify-between space-x-2'>
|
||||||
<App appId={appId} />
|
{type === TypeEnum.TRY ? <App appId={appId} /> : <Preview appId={appId} />}
|
||||||
<AppInfo className='w-[360px]' />
|
<AppInfo className='w-[360px]' />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -22,10 +22,10 @@ const FlowAppPreview: FC<Props> = ({
|
|||||||
<Loading type='area' />
|
<Loading type='area' />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
if(!data)
|
if (!data)
|
||||||
return null
|
return null
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className='w-full'>
|
||||||
<WorkflowPreview
|
<WorkflowPreview
|
||||||
{...data.graph}
|
{...data.graph}
|
||||||
className={cn(className)}
|
className={cn(className)}
|
||||||
@ -7,7 +7,7 @@ const NAME_SPACE = 'try-app'
|
|||||||
|
|
||||||
export const useGetTryAppInfo = (appId: string) => {
|
export const useGetTryAppInfo = (appId: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: [NAME_SPACE, 'appInfo'],
|
queryKey: [NAME_SPACE, 'appInfo', appId],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return fetchTryAppInfo(appId)
|
return fetchTryAppInfo(appId)
|
||||||
},
|
},
|
||||||
@ -16,7 +16,7 @@ export const useGetTryAppInfo = (appId: string) => {
|
|||||||
|
|
||||||
export const useGetTryAppParams = (appId: string) => {
|
export const useGetTryAppParams = (appId: string) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: [NAME_SPACE, 'appParams'],
|
queryKey: [NAME_SPACE, 'appParams', appId],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return fetchAppParams(AppSourceType.tryApp, appId)
|
return fetchAppParams(AppSourceType.tryApp, appId)
|
||||||
},
|
},
|
||||||
@ -25,7 +25,7 @@ export const useGetTryAppParams = (appId: string) => {
|
|||||||
|
|
||||||
export const useGetTryAppDataSets = (appId: string, ids: string[]) => {
|
export const useGetTryAppDataSets = (appId: string, ids: string[]) => {
|
||||||
return useQuery<DataSetListResponse>({
|
return useQuery<DataSetListResponse>({
|
||||||
queryKey: [NAME_SPACE, 'dataSets', ids],
|
queryKey: [NAME_SPACE, 'dataSets', appId, ids],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return fetchTryAppDatasets(appId, ids)
|
return fetchTryAppDatasets(appId, ids)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user