fix: dsl check plugin

pull/12372/head
StyleZhang 2 years ago
parent bc927868f4
commit 984e4564f8

@ -72,6 +72,7 @@ import { SupportUploadFileTypes } from '@/app/components/workflow/types'
import NewFeaturePanel from '@/app/components/base/features/new-feature-panel' import NewFeaturePanel from '@/app/components/base/features/new-feature-panel'
import { fetchFileUploadConfig } from '@/service/common' import { fetchFileUploadConfig } from '@/service/common'
import { correctProvider } from '@/utils' import { correctProvider } from '@/utils'
import PluginDependency from '@/app/components/workflow/plugin-dependency'
type PublishConfig = { type PublishConfig = {
modelConfig: ModelConfig modelConfig: ModelConfig
@ -1031,6 +1032,7 @@ const Configuration: FC = () => {
onAutoAddPromptVariable={handleAddPromptVariable} onAutoAddPromptVariable={handleAddPromptVariable}
/> />
)} )}
<PluginDependency />
</> </>
</FeaturesProvider> </FeaturesProvider>
</ConfigContext.Provider> </ConfigContext.Provider>

@ -80,24 +80,16 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
let app let app
if (currentTab === CreateFromDSLModalTab.FROM_FILE) { if (currentTab === CreateFromDSLModalTab.FROM_FILE) {
const leakedData = await mutateAsync({ dslString: fileContent })
if (leakedData?.leaked.length) {
isCreatingRef.current = false
return
}
app = await importApp({ app = await importApp({
data: fileContent || '', data: fileContent || '',
}) })
await mutateAsync({ dslString: fileContent })
} }
if (currentTab === CreateFromDSLModalTab.FROM_URL) { if (currentTab === CreateFromDSLModalTab.FROM_URL) {
const leakedData = await mutateAsync({ url: dslUrlValue })
if (leakedData?.leaked.length) {
isCreatingRef.current = false
return
}
app = await importAppFromUrl({ app = await importAppFromUrl({
url: dslUrlValue || '', url: dslUrlValue || '',
}) })
await mutateAsync({ url: dslUrlValue })
} }
if (onSuccess) if (onSuccess)
onSuccess() onSuccess()

@ -1,13 +1,25 @@
import { useCallback } from 'react'
import { useStore } from './store' import { useStore } from './store'
import InstallBundle from '@/app/components/plugins/install-plugin/install-bundle'
const PluginDependency = () => { const PluginDependency = () => {
const dependencies = useStore(s => s.dependencies) const dependencies = useStore(s => s.dependencies)
const handleCancelInstallBundle = useCallback(() => {
const { setDependencies } = useStore.getState()
setDependencies([])
}, [])
if (!dependencies.length) if (!dependencies.length)
return null return null
return ( return (
<div>a</div> <div>
<InstallBundle
fromDSLPayload={dependencies}
onClose={handleCancelInstallBundle}
/>
</div>
) )
} }

@ -77,17 +77,13 @@ const UpdateDSLModal = ({
return return
try { try {
if (appDetail && fileContent) { if (appDetail && fileContent) {
const leakedData = await mutateAsync({ dslString: fileContent })
if (leakedData?.leaked.length) {
isCreatingRef.current = false
return
}
setLoading(true) setLoading(true)
const { const {
graph, graph,
features, features,
hash, hash,
} = await updateWorkflowDraftFromDSL(appDetail.id, fileContent) } = await updateWorkflowDraftFromDSL(appDetail.id, fileContent)
await mutateAsync({ dslString: fileContent })
const { nodes, edges, viewport } = graph const { nodes, edges, viewport } = graph
const newFeatures = { const newFeatures = {
file: { file: {

Loading…
Cancel
Save