mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 01:59:13 +08:00
fix: show access mode icon in app list
This commit is contained in:
parent
ab262b8506
commit
32a8c7aad7
@ -4,7 +4,7 @@ import { useContext, useContextSelector } from 'use-context-selector'
|
|||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { RiGlobalLine, RiMoreFill } from '@remixicon/react'
|
import { RiBuildingLine, RiGlobalLine, RiLockLine, RiMoreFill } from '@remixicon/react'
|
||||||
import s from './style.module.css'
|
import s from './style.module.css'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import type { App } from '@/types/app'
|
import type { App } from '@/types/app'
|
||||||
@ -33,6 +33,7 @@ import { fetchInstalledAppList } from '@/service/explore'
|
|||||||
import { AppTypeIcon } from '@/app/components/app/type-selector'
|
import { AppTypeIcon } from '@/app/components/app/type-selector'
|
||||||
import Tooltip from '@/app/components/base/tooltip'
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
import AccessControl from '@/app/components/app/app-access-control'
|
import AccessControl from '@/app/components/app/app-access-control'
|
||||||
|
import { AccessMode } from '@/models/access-control'
|
||||||
|
|
||||||
export type AppCardProps = {
|
export type AppCardProps = {
|
||||||
app: App
|
app: App
|
||||||
@ -74,7 +75,7 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
setShowConfirmDelete(false)
|
setShowConfirmDelete(false)
|
||||||
}, [app.id])
|
}, [app.id, mutateApps, notify, onPlanInfoChanged, onRefresh, t])
|
||||||
|
|
||||||
const onEdit: CreateAppModalProps['onConfirm'] = useCallback(async ({
|
const onEdit: CreateAppModalProps['onConfirm'] = useCallback(async ({
|
||||||
name,
|
name,
|
||||||
@ -315,9 +316,15 @@ const AppCard = ({ app, onRefresh }: AppCardProps) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='shrink-0 w-5 h-5 flex items-center justify-center'>
|
<div className='shrink-0 w-5 h-5 flex items-center justify-center'>
|
||||||
<Tooltip asChild={false} popupContent={t('app.accessControlDialog.accessItems.anyone')}>
|
{app.accessMode === AccessMode.PUBLIC && <Tooltip asChild={false} popupContent={t('app.accessControlDialog.accessItems.anyone')}>
|
||||||
<RiGlobalLine className='text-text-accent w-4 h-4' />
|
<RiGlobalLine className='text-text-accent w-4 h-4' />
|
||||||
</Tooltip>
|
</Tooltip>}
|
||||||
|
{app.accessMode === AccessMode.SPECIFIC_GROUPS_MEMBERS && <Tooltip asChild={false} popupContent={t('app.accessControlDialog.accessItems.specific')}>
|
||||||
|
<RiLockLine className='text-text-quaternary w-4 h-4' />
|
||||||
|
</Tooltip>}
|
||||||
|
{app.accessMode === AccessMode.ORGANIZATION && <Tooltip asChild={false} popupContent={t('app.accessControlDialog.accessItems.organization')}>
|
||||||
|
<RiBuildingLine className='text-text-quaternary w-4 h-4' />
|
||||||
|
</Tooltip>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='title-wrapper h-[90px] px-[14px] text-xs leading-normal text-text-tertiary'>
|
<div className='title-wrapper h-[90px] px-[14px] text-xs leading-normal text-text-tertiary'>
|
||||||
|
@ -7,6 +7,7 @@ import type {
|
|||||||
WeightedScoreEnum,
|
WeightedScoreEnum,
|
||||||
} from '@/models/datasets'
|
} from '@/models/datasets'
|
||||||
import type { UploadFileSetting } from '@/app/components/workflow/types'
|
import type { UploadFileSetting } from '@/app/components/workflow/types'
|
||||||
|
import type { AccessMode } from '@/models/access-control'
|
||||||
|
|
||||||
export enum Theme {
|
export enum Theme {
|
||||||
light = 'light',
|
light = 'light',
|
||||||
@ -351,6 +352,8 @@ export type App = {
|
|||||||
/** api site url */
|
/** api site url */
|
||||||
api_base_url: string
|
api_base_url: string
|
||||||
tags: Tag[]
|
tags: Tag[]
|
||||||
|
/** access control */
|
||||||
|
accessMode: AccessMode
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AppSSO = {
|
export type AppSSO = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user