Skip to content

Commit

Permalink
Merge pull request didi#252 from didi/dev_2.4.0
Browse files Browse the repository at this point in the history
Dev 2.4.0
  • Loading branch information
ZQKC authored Apr 26, 2021
2 parents f9f3c4d + b3b8889 commit bf979fa
Show file tree
Hide file tree
Showing 53 changed files with 807 additions and 213 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cd $workspace

## constant
OUTPUT_DIR=./output
KM_VERSION=2.3.1
KM_VERSION=2.4.0
APP_NAME=kafka-manager
APP_DIR=${APP_NAME}-${KM_VERSION}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static OperateEnum valueOf(Integer code) {

public static boolean validate(Integer code) {
if (code == null) {
return false;
return true;
}
for (OperateEnum state : OperateEnum.values()) {
if (state.getCode() == code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ public String toString() {
}

public boolean legal() {
if (!ModuleEnum.validate(moduleId) ||
(!ValidateUtils.isNull(operateId) && OperateEnum.validate(operateId))
) {
return false;
}
return true;
return !ValidateUtils.isNull(moduleId) && ModuleEnum.validate(moduleId) && OperateEnum.validate(operateId);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.xiaojukeji.kafka.manager.openapi.common.vo;
package com.xiaojukeji.kafka.manager.common.entity.vo.normal.topic;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
Expand All @@ -14,7 +14,6 @@ public class TopicStatisticMetricsVO {

public TopicStatisticMetricsVO(Double peakBytesIn) {
this.peakBytesIn = peakBytesIn;

}

public Double getPeakBytesIn() {
Expand Down
4 changes: 2 additions & 2 deletions kafka-manager-console/src/component/flow-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export class StatusGraghCom<T extends IFlowInfo> extends React.Component {
public render() {
const statusData = this.getData();
const loading = this.getLoading();
if (!statusData) return null;
const data: any[] = [];
if (!statusData) return <Table columns={flowColumns} dataSource={data} />;
Object.keys(statusData).map((key) => {
if (statusData[key]) {
const v = key === 'byteIn' || key === 'byteOut' ? statusData[key].map(i => i && (i / 1024).toFixed(2)) :
Expand All @@ -85,7 +85,7 @@ export class StatusGraghCom<T extends IFlowInfo> extends React.Component {
}
});
return (
<Table columns={flowColumns} dataSource={data} pagination={false} loading={loading}/>
<Table columns={flowColumns} dataSource={data} pagination={false} loading={loading} />
);
}
}
2 changes: 1 addition & 1 deletion kafka-manager-console/src/component/x-form/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.ant-input-number {
.ant-input-number, .ant-form-item-children .ant-select {
width: 314px
}

Expand Down
4 changes: 4 additions & 0 deletions kafka-manager-console/src/constants/left-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export const adminMenu = [{
href: `/admin/bill`,
i: 'k-icon-renwuliebiao',
title: '用户账单',
},{
href: `/admin/operation-record`,
i: 'k-icon-operationrecord',
title: '操作记录',
}] as ILeftMenu[];

export const expertMenu = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class ClusterTopic extends SearchAndFilterContainer {
key: 'appName',
// width: '10%',
render: (val: string, record: IClusterTopics) => (
<Tooltip placement="bottomLeft" title={record.appId} >
<Tooltip placement="bottomLeft" title={val} >
{val}
</Tooltip>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ export class ExclusiveCluster extends SearchAndFilterContainer {
>
<div className="region-prompt">
<span>
由于该Region已被逻辑集群【 {this.state.logicalClusterName} 】使用
请先解除Region与逻辑集群的关系
该Region已被逻辑集群【 {this.state.logicalClusterName} 】使用,请先解除Region与逻辑集群的关系
</span>
</div>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

.traffic-table {
margin: 10px 0;
min-height: 450px;
min-height: 330px;
.traffic-header {
width: 100%;
height: 44px;
Expand Down
114 changes: 66 additions & 48 deletions kafka-manager-console/src/container/admin/cluster-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { wrapper } from 'store';
import { observer } from 'mobx-react';
import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type';
import { admin } from 'store/admin';
import { users } from 'store/users';
import { registerCluster, createCluster, pauseMonitoring } from 'lib/api';
import { SearchAndFilterContainer } from 'container/search-filter';
import { cluster } from 'store/cluster';
Expand Down Expand Up @@ -78,34 +79,34 @@ export class ClusterList extends SearchAndFilterContainer {
disabled: item ? true : false,
},
},
{
key: 'idc',
label: '数据中心',
defaultValue: region.regionName,
rules: [{ required: true, message: '请输入数据中心' }],
attrs: {
placeholder: '请输入数据中心',
disabled: true,
},
},
{
key: 'mode',
label: '集群类型',
type: 'select',
options: cluster.clusterModes.map(ele => {
return {
label: ele.message,
value: ele.code,
};
}),
rules: [{
required: true,
message: '请选择集群类型',
}],
attrs: {
placeholder: '请选择集群类型',
},
},
// {
// key: 'idc',
// label: '数据中心',
// defaultValue: region.regionName,
// rules: [{ required: true, message: '请输入数据中心' }],
// attrs: {
// placeholder: '请输入数据中心',
// disabled: true,
// },
// },
// {
// key: 'mode',
// label: '集群类型',
// type: 'select',
// options: cluster.clusterModes.map(ele => {
// return {
// label: ele.message,
// value: ele.code,
// };
// }),
// rules: [{
// required: true,
// message: '请选择集群类型',
// }],
// attrs: {
// placeholder: '请选择集群类型',
// },
// },
{
key: 'kafkaVersion',
label: 'kafka版本',
Expand Down Expand Up @@ -148,7 +149,7 @@ export class ClusterList extends SearchAndFilterContainer {
attrs: {
placeholder: `请输入JMX认证,例如:
{
"maxConn": 10, #KM对单台Broker对最大连接数
"maxConn": 10, #KM对单台Broker的最大jmx连接数
"username": "xxxxx", #用户名
"password": "xxxxx", #密码
"openSSL": true, #开启SSL,true表示开启SSL,false表示关闭
Expand Down Expand Up @@ -276,32 +277,41 @@ export class ClusterList extends SearchAndFilterContainer {

public getColumns = () => {
const cols = getAdminClusterColumns();
const role = users.currentUser.role;
const col = {
title: '操作',
render: (value: string, item: IMetaData) => (
<>
<a
onClick={this.createOrRegisterCluster.bind(this, item)}
className="action-button"
>编辑
</a>
<Popconfirm
title={`确定${item.status === 1 ? '暂停' : '开始'}${item.clusterName}监控?`}
onConfirm={() => this.pauseMonitor(item)}
cancelText="取消"
okText="确认"
>
<Tooltip title="暂停监控将无法正常监控指标信息,建议开启监控">
{
role && role === 2 ? <>
<a
onClick={this.createOrRegisterCluster.bind(this, item)}
className="action-button"
>编辑
</a>
<Popconfirm
title={`确定${item.status === 1 ? '暂停' : '开始'}${item.clusterName}监控?`}
onConfirm={() => this.pauseMonitor(item)}
cancelText="取消"
okText="确认"
>
{item.status === 1 ? '暂停监控' : '开始监控'}
<Tooltip placement="left" title="暂停监控将无法正常监控指标信息,建议开启监控">
<a
className="action-button"
>
{item.status === 1 ? '暂停监控' : '开始监控'}
</a>
</Tooltip>
</Popconfirm>
<a onClick={this.showMonitor.bind(this, item)}>
删除
</a>
</Tooltip>
</Popconfirm>
<a onClick={this.showMonitor.bind(this, item)}>
删除
</a>
</> : <Tooltip placement="left" title="该功能只对运维人员开放">
<a style={{ color: '#a0a0a0' }} className="action-button">编辑</a>
<a className="action-button" style={{ color: '#a0a0a0' }}>{item.status === 1 ? '暂停监控' : '开始监控'}</a>
<a style={{ color: '#a0a0a0' }}>删除</a>
</Tooltip>
}
</>
),
};
Expand All @@ -310,6 +320,7 @@ export class ClusterList extends SearchAndFilterContainer {
}

public renderClusterList() {
const role = users.currentUser.role;
return (
<>
<div className="container">
Expand All @@ -318,7 +329,14 @@ export class ClusterList extends SearchAndFilterContainer {
{this.renderSearch('', '请输入集群名称')}
<li className="right-btn-1">
<a style={{ display: 'inline-block', marginRight: '20px' }} href={indexUrl.cagUrl} target="_blank">集群接入指南</a>
<Button type="primary" onClick={this.createOrRegisterCluster.bind(this, null)}>接入集群</Button>
{
role && role === 2 ?
<Button type="primary" onClick={this.createOrRegisterCluster.bind(this, null)}>接入集群</Button>
:
<Tooltip placement="left" title="该功能只对运维人员开放" trigger='hover'>
<Button disabled type="primary">接入集群</Button>
</Tooltip>
}
</li>
</ul>
</div>
Expand Down
2 changes: 2 additions & 0 deletions kafka-manager-console/src/container/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export * from './operation-management/migration-detail';
export * from './configure-management';
export * from './individual-bill';
export * from './bill-detail';
export * from './operation-record';

Loading

0 comments on commit bf979fa

Please sign in to comment.