fix: 修复状态控制按钮显示逻辑,解决getControlButtonProps返回null时按钮不显示的问题
1 files modified
15 ■■■■■ changed files
web-app/src/components/dashboard/TabContainer.jsx 15 ●●●●● patch | view | raw | blame | history
web-app/src/components/dashboard/TabContainer.jsx
@@ -510,7 +510,11 @@
      </div>
      {/* 状态控制按钮区域 */}
      {shouldShowControlButton() && (
      {shouldShowControlButton() && (() => {
        const buttonProps = getControlButtonProps();
        if (!buttonProps) return null;
        return (
        <div style={{
          marginTop: 20,
          paddingTop: 15,
@@ -520,7 +524,7 @@
          gap: 12
        }}>
          <button
            onClick={() => handleControlButtonClick(getControlButtonProps().action)}
              onClick={() => handleControlButtonClick(buttonProps.action)}
            disabled={controlLoading}
            style={{
              padding: '10px 20px',
@@ -532,7 +536,7 @@
              alignItems: 'center',
              gap: 6,
              border: 'none',
              ...(getControlButtonProps().style === 'terminate' ? {
                ...(buttonProps.style === 'terminate' ? {
                background: '#1A6FB8',
                color: 'white',
              } : {
@@ -545,11 +549,12 @@
            {controlLoading ? (
              <><i className="fas fa-spinner fa-spin"></i>处理中...</>
            ) : (
              <><i className="fas fa-pause-circle"></i>{getControlButtonProps().text}</>
                <><i className="fas fa-pause-circle"></i>{buttonProps.text}</>
            )}
          </button>
        </div>
      )}
        );
      })()}
      {/* 状态控制确认对话框 */}
      <Modal