|
|
|
|
@ -25,7 +25,7 @@ import AppsFull from '@/app/components/billing/apps-full-in-dialog'
|
|
|
|
|
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
|
|
|
|
import { getRedirection } from '@/utils/app-redirection'
|
|
|
|
|
import cn from '@/utils/classnames'
|
|
|
|
|
import { useMutationCheckDependenciesBeforeImportDSL } from '@/service/use-plugins'
|
|
|
|
|
import { useStore as usePluginDependencyStore } from '@/app/components/workflow/plugin-dependency/store'
|
|
|
|
|
|
|
|
|
|
type CreateFromDSLModalProps = {
|
|
|
|
|
show: boolean
|
|
|
|
|
@ -48,7 +48,6 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
|
|
|
|
|
const [fileContent, setFileContent] = useState<string>()
|
|
|
|
|
const [currentTab, setCurrentTab] = useState(activeTab)
|
|
|
|
|
const [dslUrlValue, setDslUrlValue] = useState(dslUrl)
|
|
|
|
|
const { mutateAsync } = useMutationCheckDependenciesBeforeImportDSL()
|
|
|
|
|
const [showErrorModal, setShowErrorModal] = useState(false)
|
|
|
|
|
const [versions, setVersions] = useState<{ importedVersion: string; systemVersion: string }>()
|
|
|
|
|
const [importId, setImportId] = useState<string>()
|
|
|
|
|
@ -92,20 +91,22 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
|
|
|
|
|
mode: DSLImportMode.YAML_CONTENT,
|
|
|
|
|
yaml_content: fileContent || '',
|
|
|
|
|
})
|
|
|
|
|
await mutateAsync({ dslString: fileContent })
|
|
|
|
|
}
|
|
|
|
|
if (currentTab === CreateFromDSLModalTab.FROM_URL) {
|
|
|
|
|
response = await importDSL({
|
|
|
|
|
mode: DSLImportMode.YAML_URL,
|
|
|
|
|
yaml_url: dslUrlValue || '',
|
|
|
|
|
})
|
|
|
|
|
await mutateAsync({ url: dslUrlValue })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!response)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
const { id, status, app_id, imported_dsl_version, current_dsl_version } = response
|
|
|
|
|
const { id, status, app_id, imported_dsl_version, current_dsl_version, leaked } = response
|
|
|
|
|
if (leaked?.length) {
|
|
|
|
|
const { setDependencies } = usePluginDependencyStore.getState()
|
|
|
|
|
setDependencies(leaked)
|
|
|
|
|
}
|
|
|
|
|
if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) {
|
|
|
|
|
if (onSuccess)
|
|
|
|
|
onSuccess()
|
|
|
|
|
|