mirror of https://github.com/langgenius/dify.git
app detail redirection
This commit is contained in:
parent
6adb986167
commit
067e6b5ae7
|
|
@ -122,14 +122,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
|
|||
message: t('app.newApp.appCreated'),
|
||||
})
|
||||
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
|
||||
if (!isCurrentWorkspaceManager) {
|
||||
push(`/app/${newApp.id}/overview`)
|
||||
}
|
||||
else {
|
||||
if (newApp.mode === 'workflow' || newApp.mode === 'advanced-chat')
|
||||
push(`/app/${newApp.id}/workflow`)
|
||||
push(`/app/${newApp.id}/configuration`)
|
||||
}
|
||||
getRedirection(isCurrentWorkspaceManager, newApp, push)
|
||||
}
|
||||
catch (e) {
|
||||
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import { ChatBot, CuteRobot } from '@/app/components/base/icons/src/vender/line/
|
|||
import { HelpCircle } from '@/app/components/base/icons/src/vender/line/general'
|
||||
import { Route } from '@/app/components/base/icons/src/vender/line/mapsAndTravel'
|
||||
import TooltipPlus from '@/app/components/base/tooltip-plus'
|
||||
import { getRedirection } from '@/utils/app-redirection'
|
||||
|
||||
export type AppFormProps = {
|
||||
onConfirm: () => void
|
||||
|
|
@ -32,7 +33,7 @@ const AppForm = ({
|
|||
onTipChange,
|
||||
}: AppFormProps) => {
|
||||
const { t } = useTranslation()
|
||||
const router = useRouter()
|
||||
const { push } = useRouter()
|
||||
const { notify } = useContext(ToastContext)
|
||||
|
||||
const mutateApps = useContextSelector(AppsContext, state => state.mutateApps)
|
||||
|
|
@ -73,21 +74,13 @@ const AppForm = ({
|
|||
onConfirm()
|
||||
onHide()
|
||||
mutateApps()
|
||||
if (!isCurrentWorkspaceManager) {
|
||||
router.push(`/app/${app.id}/overview`)
|
||||
}
|
||||
else {
|
||||
if (app.mode === 'workflow' || app.mode === 'advanced-chat')
|
||||
router.push(`/app/${app.id}/workflow`)
|
||||
else
|
||||
router.push(`/app/${app.id}/configuration`)
|
||||
}
|
||||
getRedirection(isCurrentWorkspaceManager, app, push)
|
||||
}
|
||||
catch (e) {
|
||||
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
||||
}
|
||||
isCreatingRef.current = false
|
||||
}, [name, notify, t, appMode, emoji.icon, emoji.icon_background, description, onConfirm, onHide, mutateApps, router, isCurrentWorkspaceManager])
|
||||
}, [name, notify, t, appMode, emoji.icon, emoji.icon_background, description, onConfirm, onHide, mutateApps, push, isCurrentWorkspaceManager])
|
||||
|
||||
return (
|
||||
<div className='overflow-y-auto'>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { useProviderContext } from '@/context/provider-context'
|
|||
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
|
||||
import { XClose } from '@/app/components/base/icons/src/vender/line/general'
|
||||
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||
import { getRedirection } from '@/utils/app-redirection'
|
||||
|
||||
type CreateFromDSLModalProps = {
|
||||
show: boolean
|
||||
|
|
@ -23,7 +24,7 @@ type CreateFromDSLModalProps = {
|
|||
}
|
||||
|
||||
const CreateFromDSLModal = ({ show, onSuccess, onClose }: CreateFromDSLModalProps) => {
|
||||
const router = useRouter()
|
||||
const { push } = useRouter()
|
||||
const { t } = useTranslation()
|
||||
const { notify } = useContext(ToastContext)
|
||||
const [currentFile, setDSLFile] = useState<File>()
|
||||
|
|
@ -67,14 +68,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose }: CreateFromDSLModalProp
|
|||
onClose()
|
||||
notify({ type: 'success', message: t('app.newApp.appCreated') })
|
||||
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
|
||||
if (!isCurrentWorkspaceManager) {
|
||||
router.push(`/app/${app.id}/overview`)
|
||||
}
|
||||
else {
|
||||
if (app.mode === 'workflow' || app.mode === 'advanced-chat')
|
||||
router.push(`/app/${app.id}/workflow`)
|
||||
router.push(`/app/${app.id}/configuration`)
|
||||
}
|
||||
getRedirection(isCurrentWorkspaceManager, app, push)
|
||||
}
|
||||
catch (e) {
|
||||
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import type { CreateAppModalProps } from '@/app/components/explore/create-app-mo
|
|||
import Loading from '@/app/components/base/loading'
|
||||
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { getRedirection } from '@/utils/app-redirection'
|
||||
|
||||
type AppsProps = {
|
||||
pageType?: PageType
|
||||
|
|
@ -35,7 +36,7 @@ const Apps = ({
|
|||
}: AppsProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { isCurrentWorkspaceManager } = useAppContext()
|
||||
const router = useRouter()
|
||||
const { push } = useRouter()
|
||||
const { hasEditPermission } = useContext(ExploreContext)
|
||||
const allCategoriesEn = t('explore.apps.allCategories', { lng: 'en' })
|
||||
|
||||
|
|
@ -89,14 +90,7 @@ const Apps = ({
|
|||
message: t('app.newApp.appCreated'),
|
||||
})
|
||||
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
|
||||
if (!isCurrentWorkspaceManager) {
|
||||
router.push(`/app/${app.id}/overview`)
|
||||
}
|
||||
else {
|
||||
if (app.mode === 'workflow' || app.mode === 'advanced-chat')
|
||||
router.push(`/app/${app.id}/workflow`)
|
||||
router.push(`/app/${app.id}/configuration`)
|
||||
}
|
||||
getRedirection(isCurrentWorkspaceManager, app, push)
|
||||
}
|
||||
catch (e) {
|
||||
Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
||||
|
|
|
|||
Loading…
Reference in New Issue