|
1 | 1 | import XFlow from '@xrenders/xflow'; |
2 | 2 | import React,{ useState } from 'react'; |
3 | 3 | import settings from './setting'; |
| 4 | +import { Button } from 'antd'; |
| 5 | +import CustomGroupTitle from './CustomGroupTittle'; |
| 6 | +import DetailLogWidget from './DetailLogWidget'; |
4 | 7 |
|
5 | 8 | export default () => { |
6 | 9 | const [logList, setLogList] = useState<any>([ |
7 | 10 | { |
8 | | - nodeId:'mcelcsg6pinydoy7', |
| 11 | + nodeId: 'mcelcsg6pinydoy7', |
| 12 | + groupTitle:"日志分组1", |
9 | 13 | statusPanel: { |
10 | 14 | status: [ |
11 | 15 | { |
@@ -36,8 +40,120 @@ export default () => { |
36 | 40 | }, |
37 | 41 | ], |
38 | 42 | }, |
| 43 | + { |
| 44 | + nodeId: 'mcelcsg6pinydoy7', |
| 45 | + groupTitle: "customGroupTitle",// 自定义分组标题组件 |
| 46 | + statusPanel: { |
| 47 | + status: [ |
| 48 | + { |
| 49 | + label: '状态', |
| 50 | + isBadge: true, |
| 51 | + // value:"失败" |
| 52 | + }, |
| 53 | + { |
| 54 | + label: '执行时间', |
| 55 | + value: '0.01s', |
| 56 | + }, |
| 57 | + { |
| 58 | + label: '总token数', |
| 59 | + value: '0tokens', |
| 60 | + }, |
| 61 | + ], |
| 62 | + // extra: <span>哈哈哈哈哈哈哈哈</span>, |
| 63 | + extra: '测试测试', |
| 64 | + }, |
| 65 | + codePanel: [ |
| 66 | + { |
| 67 | + title: '输出数据', |
| 68 | + code: "{'target_language':'english','query':'string'}", |
| 69 | + }, |
| 70 | + { |
| 71 | + title: '报错信息', |
| 72 | + code: "{'target_language':'english','query':'string'}", |
| 73 | + }, |
| 74 | + ], |
| 75 | + }, |
| 76 | + { |
| 77 | + nodeId: 'w4be9edh4bhdlokm', |
| 78 | + statusPanel: { |
| 79 | + status: [ |
| 80 | + { |
| 81 | + label: '状态', |
| 82 | + isBadge: true, |
| 83 | + // value:"失败" |
| 84 | + }, |
| 85 | + { |
| 86 | + label: '执行时间', |
| 87 | + value: '0.01s', |
| 88 | + }, |
| 89 | + { |
| 90 | + label: '总token数', |
| 91 | + value: '0tokens', |
| 92 | + }, |
| 93 | + ], |
| 94 | + // extra: <span>哈哈 |
| 95 | + // 哈哈哈哈哈哈</span>, |
| 96 | + extra: '测试测试', |
| 97 | + }, |
| 98 | + codePanel: [ |
| 99 | + { |
| 100 | + title: '输出数据', |
| 101 | + code: "{'target_language':'english','query':'string'}", |
| 102 | + }, |
| 103 | + { |
| 104 | + title: '报错信息', |
| 105 | + code: "{'target_language':'english','query':'string'}", |
| 106 | + }, |
| 107 | + ], |
| 108 | + showDetailLogWidget:false,// 是否展示自定义详情tab组件 |
| 109 | + }, |
| 110 | + { |
| 111 | + nodeId: '4m9tee00n819nyyy', |
| 112 | + statusPanel: { |
| 113 | + status: [ |
| 114 | + { |
| 115 | + label: '状态', |
| 116 | + isBadge: true, |
| 117 | + // value:"失败" |
| 118 | + }, |
| 119 | + { |
| 120 | + label: '执行时间', |
| 121 | + value: '0.01s', |
| 122 | + }, |
| 123 | + { |
| 124 | + label: '总token数', |
| 125 | + value: '0tokens', |
| 126 | + }, |
| 127 | + ], |
| 128 | + extra: '测试测试', |
| 129 | + }, |
| 130 | + showDetailLogWidget: false,// 是否展示自定义详情tab组件 |
| 131 | + }, |
| 132 | + { |
| 133 | + nodeId: '3qloq2p1x3wcwbzg', |
| 134 | + statusPanel: { |
| 135 | + status: [ |
| 136 | + { |
| 137 | + label: '状态', |
| 138 | + isBadge: true, |
| 139 | + // value:"失败" |
| 140 | + }, |
| 141 | + { |
| 142 | + label: '执行时间', |
| 143 | + value: '0.01s', |
| 144 | + }, |
| 145 | + { |
| 146 | + label: '总token数', |
| 147 | + value: '0tokens', |
| 148 | + }, |
| 149 | + ], |
| 150 | + extra: '测试测试', |
| 151 | + }, |
| 152 | + showDetailLogWidget: false,// 是否展示自定义详情tab组件 |
| 153 | + } |
39 | 154 | ]); |
40 | 155 | const [loading, setLoading] = useState<boolean>(false); |
| 156 | + const [activeKey, setActiveKey] = useState<string>('detail'); |
41 | 157 | const nodes = [ |
42 | 158 | { |
43 | 159 | id: 'mcelcsg6pinydoy7', |
@@ -156,10 +272,21 @@ export default () => { |
156 | 272 | nodeSelector={{ |
157 | 273 | showSearch: true, |
158 | 274 | }} |
| 275 | + widgets={{ |
| 276 | + customGroupTitle: CustomGroupTitle, |
| 277 | + DetailLogWidget |
| 278 | + }} |
159 | 279 | logPanel={{ |
160 | 280 | // 日志面板 |
161 | 281 | logList, // 日志面板接受的数据 |
162 | 282 | loading, // 日志面板loading |
| 283 | + tabsProps: { |
| 284 | + tabBarExtraContent:activeKey === 'detail' ? <Button type='primary' size='small'>自定义按钮</Button> : null, |
| 285 | + onChange: (activeKey)=>{ |
| 286 | + setActiveKey(activeKey); |
| 287 | + }, |
| 288 | + }, |
| 289 | + detailLogWidget: 'DetailLogWidget',//自定义详情tab组件 |
163 | 290 | }} |
164 | 291 | globalConfig={{ |
165 | 292 | nodeView: { |
|
0 commit comments