mirror of
https://github.com/langgenius/dify.git
synced 2026-04-26 21:55:58 +08:00
feat: migration classical to sandbox engineer
This commit is contained in:
@ -13,10 +13,12 @@ import {
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import { FeaturesProvider } from '@/app/components/base/features'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
|
||||
import PlanUpgradeModal from '@/app/components/billing/plan-upgrade-modal'
|
||||
import WorkflowWithDefaultContext from '@/app/components/workflow'
|
||||
import { useCollaboration } from '@/app/components/workflow/collaboration'
|
||||
import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'
|
||||
@ -170,6 +172,9 @@ const WorkflowAppWithAdditionalContext = () => {
|
||||
} = useWorkflowInit()
|
||||
const workflowStore = useWorkflowStore()
|
||||
const { isLoadingCurrentWorkspace, currentWorkspace } = useAppContext()
|
||||
const { t } = useTranslation()
|
||||
const [showMigrationModal, setShowMigrationModal] = useState(false)
|
||||
const lastCheckedAppIdRef = useRef<string | null>(null)
|
||||
|
||||
// Initialize trigger status at application level
|
||||
const { setTriggerStatuses } = useTriggerStatusStore()
|
||||
@ -291,6 +296,17 @@ const WorkflowAppWithAdditionalContext = () => {
|
||||
}, [replayRunId, workflowStore, getWorkflowRunAndTraceUrl])
|
||||
|
||||
const isDataReady = !(!data || isLoading || isLoadingCurrentWorkspace || !currentWorkspace.id)
|
||||
const sandboxEnabled = data?.features?.sandbox?.enabled === true
|
||||
|
||||
useEffect(() => {
|
||||
if (!isDataReady || !appId)
|
||||
return
|
||||
if (lastCheckedAppIdRef.current !== appId) {
|
||||
lastCheckedAppIdRef.current = appId
|
||||
// eslint-disable-next-line react-hooks-extra/no-direct-set-state-in-use-effect
|
||||
setShowMigrationModal(!sandboxEnabled)
|
||||
}
|
||||
}, [appId, isDataReady, sandboxEnabled])
|
||||
const renderGraph = useCallback((headerLeftSlot: ReactNode) => {
|
||||
if (!isDataReady)
|
||||
return null
|
||||
@ -344,6 +360,12 @@ const WorkflowAppWithAdditionalContext = () => {
|
||||
return (
|
||||
<>
|
||||
<CollaborationSession />
|
||||
<PlanUpgradeModal
|
||||
show={showMigrationModal}
|
||||
onClose={() => setShowMigrationModal(false)}
|
||||
title={t('sandboxMigrationModal.title', { ns: 'workflow' })}
|
||||
description={t('sandboxMigrationModal.description', { ns: 'workflow' })}
|
||||
/>
|
||||
<WorkflowWithDefaultContext
|
||||
edges={edgesData}
|
||||
nodes={nodesData}
|
||||
|
||||
@ -1054,6 +1054,8 @@
|
||||
"publishLimit.startNodeDesc": "You’ve reached the limit of 2 triggers per workflow for this plan. Upgrade to publish this workflow.",
|
||||
"publishLimit.startNodeTitlePrefix": "Upgrade to",
|
||||
"publishLimit.startNodeTitleSuffix": "unlock unlimited triggers per workflow",
|
||||
"sandboxMigrationModal.description": "This will create a separate copy of your app, without affecting the original.",
|
||||
"sandboxMigrationModal.title": "Upgrade to filesystem-based agents",
|
||||
"sidebar.exportWarning": "Export Current Saved Version",
|
||||
"sidebar.exportWarningDesc": "This will export the current saved version of your workflow. If you have unsaved changes in the editor, please save them first by using the export option in the workflow canvas.",
|
||||
"singleRun.back": "Back",
|
||||
|
||||
@ -1046,6 +1046,8 @@
|
||||
"publishLimit.startNodeDesc": "您已达到此计划上每个工作流最多 2 个触发器的限制。请升级后再发布此工作流。",
|
||||
"publishLimit.startNodeTitlePrefix": "升级以",
|
||||
"publishLimit.startNodeTitleSuffix": "解锁每个工作流无限制的触发器",
|
||||
"sandboxMigrationModal.description": "这将创建你的应用的一个独立副本,不会影响原应用。",
|
||||
"sandboxMigrationModal.title": "升级到基于文件系统的智能体",
|
||||
"sidebar.exportWarning": "导出当前已保存版本",
|
||||
"sidebar.exportWarningDesc": "这将导出您工作流的当前已保存版本。如果您在编辑器中有未保存的更改,请先使用工作流画布中的导出选项保存它们。",
|
||||
"singleRun.back": "返回",
|
||||
|
||||
@ -1024,6 +1024,8 @@
|
||||
"publishLimit.startNodeDesc": "目前方案最多允許 2 個開始節點,升級後才能發布此工作流程。",
|
||||
"publishLimit.startNodeTitlePrefix": "升級以",
|
||||
"publishLimit.startNodeTitleSuffix": "解鎖無限開始節點",
|
||||
"sandboxMigrationModal.description": "這將建立您的應用程式的獨立副本,不會影響原應用程式。",
|
||||
"sandboxMigrationModal.title": "升級到基於檔案系統的智能體",
|
||||
"sidebar.exportWarning": "導出當前保存的版本",
|
||||
"sidebar.exportWarningDesc": "這將導出當前保存的工作流程版本。如果您在編輯器中有未保存的更改,請先通過使用工作流程畫布中的導出選項來保存它們。",
|
||||
"singleRun.back": "返回",
|
||||
|
||||
Reference in New Issue
Block a user