kafka-manager 2.0

This commit is contained in:
zengqiao
2020-09-28 15:46:34 +08:00
parent 28d985aaf1
commit c6e4b60424
1253 changed files with 82183 additions and 37179 deletions

View File

@@ -0,0 +1,80 @@
export const urlPrefix = '/kafka';
import { ILeftMenu } from 'types/base-type';
export const topicMenu = [{
href: `/topic`,
i: 'k-icon-iconfontzhizuobiaozhun023110',
title: '我的Topic',
}, {
href: `/topic/topic-all`,
i: 'k-icon-order1',
title: '全部Topic',
}, {
href: `/topic/app-list`,
i: 'k-icon-gaojing',
title: '应用管理',
}] as ILeftMenu[];
export const clusterMenu = [{
href: `/cluster`,
i: 'k-icon-jiqun',
title: '我的集群',
}] as ILeftMenu[];
export const alarmMenu = [{
href: `/alarm`,
i: 'k-icon-jiqun',
title: '监控告警',
}] as ILeftMenu[];
export const userMenu = [{
href: `/user/my-order`,
i: 'k-icon-order1',
title: '我的申请',
class: 'apply',
}, {
href: `/user/my-approval`,
i: 'k-icon-shenpi1',
title: '我的审批',
class: 'approval',
}, {
href: `/user/bill`,
i: 'k-icon-gaojing',
title: '账单管理',
}] as ILeftMenu[];
export const adminMenu = [{
href: `/admin`,
i: 'k-icon-jiqun',
title: '集群列表',
}, {
href: `/admin/operation`,
i: 'k-icon-xiaofeikecheng',
title: '集群运维',
}, {
href: `/admin/app`,
i: 'k-icon-order1',
title: '平台管理',
}, {
href: `/admin/bill`,
i: 'k-icon-renwuliebiao',
title: '用户账单',
}] as ILeftMenu[];
export const expertMenu = [{
href: `/expert`,
i: 'k-icon-jiqun',
title: 'Topic分区热点',
}, {
href: `/expert/topic-partition`,
i: 'k-icon-order1',
title: 'Topic分区不足',
}, {
href: `/expert/topic-governance`,
i: 'k-icon-order1',
title: 'Topic资源治理',
}, {
href: `/expert/diagnosis`,
i: 'k-icon-xiaofeikecheng',
title: '异常诊断',
}] as ILeftMenu[];

View File

@@ -0,0 +1,209 @@
import { IStatusMap, IStringMap, ILabelValue } from 'types/base-type';
export const optionMap = [
'byteIn/byteOut',
'bytesRejectedPerSec',
'failFetchRequestPerSec',
'failProduceRequestPerSec',
'fetchConsumerRequestPerSec',
'healthScore',
'logFlushTime',
'messagesInPerSec',
'networkProcessorIdlPercent',
'produceRequestPerSec',
'requestHandlerIdlPercent',
'requestQueueSize',
'responseQueueSize',
'totalTimeFetchConsumer99Th',
'totalTimeProduce99Th',
];
export const copyValueMap = ['同步', '未同步'];
export const appStatusMap = {
0: '待审批',
1: '已通过',
2: '被拒绝',
} as IStatusMap;
export const topicStatusMap = {
0: '无权限',
1: '可消费',
2: '可发送',
3: '可发送、消费',
4: '可管理',
} as IStatusMap;
export const authStatusMap = {
0: '无权限',
1: '消费',
2: '发送',
3: '发送、消费',
4: '管理',
} as IStatusMap;
export const orderStatusMap = {
0: '待审批',
1: '已通过',
2: '已拒绝',
3: '已取消',
} as IStatusMap;
export const clusterTypeMap = {
0: '共享集群',
1: '独享集群',
2: '独立集群',
} as IStatusMap;
export const classStatusMap = {
'-1': 'executing',
'0': 'pending',
'10': 'executing',
'20': 'pending',
'30': 'executing',
'40': 'success',
'41': 'success',
'42': 'fail',
'43': 'cancel',
'44': 'executing',
'45': 'pending',
} as IStatusMap;
export const orderApiTypeMap = {
0: 'topics',
1: 'apps',
2: 'quotas',
3: 'authorities',
4: 'clusters',
} as IStatusMap;
export const offlineStatusMap = {
'-1': '可下线',
'0': '过期待通知',
'1': '已通知待反馈',
} as IStatusMap;
export const orderApiMap = {
0: '/normal/orders/topics',
1: '/normal/orders/apps',
2: '/normal/orders/quotas',
3: '/normal/orders/authorities',
4: '/normal/orders/clusters',
} as IStatusMap;
export const controlOptionMap = [{
label: 'Bytes In/Bytes Out',
value: 'byteIn/byteOut',
}, {
label: 'Message In',
value: 'messageIn',
}, {
label: 'Topic Num',
value: 'topicNum',
}, {
label: 'Broker Num',
value: 'brokerNum',
}] as ILabelValue[];
export const selectOptionMap = [{
label: 'Bytes In/Bytes Out',
value: 'byteIn/byteOut',
}, {
label: 'Bytes Rejected',
value: 'byteRejected',
}, {
label: 'Message In/TotalProduceRequests',
value: 'messageIn/totalProduceRequests',
}] as ILabelValue[];
export const selectBrokerMap = [{
label: 'Bytes In/Bytes Out',
value: 'byteIn/byteOut',
}, {
label: 'Bytes Rejected',
value: 'byteRejected',
}, {
label: 'Message In',
value: 'messageIn',
}] as ILabelValue[];
export const metricOptionMap = [
{
type: 'byteIn/byteOut',
arr: ['bytesInPerSec', 'bytesOutPerSec'],
},
{
type: 'messageIn/totalProduceRequests',
arr: ['messagesInPerSec', 'totalProduceRequestsPerSec'],
},
{
type: 'byteRejected',
arr: ['bytesRejectedPerSec'],
},
{
type: 'byteIn/byteOut/appByteIn/appByteOut',
// tslint:disable-next-line:max-line-length
// arr: ['bytesInPerSec', 'bytesOutPerSec', 'appIdBytesInPerSec', 'appIdBytesOutPerSec', 'consumeThrottled', 'produceThrottled'],
arr: ['bytesInPerSec', 'bytesOutPerSec'],
},
];
export const selectMonitorMap = [{
label: '美国',
value: '美国',
}, {
label: '中国',
value: '中国',
}, {
label: '俄罗斯',
value: '俄罗斯',
}] as ILabelValue[];
export const selectTakeMap = [{
label: 'RequestTime99thPercentile',
value: 'requestTime99thPercentile',
}, {
label: 'RequestTime95thPercentile',
value: 'requestTime95thPercentile',
}, {
label: 'RequestTime75thPercentile',
value: 'requestTime75thPercentile',
}, {
label: 'RequestTime50thPercentile',
value: 'requestTime50thPercentile',
}] as ILabelValue[];
export const columsDefault = {
leaderPartitionList: 'leaderPartitions:',
followerPartitionIdList: 'followerPartitions:',
notUnderReplicatedPartitionIdList: 'notUnderReplicatedPartitions:',
} as IStringMap;
export const diskDefault = {
leaderPartitions: 'leaderPartitions:',
followerPartitions: 'followerPartitions:',
notUnderReplicatedPartitions: 'notUnderReplicatedPartitions:',
} as IStringMap;
export const brokerMetrics = {
bytesIn: 'Bytes InMB/ 秒)',
bytesOut: 'Bytes OutMB/ 秒)',
messagesIn: 'Messages In条)',
totalFetchRequests: 'Total Fetch RequestsQPS)',
totalProduceRequests: 'Total Produce RequestsQPS)',
} as IStringMap;
export const roleMap = {
0: '普通用户',
1: '研发人员',
2: '运维人员',
} as IStatusMap;
export const weekOptions = [
{ label: '周一', value: 1 },
{ label: '周二', value: 2 },
{ label: '周三', value: 3 },
{ label: '周四', value: 4 },
{ label: '周五', value: 5 },
{ label: '周六', value: 6 },
{ label: '周日', value: 0 },
];

