mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
feat: install bundle struct
This commit is contained in:
parent
d4c9c76454
commit
8203b23df2
|
@ -0,0 +1,38 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { InstallStep } from '../../types'
|
||||
import type { PluginDeclaration } from '../../types'
|
||||
import SelectPackage from './steps/select-package'
|
||||
|
||||
export enum InstallType {
|
||||
fromLocal = 'fromLocal',
|
||||
fromMarketplace = 'fromMarketplace',
|
||||
fromDSL = 'fromDSL',
|
||||
}
|
||||
|
||||
type Props = {
|
||||
installType?: InstallType
|
||||
plugins?: PluginDeclaration[]
|
||||
}
|
||||
|
||||
const InstallBundle: FC<Props> = ({
|
||||
installType = InstallType.fromMarketplace,
|
||||
plugins = [],
|
||||
}) => {
|
||||
const [step, setStep] = useState<InstallStep>(installType === InstallType.fromMarketplace ? InstallStep.readyToInstall : InstallStep.uploading)
|
||||
const [selectedPlugins, setSelectedPlugins] = useState<PluginDeclaration[]>([])
|
||||
|
||||
const handleSelectedPluginsChange = (plugins: PluginDeclaration[]) => {
|
||||
setSelectedPlugins(plugins)
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
{step === InstallStep.readyToInstall && (
|
||||
<SelectPackage plugins={plugins || []} onChange={handleSelectedPluginsChange} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default React.memo(InstallBundle)
|
|
@ -0,0 +1,20 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import type { PluginDeclaration } from '../../../types'
|
||||
|
||||
type Props = {
|
||||
plugins: PluginDeclaration[],
|
||||
onChange: (plugins: PluginDeclaration[]) => void
|
||||
}
|
||||
|
||||
const SelectPackage: FC<Props> = ({
|
||||
plugins,
|
||||
onChange,
|
||||
}) => {
|
||||
return (
|
||||
<div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default React.memo(SelectPackage)
|
|
@ -48,6 +48,7 @@ const Uploading: FC<Props> = ({
|
|||
|
||||
React.useEffect(() => {
|
||||
handleUpload()
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue
Block a user