fix: template app check dependency (#13389)

pull/13455/head
zxhlyh 1 year ago committed by GitHub
parent 3e9c3d0bb7
commit 4d25b598f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -27,6 +27,7 @@ import { getRedirection } from '@/utils/app-redirection'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import type { AppMode } from '@/types/app' import type { AppMode } from '@/types/app'
import { DSLImportMode } from '@/models/app' import { DSLImportMode } from '@/models/app'
import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'
type AppsProps = { type AppsProps = {
onSuccess?: () => void onSuccess?: () => void
@ -119,6 +120,7 @@ const Apps = ({
const [currApp, setCurrApp] = React.useState<App | null>(null) const [currApp, setCurrApp] = React.useState<App | null>(null)
const [isShowCreateModal, setIsShowCreateModal] = React.useState(false) const [isShowCreateModal, setIsShowCreateModal] = React.useState(false)
const { handleCheckPluginDependencies } = usePluginDependencies()
const onCreate: CreateAppModalProps['onConfirm'] = async ({ const onCreate: CreateAppModalProps['onConfirm'] = async ({
name, name,
icon_type, icon_type,
@ -146,6 +148,8 @@ const Apps = ({
}) })
if (onSuccess) if (onSuccess)
onSuccess() onSuccess()
if (app.app_id)
await handleCheckPluginDependencies(app.app_id)
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
getRedirection(isCurrentWorkspaceEditor, { id: app.app_id }, push) getRedirection(isCurrentWorkspaceEditor, { id: app.app_id }, push)
} }

@ -25,6 +25,7 @@ import { useAppContext } from '@/context/app-context'
import { getRedirection } from '@/utils/app-redirection' import { getRedirection } from '@/utils/app-redirection'
import Input from '@/app/components/base/input' import Input from '@/app/components/base/input'
import { DSLImportMode } from '@/models/app' import { DSLImportMode } from '@/models/app'
import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'
type AppsProps = { type AppsProps = {
pageType?: PageType pageType?: PageType
@ -117,6 +118,7 @@ const Apps = ({
const [currApp, setCurrApp] = React.useState<App | null>(null) const [currApp, setCurrApp] = React.useState<App | null>(null)
const [isShowCreateModal, setIsShowCreateModal] = React.useState(false) const [isShowCreateModal, setIsShowCreateModal] = React.useState(false)
const { handleCheckPluginDependencies } = usePluginDependencies()
const onCreate: CreateAppModalProps['onConfirm'] = async ({ const onCreate: CreateAppModalProps['onConfirm'] = async ({
name, name,
icon_type, icon_type,
@ -144,6 +146,8 @@ const Apps = ({
}) })
if (onSuccess) if (onSuccess)
onSuccess() onSuccess()
if (app.app_id)
await handleCheckPluginDependencies(app.app_id)
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
getRedirection(isCurrentWorkspaceEditor, { id: app.app_id }, push) getRedirection(isCurrentWorkspaceEditor, { id: app.app_id }, push)
} }

Loading…
Cancel
Save