mirror of
https://github.com/langgenius/dify.git
synced 2026-03-18 21:29:53 +08:00
Merge branch 'feat/plugins' of https://github.com/langgenius/dify into feat/plugins
This commit is contained in:
@ -6,7 +6,7 @@ import type { Item } from '@/app/components/base/select'
|
||||
import type { InstallState } from '@/app/components/plugins/types'
|
||||
import { useGitHubReleases, useGitHubUpload } from '../hooks'
|
||||
import { parseGitHubUrl } from '../utils'
|
||||
import type { PluginDeclaration } from '../../types'
|
||||
import type { PluginDeclaration, UpdateFromGitHubPayload } from '../../types'
|
||||
import { InstallStepFromGitHub } from '../../types'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import SetURL from './steps/setURL'
|
||||
@ -16,16 +16,18 @@ import Loaded from './steps/loaded'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type InstallFromGitHubProps = {
|
||||
updatePayload?: UpdateFromGitHubPayload
|
||||
onClose: () => void
|
||||
onSuccess: () => void
|
||||
}
|
||||
|
||||
const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({ onClose }) => {
|
||||
const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({ updatePayload, onClose }) => {
|
||||
const { t } = useTranslation()
|
||||
const [state, setState] = useState<InstallState>({
|
||||
step: InstallStepFromGitHub.setUrl,
|
||||
repoUrl: '',
|
||||
selectedVersion: '',
|
||||
selectedPackage: '',
|
||||
step: updatePayload ? InstallStepFromGitHub.selectPackage : InstallStepFromGitHub.setUrl,
|
||||
repoUrl: updatePayload?.url || '',
|
||||
selectedVersion: updatePayload?.currVersion || '',
|
||||
selectedPackage: updatePayload?.currPackage || '',
|
||||
releases: [],
|
||||
})
|
||||
const [uniqueIdentifier, setUniqueIdentifier] = useState<string | null>(null)
|
||||
@ -139,6 +141,7 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({ onClose }) => {
|
||||
)}
|
||||
{state.step === InstallStepFromGitHub.selectPackage && (
|
||||
<SelectPackage
|
||||
isEdit={Boolean(updatePayload)}
|
||||
selectedVersion={state.selectedVersion}
|
||||
versions={versions}
|
||||
onSelectVersion={item => setState(prevState => ({ ...prevState, selectedVersion: item.value as string }))}
|
||||
|
||||
Reference in New Issue
Block a user