View File

@@ -0,0 +1,74 @@
export const timeOptions = [
{ label: '周日', value: '0' },
{ label: '周一', value: '1' },
{ label: '周二', value: '2' },
{ label: '周三', value: '3' },
{ label: '周四', value: '4' },
{ label: '周五', value: '5' },
{ label: '周六', value: '6' },
];
export const equalList = [
{ label: '大于', value: '>' },
{ label: '小于', value: '<' },
{ label: '等于', value: '=' },
{ label: '大于等于', value: '>=' },
{ label: '小于等于', value: '<=' },
{ label: '不等于', value: '!=' },
];
export const timeList = [
{ label: '天', value: 'day' },
{ label: '小时', value: 'hour' },
];
export const funcList = [
{ label: '周期发生-happen', value: 'happen' },
{ label: '连续发生-all', value: 'all' },
{ label: '同比变化率-c_avg_rate_abs', value: 'c_avg_rate_abs' },
{ label: '突增突降值-diff', value: 'diff' },
{ label: '突增突降率-pdiff', value: 'pdiff' },
{ label: '求和-sum', value: 'sum' },
];
interface IStringArray {
[key: string]: string [];
}
export const funcKeyMap = {
happen: ['period', 'count'],
ndiff: ['period', 'count'],
c_avg_rate_abs: ['period', 'day'],
all: ['period'],
diff: ['period'],
pdiff: ['period'],
sum: ['period'],
} as IStringArray;
export const filterList = [
{ label: '集群', value: 'clusterName' },
{ label: 'Topic', value: 'topic' },
{ label: 'Location', value: 'loaction' },
{ label: '消费组', value: 'consumerGroup' },
];
export const filterKeys = ['clusterName', 'topic', 'location', 'consumerGroup'];
export const timeFormat = 'YYYY-MM-DD HH:mm:ss';
export const timeMinute = 'YYYY-MM-DD HH:mm';
export const timeMonth = 'YYYY-MM';
export const timeStampStr = 'YYYY/MM/DD HH:mm:ss';
export const timeMonthStr = 'YYYY/MM';
// tslint:disable-next-line:max-line-length
export const indexUrl = 'https://github.com/didi/kafka-manager';
export const expandRemarks = `请填写不少于5字的申请原因以便工作人员判断审核`;
export const quotaRemarks = `请填写不少于5字的申请原因以便工作人员判断审核\n\n如需申请分区分区标准为3MB/s一个请填写“分区数n”`;

View File

@@ -0,0 +1,35 @@
import { PaginationConfig } from 'component/antd';
export const pagination: PaginationConfig = {
position: 'bottom',
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ['10', '20', '50', '100', '200', '500'],
showTotal: (total) => `${total}`,
};
export const customPagination: PaginationConfig = {
position: 'bottom',
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total) => `${total}`,
};
export const cellStyle = {
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
};
export const searchProps = {
optionFilterProp: 'children',
showSearch: true,
filterOption: (input: any, option: any) => {
if ( typeof option.props.children === 'object' ) {
const { props } = option.props.children as any;
return (props.children + '').toLowerCase().indexOf(input.toLowerCase()) >= 0;
}
return (option.props.children + '').toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
};