From dc655a6c9c08261446d8539cdd56f471733016d5 Mon Sep 17 00:00:00 2001
From: tony.cheng <chengmingwei_1984122@126.com>
Date: Tue, 17 Mar 2026 12:02:37 +0800
Subject: [PATCH] fix: 修复状态控制按钮显示逻辑,解决getControlButtonProps返回null时按钮不显示的问题

---
 web-app/src/components/dashboard/TabContainer.jsx |   85 ++++++++++++++++++++++--------------------
 1 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/web-app/src/components/dashboard/TabContainer.jsx b/web-app/src/components/dashboard/TabContainer.jsx
index a102314..aaf5bc2 100644
--- a/web-app/src/components/dashboard/TabContainer.jsx
+++ b/web-app/src/components/dashboard/TabContainer.jsx
@@ -510,46 +510,51 @@
       </div>
 
       {/* 状态控制按钮区域 */}
-      {shouldShowControlButton() && (
-        <div style={{
-          marginTop: 20,
-          paddingTop: 15,
-          borderTop: '1px solid #e9ecef',
-          display: 'flex',
-          justifyContent: 'center',
-          gap: 12
-        }}>
-          <button
-            onClick={() => handleControlButtonClick(getControlButtonProps().action)}
-            disabled={controlLoading}
-            style={{
-              padding: '10px 20px',
-              borderRadius: 'var(--border-radius)',
-              fontWeight: 600,
-              fontSize: '0.9rem',
-              cursor: controlLoading ? 'not-allowed' : 'pointer',
-              display: 'flex',
-              alignItems: 'center',
-              gap: 6,
-              border: 'none',
-              ...(getControlButtonProps().style === 'terminate' ? {
-                background: '#1A6FB8',
-                color: 'white',
-              } : {
-                background: '#52c41a',
-                color: 'white',
-              }),
-              opacity: controlLoading ? 0.6 : 1,
-            }}
-          >
-            {controlLoading ? (
-              <><i className="fas fa-spinner fa-spin"></i>处理中...</>
-            ) : (
-              <><i className="fas fa-pause-circle"></i>{getControlButtonProps().text}</>
-            )}
-          </button>
-        </div>
-      )}
+      {shouldShowControlButton() && (() => {
+        const buttonProps = getControlButtonProps();
+        if (!buttonProps) return null;
+        
+        return (
+          <div style={{
+            marginTop: 20,
+            paddingTop: 15,
+            borderTop: '1px solid #e9ecef',
+            display: 'flex',
+            justifyContent: 'center',
+            gap: 12
+          }}>
+            <button
+              onClick={() => handleControlButtonClick(buttonProps.action)}
+              disabled={controlLoading}
+              style={{
+                padding: '10px 20px',
+                borderRadius: 'var(--border-radius)',
+                fontWeight: 600,
+                fontSize: '0.9rem',
+                cursor: controlLoading ? 'not-allowed' : 'pointer',
+                display: 'flex',
+                alignItems: 'center',
+                gap: 6,
+                border: 'none',
+                ...(buttonProps.style === 'terminate' ? {
+                  background: '#1A6FB8',
+                  color: 'white',
+                } : {
+                  background: '#52c41a',
+                  color: 'white',
+                }),
+                opacity: controlLoading ? 0.6 : 1,
+              }}
+            >
+              {controlLoading ? (
+                <><i className="fas fa-spinner fa-spin"></i>处理中...</>
+              ) : (
+                <><i className="fas fa-pause-circle"></i>{buttonProps.text}</>
+              )}
+            </button>
+          </div>
+        );
+      })()}
 
       {/* 状态控制确认对话框 */}
       <Modal

--
Gitblit v1.8.0