fix dataset operator (#6064)

Co-authored-by: JzoNg <jzongcode@gmail.com>
This commit is contained in:
Joe 2024-07-09 17:47:54 +08:00 • committed by GitHub
commit ce930f19b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 1072 additions and 290 deletions

View file

@ -1,6 +1,7 @@
'use client'
import type { FC } from 'react'
import React, { useEffect, useState } from 'react'
import { useRouter } from 'next/navigation'
import { useTranslation } from 'react-i18next'
import ExploreContext from '@/context/explore-context'
import Sidebar from '@/app/components/explore/sidebar'
@ -16,8 +17,9 @@ const Explore: FC<IExploreProps> = ({
children,
}) => {
const { t } = useTranslation()
const router = useRouter()
const [controlUpdateInstalledApps, setControlUpdateInstalledApps] = useState(0)
const { userProfile } = useAppContext()
const { userProfile, isCurrentWorkspaceDatasetOperator } = useAppContext()
const [hasEditPermission, setHasEditPermission] = useState(false)
const [installedApps, setInstalledApps] = useState<InstalledApp[]>([])
@ -32,6 +34,11 @@ const Explore: FC<IExploreProps> = ({
})()
}, [])
useEffect(() => {
if (isCurrentWorkspaceDatasetOperator)
return router.replace('/datasets')
}, [isCurrentWorkspaceDatasetOperator])
return (
<div className='flex h-full bg-gray-100 border-t border-gray-200 overflow-hidden'>
<ExploreContext.Provider