Skip to content

Commit 6e432d4

Browse files
authored
Merge pull request #1708 from alibaba/xlfow-log-enable
fix:xflow,log增加全局禁用参数logPanel.enable
2 parents 750bf69 + 0770393 commit 6e432d4

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

docs/xflow/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ Handle 配置继承自 React Flow 的 Handle 配置,用于控制节点连接
117117

118118
| 属性 | 描述 | 类型 | 默认值 |
119119
| --------- | ------------------- | ----------------------------- | ------ |
120+
| enable | 是否启用日志面板,设置为`false`时全局禁用日志面板 | `boolean` | true |
120121
| logList | 日志面板数据 | Array<[TLogListItem](#tloglistitem)>| |
121122
| loading | 日志面板loading效果 | `boolean` | false |
122123
| logWidget | 自定义日志面板展示 | `string` | |

docs/xflow/log.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ group:
5959

6060
## 节点日志面板
6161

62-
点击有状态的节点,会出现两个面板,左边为节点配置面板,右边为节点日志面板。
62+
点击有状态的节点,会出现两个面板,左边为节点配置面板,右边为节点日志面板。如果不想使用日志面板,可以设置`logPanel.enable`属性为`false`关闭全局日志面板,默认会开启日志面板。
6363

6464
日志面板全局配置参数如下:
6565
```js
@@ -70,6 +70,7 @@ group:
7070
loading, // 日志面板loading
7171
logWidget:'CustomLogPanel'// 自定义日志面板
7272
tabsProps,// 日志面板,详情和追踪选项卡切换组件,antd的tabs配置透传
73+
enable: true, // 是否启用日志面板,默认为true,设置为false时全局禁用日志面板
7374
}}
7475
```
7576
### 内置节点日志面板

packages/x-flow/src/XFlow.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const XFlow: FC<FlowProps> = memo(props => {
8787
);
8888
const { record } = useTemporalStore();
8989
const [activeNode, setActiveNode] = useState<any>(null);
90-
const { settingMap, globalConfig, readOnly } = useContext(ConfigContext);
90+
const { settingMap, globalConfig, readOnly, logPanel } = useContext(ConfigContext);
9191
const [openPanel, setOpenPanel] = useState<boolean>(true);
9292
const [openLogPanel, setOpenLogPanel] = useState<boolean>(true);
9393
const {
@@ -520,7 +520,7 @@ const XFlow: FC<FlowProps> = memo(props => {
520520
{NodeEditorWrap}
521521
</PanelContainer>
522522
)}
523-
{isTruthy(activeNode?._status) && openLogPanel && (
523+
{isTruthy(activeNode?._status) && openLogPanel && Boolean(logPanel?.enable ?? true) && (
524524
<PanelStatusLogContainer
525525
id={activeNode?.id}
526526
nodeType={activeNode?._nodeType}

packages/x-flow/src/components/PanelContainer/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ const Panel: FC<IPanelProps> = (props: IPanelProps) => {
6767

6868
const titleText = activeNode.data?.title;
6969
const descText = activeNode.data?.desc;
70-
70+
7171
const { nodePanel, iconSvg, showTestingBtn } = nodeSetting;
7272
const SVGWidget = widgets[nodeSetting?.iconSvg]
7373
const hideDesc = nodePanel?.hideDesc ?? globalConfig?.nodePanel?.hideDesc ?? false;
74-
const isShowStatusPanel = Boolean(isTruthy(node?._status) && openLogPanel);
74+
const isEnableLogPanel = Boolean(logPanel?.enable ?? true);
75+
const isShowStatusPanel = isEnableLogPanel && Boolean(isTruthy(node?._status) && openLogPanel);
7576
const offsetRightStatus = isNumber(logPanel?.width) ? Number(logPanel?.width + 10) : 410;
76-
77+
7778
const handleTitleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
7879
handleNodeValueChange({ title: e.target.value });
7980
};

packages/x-flow/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export interface TLogPanel {
108108
width?: number;// 日志面板宽度
109109
tabsProps?: TabPaneProps;// 内置日志面板,详情和追踪选项卡切换组件,antd的tabs配置透传
110110
detailLogWidget?: string;// 自定义详情日志面板组件
111+
enable?: boolean;// 是否启用日志面板,默认为true
111112
}
112113

113114
export interface TNodeView {

0 commit comments

Comments
 (0)