Skip to content

Commit b3b8889

Browse files
authored
Merge pull request #251 from lucasun/master
v2.4.0
2 parents 324b37b + 01c5de6 commit b3b8889

File tree

36 files changed

+751
-163
lines changed

36 files changed

+751
-163
lines changed

kafka-manager-console/src/component/flow-table/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export class StatusGraghCom<T extends IFlowInfo> extends React.Component {
6868
public render() {
6969
const statusData = this.getData();
7070
const loading = this.getLoading();
71-
if (!statusData) return null;
7271
const data: any[] = [];
72+
if (!statusData) return <Table columns={flowColumns} dataSource={data} />;
7373
Object.keys(statusData).map((key) => {
7474
if (statusData[key]) {
7575
const v = key === 'byteIn' || key === 'byteOut' ? statusData[key].map(i => i && (i / 1024).toFixed(2)) :
@@ -85,7 +85,7 @@ export class StatusGraghCom<T extends IFlowInfo> extends React.Component {
8585
}
8686
});
8787
return (
88-
<Table columns={flowColumns} dataSource={data} pagination={false} loading={loading}/>
88+
<Table columns={flowColumns} dataSource={data} pagination={false} loading={loading} />
8989
);
9090
}
9191
}

kafka-manager-console/src/component/x-form/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.ant-input-number {
1+
.ant-input-number, .ant-form-item-children .ant-select {
22
width: 314px
33
}
44

kafka-manager-console/src/constants/left-menu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export const adminMenu = [{
5959
href: `/admin/bill`,
6060
i: 'k-icon-renwuliebiao',
6161
title: '用户账单',
62+
},{
63+
href: `/admin/operation-record`,
64+
i: 'k-icon-operationrecord',
65+
title: '操作记录',
6266
}] as ILeftMenu[];
6367

6468
export const expertMenu = [{

kafka-manager-console/src/container/admin/cluster-detail/cluster-topic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class ClusterTopic extends SearchAndFilterContainer {
172172
key: 'appName',
173173
// width: '10%',
174174
render: (val: string, record: IClusterTopics) => (
175-
<Tooltip placement="bottomLeft" title={record.appId} >
175+
<Tooltip placement="bottomLeft" title={val} >
176176
{val}
177177
</Tooltip>
178178
),

kafka-manager-console/src/container/admin/cluster-detail/exclusive-cluster.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,7 @@ export class ExclusiveCluster extends SearchAndFilterContainer {
314314
>
315315
<div className="region-prompt">
316316
<span>
317-
由于该Region已被逻辑集群【 {this.state.logicalClusterName} 】使用
318-
请先解除Region与逻辑集群的关系
317+
该Region已被逻辑集群【 {this.state.logicalClusterName} 】使用,请先解除Region与逻辑集群的关系
319318
</span>
320319
</div>
321320
</Modal>

kafka-manager-console/src/container/admin/cluster-detail/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
.traffic-table {
1818
margin: 10px 0;
19-
min-height: 450px;
19+
min-height: 330px;
2020
.traffic-header {
2121
width: 100%;
2222
height: 44px;

kafka-manager-console/src/container/admin/cluster-list/index.tsx

Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { wrapper } from 'store';
44
import { observer } from 'mobx-react';
55
import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type';
66
import { admin } from 'store/admin';
7+
import { users } from 'store/users';
78
import { registerCluster, createCluster, pauseMonitoring } from 'lib/api';
89
import { SearchAndFilterContainer } from 'container/search-filter';
910
import { cluster } from 'store/cluster';
@@ -78,34 +79,34 @@ export class ClusterList extends SearchAndFilterContainer {
7879
disabled: item ? true : false,
7980
},
8081
},
81-
{
82-
key: 'idc',
83-
label: '数据中心',
84-
defaultValue: region.regionName,
85-
rules: [{ required: true, message: '请输入数据中心' }],
86-
attrs: {
87-
placeholder: '请输入数据中心',
88-
disabled: true,
89-
},
90-
},
91-
{
92-
key: 'mode',
93-
label: '集群类型',
94-
type: 'select',
95-
options: cluster.clusterModes.map(ele => {
96-
return {
97-
label: ele.message,
98-
value: ele.code,
99-
};
100-
}),
101-
rules: [{
102-
required: true,
103-
message: '请选择集群类型',
104-
}],
105-
attrs: {
106-
placeholder: '请选择集群类型',
107-
},
108-
},
82+
// {
83+
// key: 'idc',
84+
// label: '数据中心',
85+
// defaultValue: region.regionName,
86+
// rules: [{ required: true, message: '请输入数据中心' }],
87+
// attrs: {
88+
// placeholder: '请输入数据中心',
89+
// disabled: true,
90+
// },
91+
// },
92+
// {
93+
// key: 'mode',
94+
// label: '集群类型',
95+
// type: 'select',
96+
// options: cluster.clusterModes.map(ele => {
97+
// return {
98+
// label: ele.message,
99+
// value: ele.code,
100+
// };
101+
// }),
102+
// rules: [{
103+
// required: true,
104+
// message: '请选择集群类型',
105+
// }],
106+
// attrs: {
107+
// placeholder: '请选择集群类型',
108+
// },
109+
// },
109110
{
110111
key: 'kafkaVersion',
111112
label: 'kafka版本',
@@ -148,7 +149,7 @@ export class ClusterList extends SearchAndFilterContainer {
148149
attrs: {
149150
placeholder: `请输入JMX认证,例如:
150151
{
151-
"maxConn": 10, #KM对单台Broker对最大连接数
152+
"maxConn": 10, #KM对单台Broker的最大jmx连接数
152153
"username": "xxxxx", #用户名
153154
"password": "xxxxx", #密码
154155
"openSSL": true, #开启SSL,true表示开启SSL,false表示关闭
@@ -276,32 +277,41 @@ export class ClusterList extends SearchAndFilterContainer {
276277

277278
public getColumns = () => {
278279
const cols = getAdminClusterColumns();
280+
const role = users.currentUser.role;
279281
const col = {
280282
title: '操作',
281283
render: (value: string, item: IMetaData) => (
282284
<>
283-
<a
284-
onClick={this.createOrRegisterCluster.bind(this, item)}
285-
className="action-button"
286-
>编辑
287-
</a>
288-
<Popconfirm
289-
title={`确定${item.status === 1 ? '暂停' : '开始'}${item.clusterName}监控?`}
290-
onConfirm={() => this.pauseMonitor(item)}
291-
cancelText="取消"
292-
okText="确认"
293-
>
294-
<Tooltip title="暂停监控将无法正常监控指标信息,建议开启监控">
285+
{
286+
role && role === 2 ? <>
295287
<a
288+
onClick={this.createOrRegisterCluster.bind(this, item)}
296289
className="action-button"
290+
>编辑
291+
</a>
292+
<Popconfirm
293+
title={`确定${item.status === 1 ? '暂停' : '开始'}${item.clusterName}监控?`}
294+
onConfirm={() => this.pauseMonitor(item)}
295+
cancelText="取消"
296+
okText="确认"
297297
>
298-
{item.status === 1 ? '暂停监控' : '开始监控'}
298+
<Tooltip placement="left" title="暂停监控将无法正常监控指标信息,建议开启监控">
299+
<a
300+
className="action-button"
301+
>
302+
{item.status === 1 ? '暂停监控' : '开始监控'}
303+
</a>
304+
</Tooltip>
305+
</Popconfirm>
306+
<a onClick={this.showMonitor.bind(this, item)}>
307+
删除
299308
</a>
300-
</Tooltip>
301-
</Popconfirm>
302-
<a onClick={this.showMonitor.bind(this, item)}>
303-
删除
304-
</a>
309+
</> : <Tooltip placement="left" title="该功能只对运维人员开放">
310+
<a style={{ color: '#a0a0a0' }} className="action-button">编辑</a>
311+
<a className="action-button" style={{ color: '#a0a0a0' }}>{item.status === 1 ? '暂停监控' : '开始监控'}</a>
312+
<a style={{ color: '#a0a0a0' }}>删除</a>
313+
</Tooltip>
314+
}
305315
</>
306316
),
307317
};
@@ -310,6 +320,7 @@ export class ClusterList extends SearchAndFilterContainer {
310320
}
311321

312322
public renderClusterList() {
323+
const role = users.currentUser.role;
313324
return (
314325
<>
315326
<div className="container">
@@ -318,7 +329,14 @@ export class ClusterList extends SearchAndFilterContainer {
318329
{this.renderSearch('', '请输入集群名称')}
319330
<li className="right-btn-1">
320331
<a style={{ display: 'inline-block', marginRight: '20px' }} href={indexUrl.cagUrl} target="_blank">集群接入指南</a>
321-
<Button type="primary" onClick={this.createOrRegisterCluster.bind(this, null)}>接入集群</Button>
332+
{
333+
role && role === 2 ?
334+
<Button type="primary" onClick={this.createOrRegisterCluster.bind(this, null)}>接入集群</Button>
335+
:
336+
<Tooltip placement="left" title="该功能只对运维人员开放" trigger='hover'>
337+
<Button disabled type="primary">接入集群</Button>
338+
</Tooltip>
339+
}
322340
</li>
323341
</ul>
324342
</div>

kafka-manager-console/src/container/admin/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ export * from './operation-management/migration-detail';
1111
export * from './configure-management';
1212
export * from './individual-bill';
1313
export * from './bill-detail';
14+
export * from './operation-record';
15+
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
import * as React from 'react';
2+
import { cellStyle } from 'constants/table';
3+
4+
import { Tooltip } from 'antd';
5+
import { admin } from 'store/admin';
6+
import moment = require('moment');
7+
8+
const moduleList = [
9+
{ moduleId: 0, moduleName: 'Topic' },
10+
{ moduleId: 1, moduleName: '应用' },
11+
{ moduleId: 2, moduleName: '配额' },
12+
{ moduleId: 3, moduleName: '权限' },
13+
{ moduleId: 4, moduleName: '集群' },
14+
{ moduleId: 5, moduleName: '分区' },
15+
{ moduleId: 6, moduleName: 'Gateway配置' },
16+
]
17+
18+
export const operateList = {
19+
0: '新增',
20+
1: '删除',
21+
2: '修改'
22+
}
23+
24+
25+
// [
26+
// { operate: '新增', operateId: 0 },
27+
// { operate: '删除', operateId: 1 },
28+
// { operate: '修改', operateId: 2 },
29+
// ]
30+
31+
export const getJarFuncForm: any = (props: any) => {
32+
const formMap = [
33+
{
34+
key: 'moduleId',
35+
label: '模块',
36+
type: 'select',
37+
attrs: {
38+
style: {
39+
width: '130px'
40+
},
41+
placeholder: '请选择模块',
42+
},
43+
options: moduleList.map(item => {
44+
return {
45+
label: item.moduleName,
46+
value: item.moduleId
47+
}
48+
}),
49+
formAttrs: {
50+
initialvalue: 0,
51+
},
52+
},
53+
{
54+
key: 'operator',
55+
label: '操作人',
56+
type: 'input',
57+
attrs: {
58+
style: {
59+
width: '170px'
60+
},
61+
placeholder: '请输入操作人'
62+
},
63+
getvaluefromevent: (event: any) => {
64+
return event.target.value.replace(/\s+/g, '')
65+
},
66+
},
67+
// {
68+
// key: 'resource',
69+
// label: '资源名称',
70+
// type: 'input',
71+
// attrs: {
72+
// style: {
73+
// width: '170px'
74+
// },
75+
// placeholder: '请输入资源名称'
76+
// },
77+
// },
78+
// {
79+
// key: 'content',
80+
// label: '操作内容',
81+
// type: 'input',
82+
// attrs: {
83+
// style: {
84+
// width: '170px'
85+
// },
86+
// placeholder: '请输入操作内容'
87+
// },
88+
// },
89+
]
90+
return formMap;
91+
}
92+
export const getOperateColumns = () => {
93+
94+
const columns: any = [
95+
{
96+
title: '模块',
97+
dataIndex: 'module',
98+
key: 'module',
99+
align: 'center',
100+
width: '12%'
101+
},
102+
{
103+
title: '资源名称',
104+
dataIndex: 'resource',
105+
key: 'resource',
106+
align: 'center',
107+
width: '12%'
108+
},
109+
{
110+
title: '操作内容',
111+
dataIndex: 'content',
112+
key: 'content',
113+
align: 'center',
114+
width: '25%',
115+
onCell: () => ({
116+
style: {
117+
maxWidth: 350,
118+
...cellStyle,
119+
},
120+
}),
121+
render: (text: string, record: any) => {
122+
return (
123+
<Tooltip placement="topLeft" title={text} >{text}</Tooltip>);
124+
},
125+
},
126+
{
127+
title: '操作人',
128+
dataIndex: 'operator',
129+
align: 'center',
130+
width: '12%'
131+
},
132+
];
133+
return columns
134+
}

0 commit comments

Comments
 (0)