Skip to content

Commit

Permalink
hide api tab for dataset operator
Browse files Browse the repository at this point in the history
  • Loading branch information
JzoNgKVO committed Jul 9, 2024
1 parent dd4e81d commit beb03a1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions web/app/(commonLayout)/datasets/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

// Libraries
import { useEffect, useRef, useState } from 'react'
import { useEffect, useMemo, useRef, useState } from 'react'
import { useRouter } from 'next/navigation'
import { useTranslation } from 'react-i18next'
import { useDebounceFn } from 'ahooks'
Expand Down Expand Up @@ -31,10 +31,12 @@ const Container = () => {
const { currentWorkspace } = useAppContext()
const showTagManagementModal = useTagStore(s => s.showTagManagementModal)

const options = [
{ value: 'dataset', text: t('dataset.datasets') },
{ value: 'api', text: t('dataset.datasetsApi') },
]
const options = useMemo(() => {
return [
{ value: 'dataset', text: t('dataset.datasets') },
...(currentWorkspace.role === 'dataset_operator' ? [] : [{ value: 'api', text: t('dataset.datasetsApi') }]),
]
}, [currentWorkspace.role, t])

const [activeTab, setActiveTab] = useTabSearchParams({
defaultTab: 'dataset',
Expand Down

0 comments on commit beb03a1

Please sign in to comment.