diff --git a/web/app/components/workflow/variable-inspect/artifacts-tab.tsx b/web/app/components/workflow/variable-inspect/artifacts-tab.tsx
index b60becf1c5..8274ec3079 100644
--- a/web/app/components/workflow/variable-inspect/artifacts-tab.tsx
+++ b/web/app/components/workflow/variable-inspect/artifacts-tab.tsx
@@ -157,24 +157,22 @@ const ArtifactsTab: FC = () => {
)}
-
diff --git a/web/app/components/workflow/variable-inspect/inspect-layout.tsx b/web/app/components/workflow/variable-inspect/inspect-layout.tsx
new file mode 100644
index 0000000000..08200ab16d
--- /dev/null
+++ b/web/app/components/workflow/variable-inspect/inspect-layout.tsx
@@ -0,0 +1,41 @@
+import type { FC, ReactNode } from 'react'
+import type { InspectTab } from './types'
+import { RiCloseLine } from '@remixicon/react'
+import ActionButton from '@/app/components/base/action-button'
+import TabHeader from './tab-header'
+
+type InspectLayoutProps = {
+ activeTab: InspectTab
+ onTabChange: (tab: InspectTab) => void
+ onClose: () => void
+ headerActions?: ReactNode
+ children: ReactNode
+}
+
+const InspectLayout: FC
= ({
+ activeTab,
+ onTabChange,
+ onClose,
+ headerActions,
+ children,
+}) => {
+ return (
+
+
+
+ {headerActions}
+
+
+
+
+ {children}
+
+
+ )
+}
+
+export default InspectLayout
diff --git a/web/app/components/workflow/variable-inspect/panel.tsx b/web/app/components/workflow/variable-inspect/panel.tsx
index b2c3aafd87..a8878c684a 100644
--- a/web/app/components/workflow/variable-inspect/panel.tsx
+++ b/web/app/components/workflow/variable-inspect/panel.tsx
@@ -1,25 +1,16 @@
import type { FC } from 'react'
-import {
- RiCloseLine,
-} from '@remixicon/react'
import { lazy, Suspense, useCallback, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
-import ActionButton from '@/app/components/base/action-button'
import Button from '@/app/components/base/button'
import Loading from '@/app/components/base/loading'
-import { cn } from '@/utils/classnames'
import useCurrentVars from '../hooks/use-inspect-vars-crud'
import { useStore } from '../store'
+import InspectLayout from './inspect-layout'
import { InspectTab } from './types'
import VariablesTab from './variables-tab'
const ArtifactsTab = lazy(() => import('./artifacts-tab'))
-const TAB_ITEMS = [
- { value: InspectTab.Variables, labelKey: 'debug.variableInspect.tab.variables' },
- { value: InspectTab.Artifacts, labelKey: 'debug.variableInspect.tab.artifacts' },
-] as const
-
const Panel: FC = () => {
const { t } = useTranslation('workflow')
const setShowVariableInspectPanel = useStore(s => s.setShowVariableInspectPanel)
@@ -42,44 +33,28 @@ const Panel: FC = () => {
setShowVariableInspectPanel(false)
}, [setShowVariableInspectPanel])
+ const headerActions = activeTab === InspectTab.Variables && !isVariablesEmpty
+ ? (
+
+ )
+ : undefined
+
return (
-
-
-
- {TAB_ITEMS.map(tab => (
-
- ))}
- {activeTab === InspectTab.Variables && !isVariablesEmpty && (
-
- )}
-
-
-
-
-
-
- {activeTab === InspectTab.Variables && }
- {activeTab === InspectTab.Artifacts && (
-
}>
-
-
- )}
-
-
+
+ {activeTab === InspectTab.Variables && }
+ {activeTab === InspectTab.Artifacts && (
+ }>
+
+
+ )}
+
)
}
diff --git a/web/app/components/workflow/variable-inspect/tab-header.tsx b/web/app/components/workflow/variable-inspect/tab-header.tsx
new file mode 100644
index 0000000000..aaf3b2573b
--- /dev/null
+++ b/web/app/components/workflow/variable-inspect/tab-header.tsx
@@ -0,0 +1,46 @@
+import type { FC, ReactNode } from 'react'
+import { useTranslation } from 'react-i18next'
+import { cn } from '@/utils/classnames'
+import { InspectTab } from './types'
+
+const TAB_ITEMS = [
+ { value: InspectTab.Variables, labelKey: 'debug.variableInspect.tab.variables' },
+ { value: InspectTab.Artifacts, labelKey: 'debug.variableInspect.tab.artifacts' },
+] as const
+
+type TabHeaderProps = {
+ activeTab: InspectTab
+ onTabChange: (tab: InspectTab) => void
+ children?: ReactNode
+}
+
+const TabHeader: FC = ({
+ activeTab,
+ onTabChange,
+ children,
+}) => {
+ const { t } = useTranslation('workflow')
+
+ return (
+
+ {TAB_ITEMS.map(tab => (
+
+ ))}
+ {children}
+
+ )
+}
+
+export default TabHeader
diff --git a/web/app/components/workflow/variable-inspect/variables-tab.tsx b/web/app/components/workflow/variable-inspect/variables-tab.tsx
index d3863eaff5..80e5c7f0ec 100644
--- a/web/app/components/workflow/variable-inspect/variables-tab.tsx
+++ b/web/app/components/workflow/variable-inspect/variables-tab.tsx
@@ -143,7 +143,7 @@ const VariablesTab: FC = () => {
if (isListening) {
return (
-
+
)
@@ -162,18 +162,20 @@ const VariablesTab: FC = () => {
{bottomPanelWidth < 488 && showLeftPanel &&
setShowLeftPanel(false)}>
}