mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-31 10:35:04 +08:00

Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
427 lines
15 KiB
TypeScript
427 lines
15 KiB
TypeScript
'use client'
|
|
|
|
import { useContext, useContextSelector } from 'use-context-selector'
|
|
import { useRouter } from 'next/navigation'
|
|
import { useCallback, useEffect, useState } from 'react'
|
|
import { useTranslation } from 'react-i18next'
|
|
import { RiMoreFill } from '@remixicon/react'
|
|
import s from './style.module.css'
|
|
import cn from '@/utils/classnames'
|
|
import type { App } from '@/types/app'
|
|
import Confirm from '@/app/components/base/confirm'
|
|
import Toast, { ToastContext } from '@/app/components/base/toast'
|
|
import { copyApp, deleteApp, exportAppConfig, updateAppInfo } from '@/service/apps'
|
|
import DuplicateAppModal from '@/app/components/app/duplicate-modal'
|
|
import type { DuplicateAppModalProps } from '@/app/components/app/duplicate-modal'
|
|
import AppIcon from '@/app/components/base/app-icon'
|
|
import AppsContext, { useAppContext } from '@/context/app-context'
|
|
import type { HtmlContentProps } from '@/app/components/base/popover'
|
|
import CustomPopover from '@/app/components/base/popover'
|
|
import Divider from '@/app/components/base/divider'
|
|
import { getRedirection } from '@/utils/app-redirection'
|
|
import { useProviderContext } from '@/context/provider-context'
|
|
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
|
|
import type { CreateAppModalProps } from '@/app/components/explore/create-app-modal'
|
|
import EditAppModal from '@/app/components/explore/create-app-modal'
|
|
import SwitchAppModal from '@/app/components/app/switch-app-modal'
|
|
import type { Tag } from '@/app/components/base/tag-management/constant'
|
|
import TagSelector from '@/app/components/base/tag-management/selector'
|
|
import type { EnvironmentVariable } from '@/app/components/workflow/types'
|
|
import DSLExportConfirmModal from '@/app/components/workflow/dsl-export-confirm-modal'
|
|
import { fetchWorkflowDraft } from '@/service/workflow'
|
|
import { fetchInstalledAppList } from '@/service/explore'
|
|
import { AppTypeIcon } from '@/app/components/app/type-selector'
|
|
|
|
export type AppCardProps = {
|
|
app: App
|
|
onRefresh?: () => void
|
|
}
|
|
|
|
const AppCard = ({ app, onRefresh }: AppCardProps) => {
|
|
const { t } = useTranslation()
|
|
const { notify } = useContext(ToastContext)
|
|
const { isCurrentWorkspaceEditor } = useAppContext()
|
|
const { onPlanInfoChanged } = useProviderContext()
|
|
const { push } = useRouter()
|
|
|
|
const mutateApps = useContextSelector(
|
|
AppsContext,
|
|
state => state.mutateApps,
|
|
)
|
|
|
|
const [showEditModal, setShowEditModal] = useState(false)
|
|
const [showDuplicateModal, setShowDuplicateModal] = useState(false)
|
|
const [showSwitchModal, setShowSwitchModal] = useState<boolean>(false)
|
|
const [showConfirmDelete, setShowConfirmDelete] = useState(false)
|
|
const [secretEnvList, setSecretEnvList] = useState<EnvironmentVariable[]>([])
|
|
|
|
const onConfirmDelete = useCallback(async () => {
|
|
try {
|
|
await deleteApp(app.id)
|
|
notify({ type: 'success', message: t('app.appDeleted') })
|
|
if (onRefresh)
|
|
onRefresh()
|
|
mutateApps()
|
|
onPlanInfoChanged()
|
|
}
|
|
catch (e: any) {
|
|
notify({
|
|
type: 'error',
|
|
message: `${t('app.appDeleteFailed')}${'message' in e ? `: ${e.message}` : ''}`,
|
|
})
|
|
}
|
|
setShowConfirmDelete(false)
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [app.id])
|
|
|
|
const onEdit: CreateAppModalProps['onConfirm'] = useCallback(async ({
|
|
name,
|
|
icon_type,
|
|
icon,
|
|
icon_background,
|
|
description,
|
|
use_icon_as_answer_icon,
|
|
}) => {
|
|
try {
|
|
await updateAppInfo({
|
|
appID: app.id,
|
|
name,
|
|
icon_type,
|
|
icon,
|
|
icon_background,
|
|
description,
|
|
use_icon_as_answer_icon,
|
|
})
|
|
setShowEditModal(false)
|
|
notify({
|
|
type: 'success',
|
|
message: t('app.editDone'),
|
|
})
|
|
if (onRefresh)
|
|
onRefresh()
|
|
mutateApps()
|
|
}
|
|
catch {
|
|
notify({ type: 'error', message: t('app.editFailed') })
|
|
}
|
|
}, [app.id, mutateApps, notify, onRefresh, t])
|
|
|
|
const onCopy: DuplicateAppModalProps['onConfirm'] = async ({ name, icon_type, icon, icon_background }) => {
|
|
try {
|
|
const newApp = await copyApp({
|
|
appID: app.id,
|
|
name,
|
|
icon_type,
|
|
icon,
|
|
icon_background,
|
|
mode: app.mode,
|
|
})
|
|
setShowDuplicateModal(false)
|
|
notify({
|
|
type: 'success',
|
|
message: t('app.newApp.appCreated'),
|
|
})
|
|
localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1')
|
|
if (onRefresh)
|
|
onRefresh()
|
|
mutateApps()
|
|
onPlanInfoChanged()
|
|
getRedirection(isCurrentWorkspaceEditor, newApp, push)
|
|
}
|
|
catch {
|
|
notify({ type: 'error', message: t('app.newApp.appCreateFailed') })
|
|
}
|
|
}
|
|
|
|
const onExport = async (include = false) => {
|
|
try {
|
|
const { data } = await exportAppConfig({
|
|
appID: app.id,
|
|
include,
|
|
})
|
|
const a = document.createElement('a')
|
|
const file = new Blob([data], { type: 'application/yaml' })
|
|
a.href = URL.createObjectURL(file)
|
|
a.download = `${app.name}.yml`
|
|
a.click()
|
|
}
|
|
catch {
|
|
notify({ type: 'error', message: t('app.exportFailed') })
|
|
}
|
|
}
|
|
|
|
const exportCheck = async () => {
|
|
if (app.mode !== 'workflow' && app.mode !== 'advanced-chat') {
|
|
onExport()
|
|
return
|
|
}
|
|
try {
|
|
const workflowDraft = await fetchWorkflowDraft(`/apps/${app.id}/workflows/draft`)
|
|
const list = (workflowDraft.environment_variables || []).filter(env => env.value_type === 'secret')
|
|
if (list.length === 0) {
|
|
onExport()
|
|
return
|
|
}
|
|
setSecretEnvList(list)
|
|
}
|
|
catch {
|
|
notify({ type: 'error', message: t('app.exportFailed') })
|
|
}
|
|
}
|
|
|
|
const onSwitch = () => {
|
|
if (onRefresh)
|
|
onRefresh()
|
|
mutateApps()
|
|
setShowSwitchModal(false)
|
|
}
|
|
|
|
const Operations = (props: HtmlContentProps) => {
|
|
const onMouseLeave = async () => {
|
|
props.onClose?.()
|
|
}
|
|
const onClickSettings = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
e.stopPropagation()
|
|
props.onClick?.()
|
|
e.preventDefault()
|
|
setShowEditModal(true)
|
|
}
|
|
const onClickDuplicate = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
e.stopPropagation()
|
|
props.onClick?.()
|
|
e.preventDefault()
|
|
setShowDuplicateModal(true)
|
|
}
|
|
const onClickExport = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
e.stopPropagation()
|
|
props.onClick?.()
|
|
e.preventDefault()
|
|
exportCheck()
|
|
}
|
|
const onClickSwitch = async (e: React.MouseEvent<HTMLDivElement>) => {
|
|
e.stopPropagation()
|
|
props.onClick?.()
|
|
e.preventDefault()
|
|
setShowSwitchModal(true)
|
|
}
|
|
const onClickDelete = async (e: React.MouseEvent<HTMLDivElement>) => {
|
|
e.stopPropagation()
|
|
props.onClick?.()
|
|
e.preventDefault()
|
|
setShowConfirmDelete(true)
|
|
}
|
|
const onClickInstalledApp = async (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
e.stopPropagation()
|
|
props.onClick?.()
|
|
e.preventDefault()
|
|
try {
|
|
const { installed_apps }: any = await fetchInstalledAppList(app.id) || {}
|
|
if (installed_apps?.length > 0)
|
|
window.open(`/explore/installed/${installed_apps[0].id}`, '_blank')
|
|
else
|
|
throw new Error('No app found in Explore')
|
|
}
|
|
catch (e: any) {
|
|
Toast.notify({ type: 'error', message: `${e.message || e}` })
|
|
}
|
|
}
|
|
return (
|
|
<div className="relative w-full py-1" onMouseLeave={onMouseLeave}>
|
|
<button className={s.actionItem} onClick={onClickSettings}>
|
|
<span className={s.actionName}>{t('app.editApp')}</span>
|
|
</button>
|
|
<Divider className="!my-1" />
|
|
<button className={s.actionItem} onClick={onClickDuplicate}>
|
|
<span className={s.actionName}>{t('app.duplicate')}</span>
|
|
</button>
|
|
<button className={s.actionItem} onClick={onClickExport}>
|
|
<span className={s.actionName}>{t('app.export')}</span>
|
|
</button>
|
|
{(app.mode === 'completion' || app.mode === 'chat') && (
|
|
<>
|
|
<Divider className="!my-1" />
|
|
<div
|
|
className='h-9 py-2 px-3 mx-1 flex items-center hover:bg-gray-50 rounded-lg cursor-pointer'
|
|
onClick={onClickSwitch}
|
|
>
|
|
<span className='text-gray-700 text-sm leading-5'>{t('app.switch')}</span>
|
|
</div>
|
|
</>
|
|
)}
|
|
<Divider className="!my-1" />
|
|
<button className={s.actionItem} onClick={onClickInstalledApp}>
|
|
<span className={s.actionName}>{t('app.openInExplore')}</span>
|
|
</button>
|
|
<Divider className="!my-1" />
|
|
<div
|
|
className={cn(s.actionItem, s.deleteActionItem, 'group')}
|
|
onClick={onClickDelete}
|
|
>
|
|
<span className={cn(s.actionName, 'group-hover:text-red-500')}>
|
|
{t('common.operation.delete')}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const [tags, setTags] = useState<Tag[]>(app.tags)
|
|
useEffect(() => {
|
|
setTags(app.tags)
|
|
}, [app.tags])
|
|
|
|
return (
|
|
<>
|
|
<div
|
|
onClick={(e) => {
|
|
e.preventDefault()
|
|
getRedirection(isCurrentWorkspaceEditor, app, push)
|
|
}}
|
|
className='relative h-[160px] group col-span-1 bg-components-card-bg border-[1px] border-solid border-components-card-border rounded-xl shadow-sm inline-flex flex-col transition-all duration-200 ease-in-out cursor-pointer hover:shadow-lg'
|
|
>
|
|
<div className='flex pt-[14px] px-[14px] pb-3 h-[66px] items-center gap-3 grow-0 shrink-0'>
|
|
<div className='relative shrink-0'>
|
|
<AppIcon
|
|
size="large"
|
|
iconType={app.icon_type}
|
|
icon={app.icon}
|
|
background={app.icon_background}
|
|
imageUrl={app.icon_url}
|
|
/>
|
|
<AppTypeIcon type={app.mode} wrapperClassName='absolute -bottom-0.5 -right-0.5 w-4 h-4 shadow-sm' className='w-3 h-3' />
|
|
</div>
|
|
<div className='grow w-0 py-[1px]'>
|
|
<div className='flex items-center text-sm leading-5 font-semibold text-text-secondary'>
|
|
<div className='truncate' title={app.name}>{app.name}</div>
|
|
</div>
|
|
<div className='flex items-center text-[10px] leading-[18px] text-text-tertiary font-medium'>
|
|
{app.mode === 'advanced-chat' && <div className='truncate'>{t('app.types.advanced').toUpperCase()}</div>}
|
|
{app.mode === 'chat' && <div className='truncate'>{t('app.types.chatbot').toUpperCase()}</div>}
|
|
{app.mode === 'agent-chat' && <div className='truncate'>{t('app.types.agent').toUpperCase()}</div>}
|
|
{app.mode === 'workflow' && <div className='truncate'>{t('app.types.workflow').toUpperCase()}</div>}
|
|
{app.mode === 'completion' && <div className='truncate'>{t('app.types.completion').toUpperCase()}</div>}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className='title-wrapper h-[90px] px-[14px] text-xs leading-normal text-text-tertiary'>
|
|
<div
|
|
className={cn(tags.length ? 'line-clamp-2' : 'line-clamp-4', 'group-hover:line-clamp-2')}
|
|
title={app.description}
|
|
>
|
|
{app.description}
|
|
</div>
|
|
</div>
|
|
<div className={cn(
|
|
'absolute bottom-1 left-0 right-0 items-center shrink-0 pt-1 pl-[14px] pr-[6px] pb-[6px] h-[42px]',
|
|
tags.length ? 'flex' : '!hidden group-hover:!flex',
|
|
)}>
|
|
{isCurrentWorkspaceEditor && (
|
|
<>
|
|
<div className={cn('grow flex items-center gap-1 w-0')} onClick={(e) => {
|
|
e.stopPropagation()
|
|
e.preventDefault()
|
|
}}>
|
|
<div className={cn(
|
|
'group-hover:!block group-hover:!mr-0 mr-[41px] grow w-full',
|
|
tags.length ? '!block' : '!hidden',
|
|
)}>
|
|
<TagSelector
|
|
position='bl'
|
|
type='app'
|
|
targetID={app.id}
|
|
value={tags.map(tag => tag.id)}
|
|
selectedTags={tags}
|
|
onCacheUpdate={setTags}
|
|
onChange={onRefresh}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className='!hidden group-hover:!flex shrink-0 mx-1 w-[1px] h-[14px]' />
|
|
<div className='!hidden group-hover:!flex shrink-0'>
|
|
<CustomPopover
|
|
htmlContent={<Operations />}
|
|
position="br"
|
|
trigger="click"
|
|
btnElement={
|
|
<div
|
|
className='flex items-center justify-center w-8 h-8 cursor-pointer rounded-md'
|
|
>
|
|
<RiMoreFill className='w-4 h-4 text-text-tertiary' />
|
|
</div>
|
|
}
|
|
btnClassName={open =>
|
|
cn(
|
|
open ? '!bg-black/5 !shadow-none' : '!bg-transparent',
|
|
'h-8 w-8 !p-2 rounded-md border-none hover:!bg-black/5',
|
|
)
|
|
}
|
|
popupClassName={
|
|
(app.mode === 'completion' || app.mode === 'chat')
|
|
? '!w-[256px] translate-x-[-224px]'
|
|
: '!w-[160px] translate-x-[-128px]'
|
|
}
|
|
className={'h-fit !z-20'}
|
|
/>
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{showEditModal && (
|
|
<EditAppModal
|
|
isEditModal
|
|
appName={app.name}
|
|
appIconType={app.icon_type}
|
|
appIcon={app.icon}
|
|
appIconBackground={app.icon_background}
|
|
appIconUrl={app.icon_url}
|
|
appDescription={app.description}
|
|
appMode={app.mode}
|
|
appUseIconAsAnswerIcon={app.use_icon_as_answer_icon}
|
|
show={showEditModal}
|
|
onConfirm={onEdit}
|
|
onHide={() => setShowEditModal(false)}
|
|
/>
|
|
)}
|
|
{showDuplicateModal && (
|
|
<DuplicateAppModal
|
|
appName={app.name}
|
|
icon_type={app.icon_type}
|
|
icon={app.icon}
|
|
icon_background={app.icon_background}
|
|
icon_url={app.icon_url}
|
|
show={showDuplicateModal}
|
|
onConfirm={onCopy}
|
|
onHide={() => setShowDuplicateModal(false)}
|
|
/>
|
|
)}
|
|
{showSwitchModal && (
|
|
<SwitchAppModal
|
|
show={showSwitchModal}
|
|
appDetail={app}
|
|
onClose={() => setShowSwitchModal(false)}
|
|
onSuccess={onSwitch}
|
|
/>
|
|
)}
|
|
{showConfirmDelete && (
|
|
<Confirm
|
|
title={t('app.deleteAppConfirmTitle')}
|
|
content={t('app.deleteAppConfirmContent')}
|
|
isShow={showConfirmDelete}
|
|
onConfirm={onConfirmDelete}
|
|
onCancel={() => setShowConfirmDelete(false)}
|
|
/>
|
|
)}
|
|
{secretEnvList.length > 0 && (
|
|
<DSLExportConfirmModal
|
|
envList={secretEnvList}
|
|
onConfirm={onExport}
|
|
onClose={() => setSecretEnvList([])}
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default AppCard
|