forked from didi/KnowStreaming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.tsx
More file actions
142 lines (138 loc) · 3.37 KB
/
config.tsx
File metadata and controls
142 lines (138 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import React from 'react';
import { AppContainer, Button, Popconfirm } from 'knowdesign';
import TagsWithHide from '@src/components/TagsWithHide';
import { ClustersPermissionMap } from '../CommonConfig';
import Delete from './Delete';
export const runningStatusEnum: any = {
1: 'Doing',
2: 'Prepare',
3: 'Success',
4: 'Failed',
5: 'Canceled',
};
export const defaultPagination = {
current: 1,
pageSize: 10,
position: 'bottomRight',
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100', '200', '500'],
};
export const getGroupColumns = (arg?: any) => {
const columns = [
{
title: 'ConsumerGroup',
dataIndex: 'name',
key: 'name',
lineClampTwo: true,
render: (v: any, r: any) => {
return (
<a
onClick={() => {
window.location.hash = `groupName=${v || ''}`;
}}
>
{v}
</a>
);
},
width: 200,
},
{
title: '消费的Topic',
dataIndex: 'topicNameList',
key: 'topicNameList',
width: 200,
render(t: any, r: any) {
return t && t.length > 0 ? <TagsWithHide placement="bottom" list={t} expandTagContent={(num: any) => `共有${num}个`} /> : '-';
},
},
{
title: 'Status',
dataIndex: 'state',
key: 'state',
width: 200,
},
{
title: 'Member数',
dataIndex: 'memberCount',
key: 'memberCount',
width: 200,
render: (t: number) => (t ? t.toLocaleString() : '-'),
},
{
title: '操作',
dataIndex: 'options',
key: 'options',
width: 200,
filterTitle: true,
fixed: 'right',
render: (_t: any, r: any) => {
return (
<div>
<Delete record={r} onConfirm={arg?.deleteTesk}></Delete>
</div>
);
},
},
];
return columns;
};
export const getGtoupTopicColumns = (arg?: any) => {
const [global] = AppContainer.useGlobalValue();
const columns: any = [
{
title: 'Topic名称',
dataIndex: 'topicName',
key: 'topicName',
needTooltip: true,
lineClampOne: true,
width: 150,
},
{
title: 'Status',
dataIndex: 'state',
key: 'state',
width: 150,
},
{
title: 'Max Lag',
dataIndex: 'maxLag',
key: 'maxLag',
width: 150,
render: (t: number) => (t ? t.toLocaleString() : '-'),
},
{
title: 'Member数',
dataIndex: 'memberCount',
key: 'memberCount',
width: 150,
render: (t: number) => (t ? t.toLocaleString() : '-'),
},
];
if (global.hasPermission && global.hasPermission(ClustersPermissionMap.CONSUMERS_RESET_OFFSET)) {
columns.push({
title: '操作',
dataIndex: 'desc',
key: 'desc',
width: 200,
render: (value: any, record: any) => {
return (
<div>
<a onClick={() => arg.resetOffset(record)}>重置Offset</a>
<Popconfirm
placement="top"
title={`是否要删除当前Topic?`}
onConfirm={() => arg.deleteOffset(record)}
okText="是"
cancelText="否"
>
<Button type="link">删除</Button>
</Popconfirm>
</div>
);
},
});
}
return columns;
};