Compare commits

...

102 Commits

Author SHA1 Message Date
EricZeng
bf979fa3b3 Merge pull request #252 from didi/dev_2.4.0
Dev 2.4.0
2021-04-26 09:55:30 +08:00
EricZeng
b3b88891e9 Merge pull request #251 from lucasun/master
v2.4.0
2021-04-25 21:01:33 +08:00
lucasun
01c5de60dc Merge branch 'master' into master 2021-04-25 20:54:10 +08:00
孙超
47b8fe5022 V2.4.1 FE 2021-04-25 20:43:20 +08:00
zengqiao
324b37b875 v2.4.0 be code 2021-04-25 18:11:52 +08:00
zengqiao
76e7e192d8 bump version to 2.4.0 2021-04-25 17:40:47 +08:00
EricZeng
f9f3c4d923 Merge pull request #240 from yangvipguang/docker-dev
Docker容器镜像优化
2021-04-25 17:23:36 +08:00
杨光
a476476bd1 Update Dockerfile
添加进程管理器tini 防止僵尸应用
升级基础镜像到Java 16 alpine 
默认使用官方jar 包
默认开启JMX 监控
2021-04-23 14:10:40 +08:00
杨光
82a60a884a Add files via upload 2021-04-23 14:06:55 +08:00
杨光
f17727de18 Merge pull request #1 from didi/master
同步提交
2021-04-23 11:31:35 +08:00
EricZeng
f98446e139 Merge pull request #239 from Liu-XinYuan/i238
fix  create topic failed when not specify peak_byte_in
2021-04-22 19:02:48 +08:00
Liu-XinYuan
57a48dadaa modify from obj ==null to ValidateUtils.isNull 2021-04-22 18:44:34 +08:00
Liu-XinYuan
c65ec68e46 fix create topic failed when not specify peak_byte_in 2021-04-22 18:30:23 +08:00
zengqiao
d6559be3fc 部分后台任务获取Topic列表时不走缓存 2021-04-22 16:06:37 +08:00
zengqiao
59df5b24fe broker元信息中增加Rack信息 2021-04-20 19:28:36 +08:00
zengqiao
3e1544294b 删除无效代码 2021-04-20 17:22:26 +08:00
EricZeng
a12c398816 Merge pull request #232 from didi/dev
应用下线功能权限列表获取优化
2021-04-20 13:54:49 +08:00
EricZeng
0bd3e28348 Merge pull request #228 from PengShuaixin/dev
应用下线审批功能优化
2021-04-20 13:51:32 +08:00
PengShuaixin
ad4e39c088 应用下线功能权限列表获取优化 2021-04-20 11:22:11 +08:00
PengShuaixin
2668d96e6a Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	kafka-manager-extends/kafka-manager-bpm/src/main/java/com/xiaojukeji/kafka/manager/bpm/order/impl/DeleteAppOrder.java
2021-04-20 11:19:49 +08:00
shirenchuang
357c496aad 下线应用的时候 判断先下线topic 2021-04-20 11:18:07 +08:00
shirenchuang
22a513ba22 升级mysql驱动;支持Mysql 8.0+ 2021-04-20 11:18:07 +08:00
zengqiao
e6dd1119be 通过获取类的RequestMapping注解来判断当前请求是否需要登录 2021-04-20 11:18:07 +08:00
EricZeng
2dbe454e04 Merge pull request #231 from didi/master
merge master
2021-04-20 10:46:03 +08:00
zengqiao
e3a59b76eb 修复数据删空之后, 缓存不能被更新的BUG 2021-04-19 20:31:40 +08:00
zengqiao
b67a162d3f bump version to v2.3.1 2021-04-19 14:13:48 +08:00
shirenchuang
8bfde9fbaf Merge branch 'shirc_dev' into dev 2021-04-19 10:19:11 +08:00
shirenchuang
1fdecf8def 下线应用的时候 判断先下线topic 2021-04-19 10:17:29 +08:00
zengqiao
1141d4b833 通过获取类的RequestMapping注解来判断当前请求是否有权限 2021-04-15 18:12:21 +08:00
EricZeng
cdac92ca7b Merge pull request #229 from didi/dev
通过获取类的RequestMapping注解来判断当前请求是否需要登录
2021-04-14 19:47:43 +08:00
zengqiao
2a57c260cc 通过获取类的RequestMapping注解来判断当前请求是否需要登录 2021-04-14 19:40:19 +08:00
PengShuaixin
f41e29ab3a 应用下线功能优化 2021-04-14 12:29:59 +08:00
zengqiao
8f10624073 add jmx prometheus jar 2021-04-12 17:58:24 +08:00
EricZeng
eb1f8be11e Merge pull request #224 from didi/master
merge master
2021-04-12 13:51:14 +08:00
EricZeng
3333501ab9 Merge pull request #222 from zwOvO/master
删除无用import、删除无用代码
2021-04-09 19:28:04 +08:00
zwOvO
0f40820315 删除无用import、删除无用代码 2021-04-09 11:41:06 +08:00
shirenchuang
5f1a839620 升级mysql驱动;支持Mysql 8.0+ 2021-04-06 12:09:52 +08:00
zengqiao
b9bb1c775d change uri filter rule 2021-04-06 10:26:21 +08:00
zengqiao
1059b7376b forbiden request when uri contain .. 2021-04-06 10:01:29 +08:00
EricZeng
f38ab4a9ce Merge pull request #217 from didi/dev
拒绝包含./或/连续过多的接口请求
2021-03-31 20:00:52 +08:00
zengqiao
9e7450c012 拒绝包含./或/连续过多的接口请求 2021-03-31 19:45:18 +08:00
EricZeng
99a3e360fe Merge pull request #216 from didi/dev
接口过滤策略由接口黑名单转成接口白名单
2021-03-30 12:56:19 +08:00
lucasun
d45f8f78d6 Merge pull request #215 from zhangfenhua/master
增加nginx配置:前后端分离&配置多个静态资源
2021-03-30 11:11:58 +08:00
zengqiao
648af61116 接口过滤策略由接口黑名单转成接口白名单 2021-03-29 21:21:23 +08:00
zhangfenhua
eebf1b89b1 nginx配置手册 2021-03-29 11:53:50 +08:00
EricZeng
f8094bb624 Merge pull request #211 from didi/dev
add expert config desc
2021-03-23 15:23:10 +08:00
zengqiao
ed13e0d2c2 add expert config desc 2021-03-23 15:21:48 +08:00
EricZeng
aa830589b4 Merge pull request #210 from didi/dev
fix monitor enable time illegal bug
2021-03-22 17:22:44 +08:00
zengqiao
999a2bd929 fix monitor enable time illegal bug 2021-03-22 17:21:12 +08:00
EricZeng
d69ee98450 Merge pull request #209 from didi/dev
add faq, kafka version supported & apply logical cluster and how to handle it
2021-03-22 13:43:14 +08:00
zengqiao
f6712c24ad merge master 2021-03-22 13:42:09 +08:00
zengqiao
89d2772194 add faq, kafka version supported & apply logical cluster and how to handle it 2021-03-22 13:38:23 +08:00
mike.zhangliang
03352142b6 Update README.md
微信加群方式补充
2021-03-16 14:46:38 +08:00
lucasun
73a51e0c00 Merge pull request #205 from ZQKC/master
add qa
2021-03-10 19:27:01 +08:00
zengqiao
2e26f8caa6 add qa 2021-03-10 19:23:29 +08:00
EricZeng
f9bcce9e43 Merge pull request #3 from didi/master
merge didi Logi-KM
2021-03-10 19:20:39 +08:00
EricZeng
2ecc877ba8 fix add_cluster.md path
fix add_cluster.md path
2021-03-10 15:45:48 +08:00
EricZeng
3f8a3c69e3 Merge pull request #201 from ZQKC/master
optimize ldap
2021-03-10 14:12:35 +08:00
zengqiao
67c37a0984 optimize ldap 2021-03-10 13:52:09 +08:00
EricZeng
a58a55d00d Merge pull request #203 from lucasun/hotfix/v2.3.1
clipbord版本锁定在2.0.6,升级2.0.7会引起ts打包报错
2021-03-09 18:11:02 +08:00
孙超
06d51dd0b8 clipbord版本锁定在2.0.6,升级2.0.7会引起ts打包报错 2021-03-09 18:07:42 +08:00
zengqiao
d5db028f57 optimize ldap 2021-03-09 15:13:55 +08:00
EricZeng
fcb85ff4be Merge pull request #2 from didi/master
merge didi logi-km
2021-03-09 11:07:17 +08:00
EricZeng
3695b4363d Merge pull request #200 from didi/dev
del ResultStatus which in vo
2021-03-09 11:02:46 +08:00
zengqiao
cb11e6437c del ResultStatus in vo 2021-03-09 11:01:21 +08:00
EricZeng
5127bd11ce Merge pull request #198 from didi/master
merge master
2021-03-09 10:42:28 +08:00
EricZeng
91f90aefa1 Merge pull request #195 from fanghanyun/v2.3.0_ldap
support AD LDAP
2021-03-09 10:40:42 +08:00
fanghanyun
0a067bce36 Support AD LDAP 2021-03-09 10:19:08 +08:00
fanghanyun
f0aba433bf Support AD LDAP 2021-03-08 20:31:15 +08:00
EricZeng
f06467a0e3 Merge pull request #197 from didi/dev
delete without used code
2021-03-05 16:12:27 +08:00
zengqiao
68bcd3c710 delete without used code 2021-03-05 16:05:58 +08:00
EricZeng
a645733cc5 Merge pull request #196 from didi/dev
add gateway config docs
2021-03-05 15:31:53 +08:00
zengqiao
49fe5baf94 add gateway config docs 2021-03-05 14:59:40 +08:00
fanghanyun
411ee55653 support AD LDAP 2021-03-05 14:45:54 +08:00
EricZeng
e351ce7411 Merge pull request #194 from didi/dev
reject req when uri contains ..
2021-03-04 17:52:56 +08:00
zengqiao
f33e585a71 reject req when uri contains .. 2021-03-04 17:51:35 +08:00
EricZeng
77f3096e0d Merge pull request #191 from didi/dev
Dev
2021-02-28 22:04:34 +08:00
EricZeng
9a5b18c4e6 Merge pull request #190 from JokerQueue/dev
bug fix:correct way to judge a user does not exist
2021-02-28 14:36:28 +08:00
Joker
0c7112869a bug fix:correct way to judge a user does not exist 2021-02-27 22:35:35 +08:00
EricZeng
f66a4d71ea Merge pull request #188 from JokerQueue/dev
bug fix: unexpected stop of the topic sync task
2021-02-26 22:46:54 +08:00
Joker
9b0ab878df bug fix: unexpected stop of the topic sync task 2021-02-26 19:47:03 +08:00
EricZeng
d30b90dfd0 Merge pull request #186 from ZHAOYINRUI/master
新增releases_notes、更新FAQ
2021-02-26 09:59:18 +08:00
ZHAOYINRUI
efd28f8c27 Update faq.md 2021-02-26 00:03:25 +08:00
ZHAOYINRUI
e05e722387 Add files via upload 2021-02-26 00:01:09 +08:00
EricZeng
748e81956d Update faq.md 2021-02-24 14:10:41 +08:00
EricZeng
c9a41febce Merge pull request #184 from didi/dev
reject illegal zk address
2021-02-23 17:32:20 +08:00
zengqiao
18e244b756 reject illegal zk address 2021-02-23 17:18:49 +08:00
mrazkong
47676139a3 Merge pull request #183 from didi/dev
support dynamic change cluster auth
2021-02-23 16:56:26 +08:00
zengqiao
1ed933b7ad support dynamic change auth 2021-02-23 16:34:21 +08:00
EricZeng
f6a343ccd6 Merge pull request #182 from didi/master
merge master
2021-02-23 15:47:28 +08:00
EricZeng
dd6cdc22e5 Merge pull request #178 from Observe-secretly/v2.2.1_ldap
新功能:增加了对LDAP登录的支持
2021-02-10 12:35:07 +08:00
李民
f70f4348b3 Merge branch 'master' into v2.2.1_ldap 2021-02-10 10:00:32 +08:00
EricZeng
ec7f801929 Merge pull request #180 from didi/dev_2.3.0
Dev 2.3.0
2021-02-09 22:06:51 +08:00
zengqiao
0f8aca382e bump version to 2.3.0 2021-02-09 21:47:56 +08:00
zengqiao
0270f77eaa add upgrade doc 2021-02-09 21:46:55 +08:00
EricZeng
dcba71ada4 Merge pull request #179 from lucasun/dev_2.3.0_fe
迭代V2.5, 修复broker监控问题,增加JMX认证支持等...
2021-02-09 18:48:42 +08:00
孙超
6080f76a9c 迭代V2.5, 修复broker监控问题,增加JMX认证支持等... 2021-02-09 15:26:47 +08:00
李民
e7349161f3 BUG FIX:修改LDAP登录重复注册用户的BUG 2021-02-09 15:22:26 +08:00
李民
2e2907ea09 修改LDAP获取UserDN的时候可能出错的问题 2021-02-09 14:33:53 +08:00
李民
25e84b2a6c 新功能:增加对LDAP的登录的支持 2021-02-09 11:33:54 +08:00
zengqiao
5efd424172 version 2.3.0 2021-02-09 11:20:56 +08:00
EricZeng
9aefc55534 Merge pull request #1 from didi/dev
merge didi dev
2021-01-23 11:16:35 +08:00
171 changed files with 3450 additions and 1047 deletions

View File

@@ -67,11 +67,16 @@
- [滴滴Logi-KafkaManager 系列视频教程](https://mp.weixin.qq.com/s/9X7gH0tptHPtfjPPSdGO8g) - [滴滴Logi-KafkaManager 系列视频教程](https://mp.weixin.qq.com/s/9X7gH0tptHPtfjPPSdGO8g)
- [kafka实践十五滴滴开源Kafka管控平台 Logi-KafkaManager研究--A叶子叶来](https://blog.csdn.net/yezonggang/article/details/113106244) - [kafka实践十五滴滴开源Kafka管控平台 Logi-KafkaManager研究--A叶子叶来](https://blog.csdn.net/yezonggang/article/details/113106244)
## 3 滴滴Logi开源用户钉钉交流群 ## 3 滴滴Logi开源用户交流群
![image](https://user-images.githubusercontent.com/5287750/111266722-e531d800-8665-11eb-9242-3484da5a3099.png)
微信加群:关注公众号 Obsuite(官方公众号) 回复 "Logi加群"
![dingding_group](./docs/assets/images/common/dingding_group.jpg) ![dingding_group](./docs/assets/images/common/dingding_group.jpg)
钉钉群ID32821440 钉钉群ID32821440
## 4 OCE认证 ## 4 OCE认证
OCE是一个认证机制和交流平台为滴滴Logi-KafkaManager生产用户量身打造我们会为OCE企业提供更好的技术支持比如专属的技术沙龙、企业一对一的交流机会、专属的答疑群等如果贵司Logi-KafkaManager上了生产[快来加入吧](http://obsuite.didiyun.com/open/openAuth) OCE是一个认证机制和交流平台为滴滴Logi-KafkaManager生产用户量身打造我们会为OCE企业提供更好的技术支持比如专属的技术沙龙、企业一对一的交流机会、专属的答疑群等如果贵司Logi-KafkaManager上了生产[快来加入吧](http://obsuite.didiyun.com/open/openAuth)

97
Releases_Notes.md Normal file
View File

@@ -0,0 +1,97 @@
---
![kafka-manager-logo](./docs/assets/images/common/logo_name.png)
**一站式`Apache Kafka`集群指标监控与运维管控平台**
---
## v2.3.0
版本上线时间2021-02-08
### 能力提升
- 新增支持docker化部署
- 可指定Broker作为候选controller
- 可新增并管理网关配置
- 可获取消费组状态
- 增加集群的JMX认证
### 体验优化
- 优化编辑用户角色、修改密码的流程
- 新增consumerID的搜索功能
- 优化“Topic连接信息”、“消费组重置消费偏移”、“修改Topic保存时间”的文案提示
- 在相应位置增加《资源申请文档》链接
### bug修复
- 修复Broker监控图表时间轴展示错误的问题
- 修复创建夜莺监控告警规则时,使用的告警周期的单位不正确的问题
## v2.2.0
版本上线时间2021-01-25
### 能力提升
- 优化工单批量操作流程
- 增加获取Topic75分位/99分位的实时耗时数据
- 增加定时任务可将无主未落DB的Topic定期写入DB
### 体验优化
- 在相应位置增加《集群接入文档》链接
- 优化物理集群、逻辑集群含义
- 在Topic详情页、Topic扩分区操作弹窗增加展示Topic所属Region的信息
- 优化Topic审批时Topic数据保存时间的配置流程
- 优化Topic/应用申请、审批时的错误提示文案
- 优化Topic数据采样的操作项文案
- 优化运维人员删除Topic时的提示文案
- 优化运维人员删除Region的删除逻辑与提示文案
- 优化运维人员删除逻辑集群的提示文案
- 优化上传集群配置文件时的文件类型限制条件
### bug修复
- 修复填写应用名称时校验特殊字符出错的问题
- 修复普通用户越权访问应用详情的问题
- 修复由于Kafka版本升级导致的数据压缩格式无法获取的问题
- 修复删除逻辑集群或Topic之后界面依旧展示的问题
- 修复进行Leader rebalance操作时执行结果重复提示的问题
## v2.1.0
版本上线时间2020-12-19
### 体验优化
- 优化页面加载时的背景样式
- 优化普通用户申请Topic权限的流程
- 优化Topic申请配额、申请分区的权限限制
- 优化取消Topic权限的文案提示
- 优化申请配额表单的表单项名称
- 优化重置消费偏移的操作流程
- 优化创建Topic迁移任务的表单内容
- 优化Topic扩分区操作的弹窗界面样式
- 优化集群Broker监控可视化图表样式
- 优化创建逻辑集群的表单内容
- 优化集群安全协议的提示文案
### bug修复
- 修复偶发性重置消费偏移失败的问题

View File

@@ -4,7 +4,7 @@ cd $workspace
## constant ## constant
OUTPUT_DIR=./output OUTPUT_DIR=./output
KM_VERSION=2.2.0 KM_VERSION=2.4.0
APP_NAME=kafka-manager APP_NAME=kafka-manager
APP_DIR=${APP_NAME}-${KM_VERSION} APP_DIR=${APP_NAME}-${KM_VERSION}

View File

@@ -1,14 +1,11 @@
FROM openjdk:8-jdk-alpine3.9 FROM openjdk:16-jdk-alpine3.13
LABEL author="yangvipguang" LABEL author="yangvipguang"
ENV VERSION 2.1.0 ENV VERSION 2.3.1
ENV JAR_PATH kafka-manager-web/target
COPY $JAR_PATH/kafka-manager-web-$VERSION-SNAPSHOT.jar /tmp/app.jar
COPY $JAR_PATH/application.yml /km/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache --virtual .build-deps \ RUN apk add --no-cache --virtual .build-deps \
font-adobe-100dpi \ font-adobe-100dpi \
ttf-dejavu \ ttf-dejavu \
fontconfig \ fontconfig \
@@ -19,26 +16,28 @@ RUN apk add --no-cache --virtual .build-deps \
tomcat-native \ tomcat-native \
&& apk del .build-deps && apk del .build-deps
RUN apk add --no-cache tini
ENV AGENT_HOME /opt/agent/ ENV AGENT_HOME /opt/agent/
WORKDIR /tmp WORKDIR /tmp
COPY $JAR_PATH/kafka-manager.jar app.jar
# COPY application.yml application.yml ##默认使用helm 挂载,防止敏感配置泄露
COPY docker-depends/config.yaml $AGENT_HOME COPY docker-depends/config.yaml $AGENT_HOME
COPY docker-depends/jmx_prometheus_javaagent-0.14.0.jar $AGENT_HOME COPY docker-depends/jmx_prometheus_javaagent-0.15.0.jar $AGENT_HOME
ENV JAVA_AGENT="-javaagent:$AGENT_HOME/jmx_prometheus_javaagent-0.14.0.jar=9999:$AGENT_HOME/config.yaml"
ENV JAVA_AGENT="-javaagent:$AGENT_HOME/jmx_prometheus_javaagent-0.15.0.jar=9999:$AGENT_HOME/config.yaml"
ENV JAVA_HEAP_OPTS="-Xms1024M -Xmx1024M -Xmn100M " ENV JAVA_HEAP_OPTS="-Xms1024M -Xmx1024M -Xmn100M "
ENV JAVA_OPTS="-verbose:gc \ ENV JAVA_OPTS="-verbose:gc \
-XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintHeapAtGC -Xloggc:/tmp/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps \
-XX:MaxMetaspaceSize=256M -XX:+DisableExplicitGC -XX:+UseStringDeduplication \ -XX:MaxMetaspaceSize=256M -XX:+DisableExplicitGC -XX:+UseStringDeduplication \
-XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:-UseContainerSupport" -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -XX:-UseContainerSupport"
#-Xlog:gc -Xlog:gc* -Xlog:gc+heap=trace -Xlog:safepoint
EXPOSE 8080 9999 EXPOSE 8080 9999
ENTRYPOINT ["sh","-c","java -jar $JAVA_HEAP_OPTS $JAVA_OPTS /tmp/app.jar --spring.config.location=/km/application.yml"] ENTRYPOINT ["tini", "--"]
## 默认不带Prometheus JMX监控需要可以自行取消以下注释并注释上面一行默认Entrypoint 命令。
## ENTRYPOINT ["sh","-c","java -jar $JAVA_AGENT $JAVA_HEAP_OPTS $JAVA_OPTS /tmp/app.jar --spring.config.location=/km/application.yml"]
CMD ["sh","-c","java -jar $JAVA_AGENT $JAVA_HEAP_OPTS $JAVA_OPTS app.jar --spring.config.location=application.yml"]

View File

@@ -9,6 +9,13 @@
# 动态配置管理 # 动态配置管理
## 0、目录
- 1、Topic定时同步任务
- 2、专家服务——Topic分区热点
- 3、专家服务——Topic分区不足
## 1、Topic定时同步任务 ## 1、Topic定时同步任务
### 1.1、配置的用途 ### 1.1、配置的用途
@@ -63,3 +70,53 @@ task:
] ]
``` ```
---
## 2、专家服务——Topic分区热点
`Region`所圈定的Broker范围内某个Topic的Leader数在这些圈定的Broker上分布不均衡时我们认为该Topic是存在热点的Topic。
备注单纯的查看Leader数的分布确实存在一定的局限性这块欢迎贡献更多的热点定义于代码。
Topic分区热点相关的动态配置(页面在运维管控->平台管理->配置管理)
配置Key
```
REGION_HOT_TOPIC_CONFIG
```
配置Value
```json
{
"maxDisPartitionNum": 2, # Region内Broker间的leader数差距超过2时则认为是存在热点的Topic
"minTopicBytesInUnitB": 1048576, # 流量低于该值的Topic不做统计
"ignoreClusterIdList": [ # 忽略的集群
50
]
}
```
---
## 3、专家服务——Topic分区不足
总流量除以分区数超过指定值时则我们认为存在Topic分区不足。
Topic分区不足相关的动态配置(页面在运维管控->平台管理->配置管理)
配置Key
```
TOPIC_INSUFFICIENT_PARTITION_CONFIG
```
配置Value
```json
{
"maxBytesInPerPartitionUnitB": 3145728, # 单分区流量超过该值, 则认为分区不去
"minTopicBytesInUnitB": 1048576, # 流量低于该值的Topic不做统计
"ignoreClusterIdList": [ # 忽略的集群
50
]
}
```

View File

@@ -0,0 +1,10 @@
---
![kafka-manager-logo](../assets/images/common/logo_name.png)
**一站式`Apache Kafka`集群指标监控与运维管控平台**
---
# Kafka-Gateway 配置说明

View File

@@ -0,0 +1,17 @@
---
![kafka-manager-logo](../../assets/images/common/logo_name.png)
**一站式`Apache Kafka`集群指标监控与运维管控平台**
---
# 升级至`2.3.0`版本
`2.3.0`版本在`gateway_config`表增加了一个描述说明的字段因此需要执行下面的sql进行字段的增加。
```sql
ALTER TABLE `gateway_config`
ADD COLUMN `description` TEXT NULL COMMENT '描述信息' AFTER `version`;
```

View File

@@ -203,7 +203,8 @@ CREATE TABLE `gateway_config` (
`type` varchar(128) NOT NULL DEFAULT '' COMMENT '配置类型', `type` varchar(128) NOT NULL DEFAULT '' COMMENT '配置类型',
`name` varchar(128) NOT NULL DEFAULT '' COMMENT '配置名称', `name` varchar(128) NOT NULL DEFAULT '' COMMENT '配置名称',
`value` text COMMENT '配置值', `value` text COMMENT '配置值',
`version` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '版本信息', `version` bigint(20) unsigned NOT NULL DEFAULT '1' COMMENT '版本信息',
`description` text COMMENT '描述信息',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),

View File

@@ -0,0 +1,94 @@
---
![kafka-manager-logo](../assets/images/common/logo_name.png)
**一站式`Apache Kafka`集群指标监控与运维管控平台**
---
## nginx配置-安装手册
# 一、独立部署
请参考参考:[kafka-manager 安装手册](install_guide_cn.md)
# 二、nginx配置
## 1、独立部署配置
```
#nginx 根目录访问配置如下
location / {
proxy_pass http://ip:port;
}
```
## 2、前后端分离&配置多个静态资源
以下配置解决`nginx代理多个静态资源`,实现项目前后端分离,版本更新迭代。
### 1、源码下载
根据所需版本下载对应代码,下载地址:[Github 下载地址](https://github.com/didi/Logi-KafkaManager)
### 2、修改webpack.config.js 配置文件
修改`kafka-manager-console`模块 `webpack.config.js`
以下所有<font color='red'>xxxx</font>为nginx代理路径和打包静态文件加载前缀,<font color='red'>xxxx</font>可根据需求自行更改。
```
cd kafka-manager-console
vi webpack.config.js
# publicPath默认打包方式根目录下修改为nginx代理访问路径。
let publicPath = '/xxxx';
```
### 3、打包
```
npm cache clean --force && npm install
```
ps如果打包过程中报错运行`npm install clipboard@2.0.6`,相反请忽略!
### 4、部署
#### 1、前段静态文件部署
静态资源 `../kafka-manager-web/src/main/resources/templates`
上传到指定目录,目前以`root目录`做demo
#### 2、上传jar包并启动请参考[kafka-manager 安装手册](install_guide_cn.md)
#### 3、修改nginx 配置
```
location /xxxx {
# 静态文件存放位置
alias /root/templates;
try_files $uri $uri/ /xxxx/index.html;
index index.html;
}
location /api {
proxy_pass http://ip:port;
}
#后代端口建议使用/api如果冲突可以使用以下配置
#location /api/v2 {
# proxy_pass http://ip:port;
#}
#location /api/v1 {
# proxy_pass http://ip:port;
#}
```

View File

@@ -7,9 +7,9 @@
--- ---
# FAQ # FAQ
- 0、Github图裂问题解决 - 0、支持哪些Kafka版本
- 1、Topic申请、新建监控告警等操作时没有可选择的集群 - 1、Topic申请、新建监控告警等操作时没有可选择的集群
- 2、逻辑集群 & Region的用途 - 2、逻辑集群 & Region的用途
- 3、登录失败 - 3、登录失败
@@ -18,22 +18,16 @@
- 6、如何使用`MySQL 8` - 6、如何使用`MySQL 8`
- 7、`Jmx`连接失败如何解决? - 7、`Jmx`连接失败如何解决?
- 8、`topic biz data not exist`错误及处理方式 - 8、`topic biz data not exist`错误及处理方式
- 9、进程启动后如何查看API文档
- 10、如何创建告警组
- 11、连接信息、耗时信息为什么没有数据
- 12、逻辑集群申请审批通过之后为什么看不到逻辑集群
--- ---
### 0、Github图裂问题解决 ### 0、支持哪些Kafka版本
可以在本地机器`ping github.com`这个地址,获取到`github.com`地址的IP地址 基本上只要所使用的Kafka还依赖于Zookeeper那么该版本的主要功能基本上应该就是支持的
然后将IP绑定到`/etc/hosts`文件中。
例如
```shell
# 在 /etc/hosts文件中增加如下信息
140.82.113.3 github.com
```
--- ---
@@ -43,7 +37,7 @@
逻辑集群的创建参看: 逻辑集群的创建参看:
- [kafka-manager 接入集群](docs/user_guide/add_cluster/add_cluster.md) 手册这里的Region和逻辑集群都必须添加。 - [kafka-manager 接入集群](add_cluster/add_cluster.md) 手册这里的Region和逻辑集群都必须添加。
--- ---
@@ -76,7 +70,7 @@
- 3、数据库时区问题。 - 3、数据库时区问题。
检查MySQL的topic表查看是否有数据如果有数据那么再检查设置的时区是否正确。 检查MySQL的topic_metrics表,查看是否有数据,如果有数据,那么再检查设置的时区是否正确。
--- ---
@@ -109,3 +103,26 @@
可以在`运维管控->集群列表->Topic信息`下面编辑申请权限的Topic为Topic选择一个应用即可。 可以在`运维管控->集群列表->Topic信息`下面编辑申请权限的Topic为Topic选择一个应用即可。
以上仅仅只是针对单个Topic的场景如果你有非常多的Topic需要进行初始化的那么此时可以在配置管理中增加一个配置来定时的对无主的Topic进行同步具体见[动态配置管理 - 1、Topic定时同步任务](../dev_guide/dynamic_config_manager.md) 以上仅仅只是针对单个Topic的场景如果你有非常多的Topic需要进行初始化的那么此时可以在配置管理中增加一个配置来定时的对无主的Topic进行同步具体见[动态配置管理 - 1、Topic定时同步任务](../dev_guide/dynamic_config_manager.md)
---
### 9、进程启动后如何查看API文档
- 滴滴Logi-KafkaManager采用Swagger-API工具记录API文档。Swagger-API地址 [http://IP:PORT/swagger-ui.html#/](http://IP:PORT/swagger-ui.html#/)
### 10、如何创建告警组
这块需要配合监控系统进行使用,现在默认已经实现了夜莺的对接,当然也可以对接自己内部的监控系统,不过需要实现一些接口。
具体的文档可见:[监控功能对接夜莺](../dev_guide/monitor_system_integrate_with_n9e.md)、[监控功能对接其他系统](../dev_guide/monitor_system_integrate_with_self.md)
### 11、连接信息、耗时信息为什么没有数据
这块需要结合滴滴内部的kafka-gateway一同使用才会有数据滴滴kafka-gateway暂未开源。
### 12、逻辑集群申请审批通过之后为什么看不到逻辑集群
逻辑集群的申请与审批仅仅只是一个工单流程,并不会去实际创建逻辑集群,逻辑集群的创建还需要手动去创建。
具体的操作可见:[kafka-manager 接入集群](add_cluster/add_cluster.md)。

View File

@@ -47,4 +47,13 @@ public enum AccountRoleEnum {
} }
return AccountRoleEnum.UNKNOWN; return AccountRoleEnum.UNKNOWN;
} }
public static AccountRoleEnum getUserRoleEnum(String roleName) {
for (AccountRoleEnum elem: AccountRoleEnum.values()) {
if (elem.message.equalsIgnoreCase(roleName)) {
return elem;
}
}
return AccountRoleEnum.UNKNOWN;
}
} }

View File

@@ -46,7 +46,7 @@ public enum OperateEnum {
public static boolean validate(Integer code) { public static boolean validate(Integer code) {
if (code == null) { if (code == null) {
return false; return true;
} }
for (OperateEnum state : OperateEnum.values()) { for (OperateEnum state : OperateEnum.values()) {
if (state.getCode() == code) { if (state.getCode() == code) {

View File

@@ -1,45 +0,0 @@
package com.xiaojukeji.kafka.manager.common.bizenum;
/**
* 是否上报监控系统
* @author zengqiao
* @date 20/9/25
*/
public enum SinkMonitorSystemEnum {
SINK_MONITOR_SYSTEM(0, "上报监控系统"),
NOT_SINK_MONITOR_SYSTEM(1, "不上报监控系统"),
;
private Integer code;
private String message;
SinkMonitorSystemEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return "SinkMonitorSystemEnum{" +
"code=" + code +
", message='" + message + '\'' +
'}';
}
}

View File

@@ -0,0 +1,32 @@
package com.xiaojukeji.kafka.manager.common.bizenum;
/**
* 过期Topic状态
* @author zengqiao
* @date 21/01/25
*/
public enum TopicExpiredStatusEnum {
ALREADY_NOTIFIED_AND_DELETED(-2, "已通知, 已下线"),
ALREADY_NOTIFIED_AND_CAN_DELETE(-1, "已通知, 可下线"),
ALREADY_EXPIRED_AND_WAIT_NOTIFY(0, "已过期, 待通知"),
ALREADY_NOTIFIED_AND_WAIT_RESPONSE(1, "已通知, 待反馈"),
;
private int status;
private String message;
TopicExpiredStatusEnum(int status, String message) {
this.status = status;
this.message = message;
}
public int getStatus() {
return status;
}
public String getMessage() {
return message;
}
}

View File

@@ -7,18 +7,18 @@ package com.xiaojukeji.kafka.manager.common.constant;
*/ */
public class ApiPrefix { public class ApiPrefix {
public static final String API_PREFIX = "/api/"; public static final String API_PREFIX = "/api/";
public static final String API_V1_PREFIX = API_PREFIX + "v1/"; private static final String API_V1_PREFIX = API_PREFIX + "v1/";
public static final String API_V2_PREFIX = API_PREFIX + "v2/";
// login
public static final String API_V1_SSO_PREFIX = API_V1_PREFIX + "sso/";
// console // console
public static final String API_V1_SSO_PREFIX = API_V1_PREFIX + "sso/";
public static final String API_V1_NORMAL_PREFIX = API_V1_PREFIX + "normal/"; public static final String API_V1_NORMAL_PREFIX = API_V1_PREFIX + "normal/";
public static final String API_V1_RD_PREFIX = API_V1_PREFIX + "rd/"; public static final String API_V1_RD_PREFIX = API_V1_PREFIX + "rd/";
public static final String API_V1_OP_PREFIX = API_V1_PREFIX + "op/"; public static final String API_V1_OP_PREFIX = API_V1_PREFIX + "op/";
// open // open
public static final String API_V1_THIRD_PART_PREFIX = API_V1_PREFIX + "third-part/"; public static final String API_V1_THIRD_PART_PREFIX = API_V1_PREFIX + "third-part/";
public static final String API_V2_THIRD_PART_PREFIX = API_V2_PREFIX + "third-part/";
// gateway // gateway
public static final String GATEWAY_API_V1_PREFIX = "/gateway" + API_V1_PREFIX; public static final String GATEWAY_API_V1_PREFIX = "/gateway" + API_V1_PREFIX;

View File

@@ -97,7 +97,7 @@ public class Result<T> implements Serializable {
return result; return result;
} }
public static <T> Result<T> buildFailure(String message) { public static <T> Result<T> buildGatewayFailure(String message) {
Result<T> result = new Result<T>(); Result<T> result = new Result<T>();
result.setCode(ResultStatus.GATEWAY_INVALID_REQUEST.getCode()); result.setCode(ResultStatus.GATEWAY_INVALID_REQUEST.getCode());
result.setMessage(message); result.setMessage(message);
@@ -105,6 +105,14 @@ public class Result<T> implements Serializable {
return result; return result;
} }
public static <T> Result<T> buildFailure(String message) {
Result<T> result = new Result<T>();
result.setCode(ResultStatus.FAIL.getCode());
result.setMessage(message);
result.setData(null);
return result;
}
public static Result buildFrom(ResultStatus resultStatus) { public static Result buildFrom(ResultStatus resultStatus) {
Result result = new Result(); Result result = new Result();
result.setCode(resultStatus.getCode()); result.setCode(resultStatus.getCode());

View File

@@ -12,6 +12,8 @@ public enum ResultStatus {
SUCCESS(Constant.SUCCESS, "success"), SUCCESS(Constant.SUCCESS, "success"),
FAIL(1, "操作失败"),
/** /**
* 操作错误[1000, 2000) * 操作错误[1000, 2000)
* ------------------------------------------------------------------------------------------ * ------------------------------------------------------------------------------------------
@@ -23,6 +25,9 @@ public enum ResultStatus {
CHANGE_ZOOKEEPER_FORBIDDEN(1405, "change zookeeper forbidden"), CHANGE_ZOOKEEPER_FORBIDDEN(1405, "change zookeeper forbidden"),
APP_OFFLINE_FORBIDDEN(1406, "先下线topic才能下线应用"),
TOPIC_OPERATION_PARAM_NULL_POINTER(1450, "参数错误"), TOPIC_OPERATION_PARAM_NULL_POINTER(1450, "参数错误"),
TOPIC_OPERATION_PARTITION_NUM_ILLEGAL(1451, "分区数错误"), TOPIC_OPERATION_PARTITION_NUM_ILLEGAL(1451, "分区数错误"),
TOPIC_OPERATION_BROKER_NUM_NOT_ENOUGH(1452, "Broker数不足错误"), TOPIC_OPERATION_BROKER_NUM_NOT_ENOUGH(1452, "Broker数不足错误"),
@@ -91,6 +96,8 @@ public enum ResultStatus {
ZOOKEEPER_CONNECT_FAILED(8020, "zookeeper connect failed"), ZOOKEEPER_CONNECT_FAILED(8020, "zookeeper connect failed"),
ZOOKEEPER_READ_FAILED(8021, "zookeeper read failed"), ZOOKEEPER_READ_FAILED(8021, "zookeeper read failed"),
ZOOKEEPER_WRITE_FAILED(8022, "zookeeper write failed"),
ZOOKEEPER_DELETE_FAILED(8023, "zookeeper delete failed"),
// 调用集群任务里面的agent失败 // 调用集群任务里面的agent失败
CALL_CLUSTER_TASK_AGENT_FAILED(8030, " call cluster task agent failed"), CALL_CLUSTER_TASK_AGENT_FAILED(8030, " call cluster task agent failed"),
@@ -102,6 +109,7 @@ public enum ResultStatus {
STORAGE_UPLOAD_FILE_FAILED(8050, "upload file failed"), STORAGE_UPLOAD_FILE_FAILED(8050, "upload file failed"),
STORAGE_FILE_TYPE_NOT_SUPPORT(8051, "File type not support"), STORAGE_FILE_TYPE_NOT_SUPPORT(8051, "File type not support"),
STORAGE_DOWNLOAD_FILE_FAILED(8052, "download file failed"), STORAGE_DOWNLOAD_FILE_FAILED(8052, "download file failed"),
LDAP_AUTHENTICATION_FAILED(8053, "ldap authentication failed"),
; ;

View File

@@ -23,6 +23,8 @@ public class ClusterDetailDTO {
private String securityProperties; private String securityProperties;
private String jmxProperties;
private Integer status; private Integer status;
private Date gmtCreate; private Date gmtCreate;
@@ -103,6 +105,14 @@ public class ClusterDetailDTO {
this.securityProperties = securityProperties; this.securityProperties = securityProperties;
} }
public String getJmxProperties() {
return jmxProperties;
}
public void setJmxProperties(String jmxProperties) {
this.jmxProperties = jmxProperties;
}
public Integer getStatus() { public Integer getStatus() {
return status; return status;
} }
@@ -176,8 +186,9 @@ public class ClusterDetailDTO {
", bootstrapServers='" + bootstrapServers + '\'' + ", bootstrapServers='" + bootstrapServers + '\'' +
", kafkaVersion='" + kafkaVersion + '\'' + ", kafkaVersion='" + kafkaVersion + '\'' +
", idc='" + idc + '\'' + ", idc='" + idc + '\'' +
", mode='" + mode + '\'' + ", mode=" + mode +
", securityProperties='" + securityProperties + '\'' + ", securityProperties='" + securityProperties + '\'' +
", jmxProperties='" + jmxProperties + '\'' +
", status=" + status + ", status=" + status +
", gmtCreate=" + gmtCreate + ", gmtCreate=" + gmtCreate +
", gmtModify=" + gmtModify + ", gmtModify=" + gmtModify +

View File

@@ -1,57 +0,0 @@
package com.xiaojukeji.kafka.manager.common.entity.ao.config;
/**
* @author zengqiao
* @date 20/9/7
*/
public class SinkTopicRequestTimeMetricsConfig {
private Long clusterId;
private String topicName;
private Long startId;
private Long step;
public Long getClusterId() {
return clusterId;
}
public void setClusterId(Long clusterId) {
this.clusterId = clusterId;
}
public String getTopicName() {
return topicName;
}
public void setTopicName(String topicName) {
this.topicName = topicName;
}
public Long getStartId() {
return startId;
}
public void setStartId(Long startId) {
this.startId = startId;
}
public Long getStep() {
return step;
}
public void setStep(Long step) {
this.step = step;
}
@Override
public String toString() {
return "SinkTopicRequestTimeMetricsConfig{" +
"clusterId=" + clusterId +
", topicName='" + topicName + '\'' +
", startId=" + startId +
", step=" + step +
'}';
}
}

View File

@@ -0,0 +1,45 @@
package com.xiaojukeji.kafka.manager.common.entity.dto.op;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @author zengqiao
* @date 21/01/24
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel(description="优选为Controller的候选者")
public class ControllerPreferredCandidateDTO {
@ApiModelProperty(value="集群ID")
private Long clusterId;
@ApiModelProperty(value="优选为controller的BrokerId")
private List<Integer> brokerIdList;
public Long getClusterId() {
return clusterId;
}
public void setClusterId(Long clusterId) {
this.clusterId = clusterId;
}
public List<Integer> getBrokerIdList() {
return brokerIdList;
}
public void setBrokerIdList(List<Integer> brokerIdList) {
this.brokerIdList = brokerIdList;
}
@Override
public String toString() {
return "ControllerPreferredCandidateDTO{" +
"clusterId=" + clusterId +
", brokerIdList=" + brokerIdList +
'}';
}
}

View File

@@ -40,6 +40,9 @@ public class TopicCreationDTO extends ClusterTopicDTO {
@ApiModelProperty(value = "Topic属性列表") @ApiModelProperty(value = "Topic属性列表")
private Properties properties; private Properties properties;
@ApiModelProperty(value = "最大写入字节数")
private Long peakBytesIn;
public String getAppId() { public String getAppId() {
return appId; return appId;
} }
@@ -104,6 +107,14 @@ public class TopicCreationDTO extends ClusterTopicDTO {
this.properties = properties; this.properties = properties;
} }
public Long getPeakBytesIn() {
return peakBytesIn;
}
public void setPeakBytesIn(Long peakBytesIn) {
this.peakBytesIn = peakBytesIn;
}
@Override @Override
public String toString() { public String toString() {
return "TopicCreationDTO{" + return "TopicCreationDTO{" +
@@ -135,4 +146,4 @@ public class TopicCreationDTO extends ClusterTopicDTO {
} }
return true; return true;
} }
} }

View File

@@ -102,12 +102,11 @@ public class ClusterDTO {
'}'; '}';
} }
public Boolean legal() { public boolean legal() {
if (ValidateUtils.isNull(clusterName) if (ValidateUtils.isNull(clusterName)
|| ValidateUtils.isNull(zookeeper) || ValidateUtils.isNull(zookeeper)
|| ValidateUtils.isNull(idc) || ValidateUtils.isNull(idc)
|| ValidateUtils.isNull(bootstrapServers) || ValidateUtils.isNull(bootstrapServers)) {
) {
return false; return false;
} }
return true; return true;

View File

@@ -81,11 +81,6 @@ public class OperateRecordDTO {
} }
public boolean legal() { public boolean legal() {
if (!ModuleEnum.validate(moduleId) || return !ValidateUtils.isNull(moduleId) && ModuleEnum.validate(moduleId) && OperateEnum.validate(operateId);
(!ValidateUtils.isNull(operateId) && OperateEnum.validate(operateId))
) {
return false;
}
return true;
} }
} }

View File

@@ -1,6 +1,7 @@
package com.xiaojukeji.kafka.manager.common.entity.pojo; package com.xiaojukeji.kafka.manager.common.entity.pojo;
import java.util.Date; import java.util.Date;
import java.util.Objects;
/** /**
* @author zengqiao * @author zengqiao
@@ -116,4 +117,22 @@ public class ClusterDO implements Comparable<ClusterDO> {
public int compareTo(ClusterDO clusterDO) { public int compareTo(ClusterDO clusterDO) {
return this.id.compareTo(clusterDO.id); return this.id.compareTo(clusterDO.id);
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ClusterDO clusterDO = (ClusterDO) o;
return Objects.equals(id, clusterDO.id)
&& Objects.equals(clusterName, clusterDO.clusterName)
&& Objects.equals(zookeeper, clusterDO.zookeeper)
&& Objects.equals(bootstrapServers, clusterDO.bootstrapServers)
&& Objects.equals(securityProperties, clusterDO.securityProperties)
&& Objects.equals(jmxProperties, clusterDO.jmxProperties);
}
@Override
public int hashCode() {
return Objects.hash(id, clusterName, zookeeper, bootstrapServers, securityProperties, jmxProperties);
}
} }

View File

@@ -1,6 +1,7 @@
package com.xiaojukeji.kafka.manager.common.entity.pojo; package com.xiaojukeji.kafka.manager.common.entity.pojo;
import com.xiaojukeji.kafka.manager.common.entity.dto.op.topic.TopicCreationDTO; import com.xiaojukeji.kafka.manager.common.entity.dto.op.topic.TopicCreationDTO;
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
import java.util.Date; import java.util.Date;
@@ -95,6 +96,7 @@ public class TopicDO {
topicDO.setClusterId(dto.getClusterId()); topicDO.setClusterId(dto.getClusterId());
topicDO.setTopicName(dto.getTopicName()); topicDO.setTopicName(dto.getTopicName());
topicDO.setDescription(dto.getDescription()); topicDO.setDescription(dto.getDescription());
topicDO.setPeakBytesIn(ValidateUtils.isNull(dto.getPeakBytesIn()) ? -1L : dto.getPeakBytesIn());
return topicDO; return topicDO;
} }
} }

View File

@@ -17,6 +17,8 @@ public class GatewayConfigDO {
private Long version; private Long version;
private String description;
private Date createTime; private Date createTime;
private Date modifyTime; private Date modifyTime;
@@ -61,6 +63,14 @@ public class GatewayConfigDO {
this.version = version; this.version = version;
} }
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
@@ -85,6 +95,7 @@ public class GatewayConfigDO {
", name='" + name + '\'' + ", name='" + name + '\'' +
", value='" + value + '\'' + ", value='" + value + '\'' +
", version=" + version + ", version=" + version +
", description='" + description + '\'' +
", createTime=" + createTime + ", createTime=" + createTime +
", modifyTime=" + modifyTime + ", modifyTime=" + modifyTime +
'}'; '}';

View File

@@ -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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -14,7 +14,6 @@ public class TopicStatisticMetricsVO {
public TopicStatisticMetricsVO(Double peakBytesIn) { public TopicStatisticMetricsVO(Double peakBytesIn) {
this.peakBytesIn = peakBytesIn; this.peakBytesIn = peakBytesIn;
} }
public Double getPeakBytesIn() { public Double getPeakBytesIn() {

View File

@@ -28,7 +28,7 @@ public class ExpiredTopicVO {
@ApiModelProperty(value = "负责人") @ApiModelProperty(value = "负责人")
private String principals; private String principals;
@ApiModelProperty(value = "状态, -1:可下线, 0:过期待通知, 1+:已通知待反馈") @ApiModelProperty(value = "状态, -1:已通知可下线, 0:过期待通知, 1+:已通知待反馈")
private Integer status; private Integer status;
public Long getClusterId() { public Long getClusterId() {

View File

@@ -26,6 +26,9 @@ public class GatewayConfigVO {
@ApiModelProperty(value="版本") @ApiModelProperty(value="版本")
private Long version; private Long version;
@ApiModelProperty(value="描述说明")
private String description;
@ApiModelProperty(value="创建时间") @ApiModelProperty(value="创建时间")
private Date createTime; private Date createTime;
@@ -72,6 +75,14 @@ public class GatewayConfigVO {
this.version = version; this.version = version;
} }
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
@@ -96,6 +107,7 @@ public class GatewayConfigVO {
", name='" + name + '\'' + ", name='" + name + '\'' +
", value='" + value + '\'' + ", value='" + value + '\'' +
", version=" + version + ", version=" + version +
", description='" + description + '\'' +
", createTime=" + createTime + ", createTime=" + createTime +
", modifyTime=" + modifyTime + ", modifyTime=" + modifyTime +
'}'; '}';

View File

@@ -60,6 +60,13 @@ public class JsonUtils {
return JSON.parseObject(src, clazz); return JSON.parseObject(src, clazz);
} }
public static <T> List<T> stringToArrObj(String src, Class<T> clazz) {
if (ValidateUtils.isBlank(src)) {
return null;
}
return JSON.parseArray(src, clazz);
}
public static List<TopicConnectionDO> parseTopicConnections(Long clusterId, JSONObject jsonObject, long postTime) { public static List<TopicConnectionDO> parseTopicConnections(Long clusterId, JSONObject jsonObject, long postTime) {
List<TopicConnectionDO> connectionDOList = new ArrayList<>(); List<TopicConnectionDO> connectionDOList = new ArrayList<>();
for (String clientType: jsonObject.keySet()) { for (String clientType: jsonObject.keySet()) {

View File

@@ -79,7 +79,7 @@ public class JmxConnectorWrap {
try { try {
Map<String, Object> environment = new HashMap<String, Object>(); Map<String, Object> environment = new HashMap<String, Object>();
if (!ValidateUtils.isBlank(this.jmxConfig.getUsername()) && !ValidateUtils.isBlank(this.jmxConfig.getPassword())) { if (!ValidateUtils.isBlank(this.jmxConfig.getUsername()) && !ValidateUtils.isBlank(this.jmxConfig.getPassword())) {
environment.put(javax.management.remote.JMXConnector.CREDENTIALS, Arrays.asList(this.jmxConfig.getUsername(), this.jmxConfig.getPassword())); environment.put(JMXConnector.CREDENTIALS, Arrays.asList(this.jmxConfig.getUsername(), this.jmxConfig.getPassword()));
} }
if (jmxConfig.isOpenSSL() != null && this.jmxConfig.isOpenSSL()) { if (jmxConfig.isOpenSSL() != null && this.jmxConfig.isOpenSSL()) {
environment.put(Context.SECURITY_PROTOCOL, "ssl"); environment.put(Context.SECURITY_PROTOCOL, "ssl");

View File

@@ -33,7 +33,9 @@ public class ZkPathUtil {
private static final String D_METRICS_CONFIG_ROOT_NODE = CONFIG_ROOT_NODE + ZOOKEEPER_SEPARATOR + "KafkaExMetrics"; private static final String D_METRICS_CONFIG_ROOT_NODE = CONFIG_ROOT_NODE + ZOOKEEPER_SEPARATOR + "KafkaExMetrics";
public static final String D_CONTROLLER_CANDIDATES = CONFIG_ROOT_NODE + ZOOKEEPER_SEPARATOR + "extension/candidates"; public static final String D_CONFIG_EXTENSION_ROOT_NODE = CONFIG_ROOT_NODE + ZOOKEEPER_SEPARATOR + "extension";
public static final String D_CONTROLLER_CANDIDATES = D_CONFIG_EXTENSION_ROOT_NODE + ZOOKEEPER_SEPARATOR + "candidates";
public static String getBrokerIdNodePath(Integer brokerId) { public static String getBrokerIdNodePath(Integer brokerId) {
return BROKER_IDS_ROOT + ZOOKEEPER_SEPARATOR + String.valueOf(brokerId); return BROKER_IDS_ROOT + ZOOKEEPER_SEPARATOR + String.valueOf(brokerId);
@@ -111,6 +113,10 @@ public class ZkPathUtil {
} }
public static String getKafkaExtraMetricsPath(Integer brokerId) { public static String getKafkaExtraMetricsPath(Integer brokerId) {
return D_METRICS_CONFIG_ROOT_NODE + ZOOKEEPER_SEPARATOR + String.valueOf(brokerId); return D_METRICS_CONFIG_ROOT_NODE + ZOOKEEPER_SEPARATOR + brokerId;
}
public static String getControllerCandidatePath(Integer brokerId) {
return D_CONTROLLER_CANDIDATES + ZOOKEEPER_SEPARATOR + brokerId;
} }
} }

View File

@@ -1,8 +1,5 @@
package com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers; package com.xiaojukeji.kafka.manager.common.zookeeper.znode.brokers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List; import java.util.List;
/** /**
@@ -18,12 +15,11 @@ import java.util.List;
* "host":null, * "host":null,
* "timestamp":"1546632983233", * "timestamp":"1546632983233",
* "port":-1, * "port":-1,
* "version":4 * "version":4,
* "rack": "CY"
* } * }
*/ */
public class BrokerMetadata implements Cloneable { public class BrokerMetadata implements Cloneable {
private final static Logger LOGGER = LoggerFactory.getLogger(TopicMetadata.class);
private long clusterId; private long clusterId;
private int brokerId; private int brokerId;
@@ -43,6 +39,8 @@ public class BrokerMetadata implements Cloneable {
private long timestamp; private long timestamp;
private String rack;
public long getClusterId() { public long getClusterId() {
return clusterId; return clusterId;
} }
@@ -107,14 +105,12 @@ public class BrokerMetadata implements Cloneable {
this.timestamp = timestamp; this.timestamp = timestamp;
} }
@Override public String getRack() {
public Object clone() { return rack;
try { }
return super.clone();
} catch (CloneNotSupportedException var3) { public void setRack(String rack) {
LOGGER.error("clone BrokerMetadata failed.", var3); this.rack = rack;
}
return null;
} }
@Override @Override
@@ -128,6 +124,7 @@ public class BrokerMetadata implements Cloneable {
", jmxPort=" + jmx_port + ", jmxPort=" + jmx_port +
", version='" + version + '\'' + ", version='" + version + '\'' +
", timestamp=" + timestamp + ", timestamp=" + timestamp +
", rack='" + rack + '\'' +
'}'; '}';
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "mobx-ts-example", "name": "logi-kafka",
"version": "1.0.0", "version": "2.3.1",
"description": "", "description": "",
"scripts": { "scripts": {
"start": "webpack-dev-server", "start": "webpack-dev-server",
@@ -21,7 +21,7 @@
"@types/spark-md5": "^3.0.2", "@types/spark-md5": "^3.0.2",
"antd": "^3.26.15", "antd": "^3.26.15",
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"clipboard": "^2.0.6", "clipboard": "2.0.6",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"css-loader": "^2.1.0", "css-loader": "^2.1.0",
"echarts": "^4.5.0", "echarts": "^4.5.0",
@@ -56,4 +56,4 @@
"dependencies": { "dependencies": {
"format-to-json": "^1.0.4" "format-to-json": "^1.0.4"
} }
} }

View File

@@ -94,6 +94,9 @@ import 'antd/es/divider/style';
import Upload from 'antd/es/upload'; import Upload from 'antd/es/upload';
import 'antd/es/upload/style'; import 'antd/es/upload/style';
import Transfer from 'antd/es/transfer';
import 'antd/es/transfer/style';
import TimePicker from 'antd/es/time-picker'; import TimePicker from 'antd/es/time-picker';
import 'antd/es/time-picker/style'; import 'antd/es/time-picker/style';
@@ -142,5 +145,6 @@ export {
TimePicker, TimePicker,
RangePickerValue, RangePickerValue,
Badge, Badge,
Popover Popover,
Transfer
}; };

View File

@@ -25,7 +25,7 @@
.editor{ .editor{
height: 100%; height: 100%;
position: absolute; position: absolute;
left: -14%; left: -12%;
width: 120%; width: 120%;
} }
} }

View File

@@ -21,24 +21,12 @@ class Monacoeditor extends React.Component<IEditorProps> {
public state = { public state = {
placeholder: '', placeholder: '',
}; };
// public arr = '{"clusterId":95,"startId":37397856,"step":100,"topicName":"kmo_topic_metrics_tempory_zq"}';
// public Ars(a: string) {
// const obj = JSON.parse(a);
// const newobj: any = {};
// for (const item in obj) {
// if (typeof obj[item] === 'object') {
// this.Ars(obj[item]);
// } else {
// newobj[item] = obj[item];
// }
// }
// return JSON.stringify(newobj);
// }
public async componentDidMount() { public async componentDidMount() {
const { value, onChange } = this.props; const { value, onChange } = this.props;
const format: any = await format2json(value); const format: any = await format2json(value);
this.editor = monaco.editor.create(this.ref, { this.editor = monaco.editor.create(this.ref, {
value: format.result, value: format.result || value,
language: 'json', language: 'json',
lineNumbers: 'off', lineNumbers: 'off',
scrollBeyondLastLine: false, scrollBeyondLastLine: false,
@@ -48,7 +36,7 @@ class Monacoeditor extends React.Component<IEditorProps> {
minimap: { minimap: {
enabled: false, enabled: false,
}, },
// automaticLayout: true, // 自动布局 automaticLayout: true, // 自动布局
glyphMargin: true, // 字形边缘 {},[] glyphMargin: true, // 字形边缘 {},[]
// useTabStops: false, // useTabStops: false,
// formatOnPaste: true, // formatOnPaste: true,

View File

@@ -68,8 +68,8 @@ export class StatusGraghCom<T extends IFlowInfo> extends React.Component {
public render() { public render() {
const statusData = this.getData(); const statusData = this.getData();
const loading = this.getLoading(); const loading = this.getLoading();
if (!statusData) return null;
const data: any[] = []; const data: any[] = [];
if (!statusData) return <Table columns={flowColumns} dataSource={data} />;
Object.keys(statusData).map((key) => { Object.keys(statusData).map((key) => {
if (statusData[key]) { if (statusData[key]) {
const v = key === 'byteIn' || key === 'byteOut' ? statusData[key].map(i => i && (i / 1024).toFixed(2)) : 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 {
} }
}); });
return ( return (
<Table columns={flowColumns} dataSource={data} pagination={false} loading={loading}/> <Table columns={flowColumns} dataSource={data} pagination={false} loading={loading} />
); );
} }
} }

View File

@@ -1,4 +1,4 @@
.ant-input-number { .ant-input-number, .ant-form-item-children .ant-select {
width: 314px width: 314px
} }

View File

@@ -130,6 +130,8 @@ class XForm extends React.Component<IXFormProps> {
this.renderFormItem(formItem), this.renderFormItem(formItem),
)} )}
{formItem.renderExtraElement ? formItem.renderExtraElement() : null} {formItem.renderExtraElement ? formItem.renderExtraElement() : null}
{/* 添加保存时间提示文案 */}
{formItem.attrs?.prompttype ? <span style={{ color: "#cccccc", fontSize: '12px', lineHeight: '20px', display: 'block' }}>{formItem.attrs.prompttype}</span> : null}
</Form.Item> </Form.Item>
); );
})} })}

View File

@@ -59,6 +59,10 @@ export const adminMenu = [{
href: `/admin/bill`, href: `/admin/bill`,
i: 'k-icon-renwuliebiao', i: 'k-icon-renwuliebiao',
title: '用户账单', title: '用户账单',
},{
href: `/admin/operation-record`,
i: 'k-icon-operationrecord',
title: '操作记录',
}] as ILeftMenu[]; }] as ILeftMenu[];
export const expertMenu = [{ export const expertMenu = [{

View File

@@ -67,7 +67,7 @@ export const timeMonthStr = 'YYYY/MM';
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
export const indexUrl ={ export const indexUrl ={
indexUrl:'https://github.com/didi/kafka-manager', indexUrl:'https://github.com/didi/Logi-KafkaManager/blob/master/docs/user_guide/kafka_metrics_desc.md', // 指标说明
cagUrl:'https://github.com/didi/Logi-KafkaManager/blob/master/docs/user_guide/add_cluster/add_cluster.md', // 集群接入指南 Cluster access Guide cagUrl:'https://github.com/didi/Logi-KafkaManager/blob/master/docs/user_guide/add_cluster/add_cluster.md', // 集群接入指南 Cluster access Guide
} }

View File

@@ -100,7 +100,7 @@ export class ClusterConsumer extends SearchAndFilterContainer {
<div className="k-row"> <div className="k-row">
<ul className="k-tab"> <ul className="k-tab">
<li>{this.props.tab}</li> <li>{this.props.tab}</li>
{this.renderSearch()} {this.renderSearch('', '请输入消费组名称')}
</ul> </ul>
<Table <Table
columns={this.columns} columns={this.columns}

View File

@@ -2,7 +2,8 @@
import * as React from 'react'; import * as React from 'react';
import { SearchAndFilterContainer } from 'container/search-filter'; import { SearchAndFilterContainer } from 'container/search-filter';
import { Table } from 'component/antd'; import { Table, Button, Popconfirm, Modal, Transfer, notification } from 'component/antd';
// import { Transfer } from 'antd'
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { pagination } from 'constants/table'; import { pagination } from 'constants/table';
import Url from 'lib/url-parser'; import Url from 'lib/url-parser';
@@ -16,8 +17,12 @@ import { timeFormat } from 'constants/strategy';
export class ClusterController extends SearchAndFilterContainer { export class ClusterController extends SearchAndFilterContainer {
public clusterId: number; public clusterId: number;
public state = { public state: any = {
searchKey: '', searchKey: '',
searchCandidateKey: '',
isCandidateModel: false,
mockData: [],
targetKeys: [],
}; };
constructor(props: any) { constructor(props: any) {
@@ -37,6 +42,94 @@ export class ClusterController extends SearchAndFilterContainer {
return data; return data;
} }
public getCandidateData<T extends IController>(origin: T[]) {
let data: T[] = origin;
let { searchCandidateKey } = this.state;
searchCandidateKey = (searchCandidateKey + '').trim().toLowerCase();
data = searchCandidateKey ? origin.filter((item: IController) =>
(item.host !== undefined && item.host !== null) && item.host.toLowerCase().includes(searchCandidateKey as string),
) : origin;
return data;
}
// 候选controller
public renderCandidateController() {
const columns = [
{
title: 'BrokerId',
dataIndex: 'brokerId',
key: 'brokerId',
width: '20%',
sorter: (a: IController, b: IController) => b.brokerId - a.brokerId,
render: (r: string, t: IController) => {
return (
<a href={`${this.urlPrefix}/admin/broker-detail?clusterId=${this.clusterId}&brokerId=${t.brokerId}`}>{r}
</a>
);
},
},
{
title: 'BrokerHost',
key: 'host',
dataIndex: 'host',
width: '20%',
// render: (r: string, t: IController) => {
// return (
// <a href={`${this.urlPrefix}/admin/broker-detail?clusterId=${this.clusterId}&brokerId=${t.brokerId}`}>{r}
// </a>
// );
// },
},
{
title: 'Broker状态',
key: 'status',
dataIndex: 'status',
width: '20%',
render: (r: number, t: IController) => {
return (
<span>{r === 1 ? '不在线' : '在线'}</span>
);
},
},
{
title: '创建时间',
dataIndex: 'startTime',
key: 'startTime',
width: '25%',
sorter: (a: IController, b: IController) => b.timestamp - a.timestamp,
render: (t: number) => moment(t).format(timeFormat),
},
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
width: '15%',
render: (r: string, t: IController) => {
return (
<Popconfirm
title="确定删除?"
onConfirm={() => this.deleteCandidateCancel(t)}
cancelText="取消"
okText="确认"
>
<a></a>
</Popconfirm>
);
},
},
];
return (
<Table
columns={columns}
dataSource={this.getCandidateData(admin.controllerCandidate)}
pagination={pagination}
rowKey="key"
/>
);
}
public renderController() { public renderController() {
const columns = [ const columns = [
@@ -58,12 +151,6 @@ export class ClusterController extends SearchAndFilterContainer {
key: 'host', key: 'host',
dataIndex: 'host', dataIndex: 'host',
width: '30%', width: '30%',
// render: (r: string, t: IController) => {
// return (
// <a href={`${this.urlPrefix}/admin/broker-detail?clusterId=${this.clusterId}&brokerId=${t.brokerId}`}>{r}
// </a>
// );
// },
}, },
{ {
title: '变更时间', title: '变更时间',
@@ -87,16 +174,104 @@ export class ClusterController extends SearchAndFilterContainer {
public componentDidMount() { public componentDidMount() {
admin.getControllerHistory(this.clusterId); admin.getControllerHistory(this.clusterId);
admin.getCandidateController(this.clusterId);
admin.getBrokersMetadata(this.clusterId);
}
public addController = () => {
this.setState({ isCandidateModel: true, targetKeys: [] })
}
public addCandidateChange = (targetKeys: any) => {
this.setState({ targetKeys })
}
public handleCandidateCancel = () => {
this.setState({ isCandidateModel: false });
}
public handleCandidateOk = () => {
let brokerIdList = this.state.targetKeys.map((item: any) => {
return admin.brokersMetadata[item].brokerId
})
admin.addCandidateController(this.clusterId, brokerIdList).then(data => {
notification.success({ message: '新增成功' });
admin.getCandidateController(this.clusterId);
}).catch(err => {
notification.error({ message: '新增失败' });
})
this.setState({ isCandidateModel: false, targetKeys: [] });
}
public deleteCandidateCancel = (target: any) => {
admin.deleteCandidateCancel(this.clusterId, [target.brokerId]).then(() => {
notification.success({ message: '删除成功' });
});
this.setState({ isCandidateModel: false });
}
public renderAddCandidateController() {
let filterControllerCandidate = admin.brokersMetadata.filter((item: any) => {
return !admin.filtercontrollerCandidate.includes(item.brokerId)
})
return (
<Modal
title="新增候选Controller"
visible={this.state.isCandidateModel}
// okText="确认"
// cancelText="取消"
maskClosable={false}
// onOk={() => this.handleCandidateOk()}
onCancel={() => this.handleCandidateCancel()}
footer={<>
<Button style={{ width: '60px' }} onClick={() => this.handleCandidateCancel()}></Button>
<Button disabled={this.state.targetKeys.length > 0 ? false : true} style={{ width: '60px' }} type="primary" onClick={() => this.handleCandidateOk()}></Button>
</>
}
>
<Transfer
dataSource={filterControllerCandidate}
targetKeys={this.state.targetKeys}
render={item => item.host}
onChange={(targetKeys) => this.addCandidateChange(targetKeys)}
titles={['未选', '已选']}
locale={{
itemUnit: '项',
itemsUnit: '项',
}}
listStyle={{
width: "45%",
}}
/>
</Modal>
);
} }
public render() { public render() {
return ( return (
<div className="k-row"> <div className="k-row">
<ul className="k-tab"> <ul className="k-tab">
<li>
<span>Controller</span>
<span style={{ display: 'inline-block', color: "#a7a8a9", fontSize: '12px', marginLeft: '15px' }}>Controller将会优先从以下Broker中选举</span>
</li>
<div style={{ display: 'flex' }}>
<div style={{ marginRight: '15px' }}>
<Button onClick={() => this.addController()} type='primary'>Controller</Button>
</div>
{this.renderSearch('', '请查找Host', 'searchCandidateKey')}
</div>
</ul>
{this.renderCandidateController()}
<ul className="k-tab" style={{ marginTop: '10px' }}>
<li>{this.props.tab}</li> <li>{this.props.tab}</li>
{this.renderSearch('', '请输入Host')} {this.renderSearch('', '请输入Host')}
</ul> </ul>
{this.renderController()} {this.renderController()}
{this.renderAddCandidateController()}
</div> </div>
); );
} }

View File

@@ -172,7 +172,7 @@ export class ClusterTopic extends SearchAndFilterContainer {
key: 'appName', key: 'appName',
// width: '10%', // width: '10%',
render: (val: string, record: IClusterTopics) => ( render: (val: string, record: IClusterTopics) => (
<Tooltip placement="bottomLeft" title={record.appId} > <Tooltip placement="bottomLeft" title={val} >
{val} {val}
</Tooltip> </Tooltip>
), ),

View File

@@ -314,8 +314,7 @@ export class ExclusiveCluster extends SearchAndFilterContainer {
> >
<div className="region-prompt"> <div className="region-prompt">
<span> <span>
Region已被逻辑集群 {this.state.logicalClusterName} 使 Region已被逻辑集群 {this.state.logicalClusterName} 使Region与逻辑集群的关系
Region与逻辑集群的关系
</span> </span>
</div> </div>
</Modal> </Modal>

View File

@@ -16,7 +16,7 @@
.traffic-table { .traffic-table {
margin: 10px 0; margin: 10px 0;
min-height: 450px; min-height: 330px;
.traffic-header { .traffic-header {
width: 100%; width: 100%;
height: 44px; height: 44px;
@@ -94,4 +94,10 @@
.region-prompt{ .region-prompt{
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
}
.asd{
display: flex;
justify-content: space-around;
align-items: center;
} }

View File

@@ -32,9 +32,9 @@ export class ClusterDetail extends React.Component {
} }
public render() { public render() {
let content = {} as IMetaData; let content = {} as IMetaData;
content = admin.basicInfo ? admin.basicInfo : content; content = admin.basicInfo ? admin.basicInfo : content;
return ( return (
<> <>
<PageHeader <PageHeader
className="detail topic-detail-header" className="detail topic-detail-header"
@@ -46,7 +46,7 @@ export class ClusterDetail extends React.Component {
<ClusterOverview basicInfo={content} /> <ClusterOverview basicInfo={content} />
</TabPane> </TabPane>
<TabPane tab="Topic信息" key="2"> <TabPane tab="Topic信息" key="2">
<ClusterTopic tab={'Topic信息'}/> <ClusterTopic tab={'Topic信息'} />
</TabPane> </TabPane>
<TabPane tab="Broker信息" key="3"> <TabPane tab="Broker信息" key="3">
<ClusterBroker tab={'Broker信息'} basicInfo={content} /> <ClusterBroker tab={'Broker信息'} basicInfo={content} />
@@ -60,11 +60,11 @@ export class ClusterDetail extends React.Component {
<TabPane tab="逻辑集群信息" key="6"> <TabPane tab="逻辑集群信息" key="6">
<LogicalCluster tab={'逻辑集群信息'} basicInfo={content} /> <LogicalCluster tab={'逻辑集群信息'} basicInfo={content} />
</TabPane> </TabPane>
<TabPane tab="Controller变更历史" key="7"> <TabPane tab="Controller信息" key="7">
<ClusterController tab={'Controller变更历史'} /> <ClusterController tab={'Controller变更历史'} />
</TabPane> </TabPane>
<TabPane tab="限流信息" key="8"> <TabPane tab="限流信息" key="8">
<CurrentLimiting tab={'限流信息'}/> <CurrentLimiting tab={'限流信息'} />
</TabPane> </TabPane>
</Tabs> </Tabs>
</> </>

View File

@@ -4,6 +4,7 @@ import { wrapper } from 'store';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type'; import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type';
import { admin } from 'store/admin'; import { admin } from 'store/admin';
import { users } from 'store/users';
import { registerCluster, createCluster, pauseMonitoring } from 'lib/api'; import { registerCluster, createCluster, pauseMonitoring } from 'lib/api';
import { SearchAndFilterContainer } from 'container/search-filter'; import { SearchAndFilterContainer } from 'container/search-filter';
import { cluster } from 'store/cluster'; import { cluster } from 'store/cluster';
@@ -12,6 +13,7 @@ import { urlPrefix } from 'constants/left-menu';
import { indexUrl } from 'constants/strategy' import { indexUrl } from 'constants/strategy'
import { region } from 'store'; import { region } from 'store';
import './index.less'; import './index.less';
import Monacoeditor from 'component/editor/monacoEditor';
import { getAdminClusterColumns } from '../config'; import { getAdminClusterColumns } from '../config';
const { confirm } = Modal; const { confirm } = Modal;
@@ -77,34 +79,34 @@ export class ClusterList extends SearchAndFilterContainer {
disabled: item ? true : false, disabled: item ? true : false,
}, },
}, },
{ // {
key: 'idc', // key: 'idc',
label: '数据中心', // label: '数据中心',
defaultValue: region.regionName, // defaultValue: region.regionName,
rules: [{ required: true, message: '请输入数据中心' }], // rules: [{ required: true, message: '请输入数据中心' }],
attrs: { // attrs: {
placeholder: '请输入数据中心', // placeholder: '请输入数据中心',
disabled: true, // disabled: true,
}, // },
}, // },
{ // {
key: 'mode', // key: 'mode',
label: '集群类型', // label: '集群类型',
type: 'select', // type: 'select',
options: cluster.clusterModes.map(ele => { // options: cluster.clusterModes.map(ele => {
return { // return {
label: ele.message, // label: ele.message,
value: ele.code, // value: ele.code,
}; // };
}), // }),
rules: [{ // rules: [{
required: true, // required: true,
message: '请选择集群类型', // message: '请选择集群类型',
}], // }],
attrs: { // attrs: {
placeholder: '请选择集群类型', // placeholder: '请选择集群类型',
}, // },
}, // },
{ {
key: 'kafkaVersion', key: 'kafkaVersion',
label: 'kafka版本', label: 'kafka版本',
@@ -132,6 +134,25 @@ export class ClusterList extends SearchAndFilterContainer {
"security.protocol": "SASL_PLAINTEXT", "security.protocol": "SASL_PLAINTEXT",
"sasl.mechanism": "PLAIN", "sasl.mechanism": "PLAIN",
"sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\\"xxxxxx\\" password=\\"xxxxxx\\";" "sasl.jaas.config": "org.apache.kafka.common.security.plain.PlainLoginModule required username=\\"xxxxxx\\" password=\\"xxxxxx\\";"
}`,
rows: 8,
},
},
{
key: 'jmxProperties',
label: 'JMX认证',
type: 'text_area',
rules: [{
required: false,
message: '请输入JMX认证',
}],
attrs: {
placeholder: `请输入JMX认证例如
{
"maxConn": 10, #KM对单台Broker的最大jmx连接数
"username": "xxxxx", #用户名
"password": "xxxxx", #密码
"openSSL": true, #开启SSLtrue表示开启SSLfalse表示关闭
}`, }`,
rows: 8, rows: 8,
}, },
@@ -256,32 +277,41 @@ export class ClusterList extends SearchAndFilterContainer {
public getColumns = () => { public getColumns = () => {
const cols = getAdminClusterColumns(); const cols = getAdminClusterColumns();
const role = users.currentUser.role;
const col = { const col = {
title: '操作', title: '操作',
render: (value: string, item: IMetaData) => ( render: (value: string, item: IMetaData) => (
<> <>
<a {
onClick={this.createOrRegisterCluster.bind(this, item)} role && role === 2 ? <>
className="action-button"
>
</a>
<Popconfirm
title={`确定${item.status === 1 ? '暂停' : '开始'}${item.clusterName}监控?`}
onConfirm={() => this.pauseMonitor(item)}
cancelText="取消"
okText="确认"
>
<Tooltip title="暂停监控将无法正常监控指标信息,建议开启监控">
<a <a
onClick={this.createOrRegisterCluster.bind(this, item)}
className="action-button" className="action-button"
> >
{item.status === 1 ? '暂停监控' : '开始监控'}
</a> </a>
</Tooltip> <Popconfirm
</Popconfirm> title={`确定${item.status === 1 ? '暂停' : '开始'}${item.clusterName}监控?`}
<a onClick={this.showMonitor.bind(this, item)}> onConfirm={() => this.pauseMonitor(item)}
cancelText="取消"
</a> okText="确认"
>
<Tooltip placement="left" title="暂停监控将无法正常监控指标信息,建议开启监控">
<a
className="action-button"
>
{item.status === 1 ? '暂停监控' : '开始监控'}
</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>
}
</> </>
), ),
}; };
@@ -290,6 +320,7 @@ export class ClusterList extends SearchAndFilterContainer {
} }
public renderClusterList() { public renderClusterList() {
const role = users.currentUser.role;
return ( return (
<> <>
<div className="container"> <div className="container">
@@ -298,7 +329,14 @@ export class ClusterList extends SearchAndFilterContainer {
{this.renderSearch('', '请输入集群名称')} {this.renderSearch('', '请输入集群名称')}
<li className="right-btn-1"> <li className="right-btn-1">
<a style={{ display: 'inline-block', marginRight: '20px' }} href={indexUrl.cagUrl} target="_blank"></a> <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> </li>
</ul> </ul>
</div> </div>

View File

@@ -1,8 +1,8 @@
import * as React from 'react'; import * as React from 'react';
import { IUser, IUploadFile, IConfigure, IMetaData, IBrokersPartitions } from 'types/base-type'; import { IUser, IUploadFile, IConfigure, IConfigGateway, IMetaData } from 'types/base-type';
import { users } from 'store/users'; import { users } from 'store/users';
import { version } from 'store/version'; import { version } from 'store/version';
import { showApplyModal, showModifyModal, showConfigureModal } from 'container/modal/admin'; import { showApplyModal, showApplyModalModifyPassword, showModifyModal, showConfigureModal, showConfigGatewayModal } from 'container/modal/admin';
import { Popconfirm, Tooltip } from 'component/antd'; import { Popconfirm, Tooltip } from 'component/antd';
import { admin } from 'store/admin'; import { admin } from 'store/admin';
import { cellStyle } from 'constants/table'; import { cellStyle } from 'constants/table';
@@ -27,6 +27,7 @@ export const getUserColumns = () => {
return ( return (
<span className="table-operation"> <span className="table-operation">
<a onClick={() => showApplyModal(record)}></a> <a onClick={() => showApplyModal(record)}></a>
<a onClick={() => showApplyModalModifyPassword(record)}></a>
<Popconfirm <Popconfirm
title="确定删除?" title="确定删除?"
onConfirm={() => users.deleteUser(record.username)} onConfirm={() => users.deleteUser(record.username)}
@@ -184,6 +185,87 @@ export const getConfigureColumns = () => {
return columns; return columns;
}; };
// 网关配置
export const getConfigColumns = () => {
const columns = [
{
title: '配置类型',
dataIndex: 'type',
key: 'type',
width: '25%',
ellipsis: true,
sorter: (a: IConfigGateway, b: IConfigGateway) => a.type.charCodeAt(0) - b.type.charCodeAt(0),
},
{
title: '配置键',
dataIndex: 'name',
key: 'name',
width: '15%',
ellipsis: true,
sorter: (a: IConfigGateway, b: IConfigGateway) => a.name.charCodeAt(0) - b.name.charCodeAt(0),
},
{
title: '配置值',
dataIndex: 'value',
key: 'value',
width: '20%',
ellipsis: true,
sorter: (a: IConfigGateway, b: IConfigGateway) => a.value.charCodeAt(0) - b.value.charCodeAt(0),
render: (t: string) => {
return t.substr(0, 1) === '{' && t.substr(0, -1) === '}' ? JSON.stringify(JSON.parse(t), null, 4) : t;
},
},
{
title: '修改时间',
dataIndex: 'modifyTime',
key: 'modifyTime',
width: '15%',
sorter: (a: IConfigGateway, b: IConfigGateway) => b.modifyTime - a.modifyTime,
render: (t: number) => moment(t).format(timeFormat),
},
{
title: '版本号',
dataIndex: 'version',
key: 'version',
width: '10%',
ellipsis: true,
sorter: (a: IConfigGateway, b: IConfigGateway) => b.version.charCodeAt(0) - a.version.charCodeAt(0),
},
{
title: '描述信息',
dataIndex: 'description',
key: 'description',
width: '20%',
ellipsis: true,
onCell: () => ({
style: {
maxWidth: 180,
...cellStyle,
},
}),
},
{
title: '操作',
width: '10%',
render: (text: string, record: IConfigGateway) => {
return (
<span className="table-operation">
<a onClick={() => showConfigGatewayModal(record)}></a>
<Popconfirm
title="确定删除?"
onConfirm={() => admin.deleteConfigGateway({ id: record.id })}
cancelText="取消"
okText="确认"
>
<a></a>
</Popconfirm>
</span>);
},
},
];
return columns;
};
const renderClusterHref = (value: number | string, item: IMetaData, key: number) => { const renderClusterHref = (value: number | string, item: IMetaData, key: number) => {
return ( // 0 暂停监控--不可点击 1 监控中---可正常点击 return ( // 0 暂停监控--不可点击 1 监控中---可正常点击
<> <>

View File

@@ -3,11 +3,11 @@ import { SearchAndFilterContainer } from 'container/search-filter';
import { Table, Button, Spin } from 'component/antd'; import { Table, Button, Spin } from 'component/antd';
import { admin } from 'store/admin'; import { admin } from 'store/admin';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { IConfigure } from 'types/base-type'; import { IConfigure, IConfigGateway } from 'types/base-type';
import { users } from 'store/users'; import { users } from 'store/users';
import { pagination } from 'constants/table'; import { pagination } from 'constants/table';
import { getConfigureColumns } from './config'; import { getConfigureColumns, getConfigColumns } from './config';
import { showConfigureModal } from 'container/modal/admin'; import { showConfigureModal, showConfigGatewayModal } from 'container/modal/admin';
@observer @observer
export class ConfigureManagement extends SearchAndFilterContainer { export class ConfigureManagement extends SearchAndFilterContainer {
@@ -17,7 +17,12 @@ export class ConfigureManagement extends SearchAndFilterContainer {
}; };
public componentDidMount() { public componentDidMount() {
admin.getConfigure(); if (this.props.isShow) {
admin.getGatewayList();
admin.getGatewayType();
} else {
admin.getConfigure();
}
} }
public getData<T extends IConfigure>(origin: T[]) { public getData<T extends IConfigure>(origin: T[]) {
@@ -34,15 +39,34 @@ export class ConfigureManagement extends SearchAndFilterContainer {
return data; return data;
} }
public getGatewayData<T extends IConfigGateway>(origin: T[]) {
let data: T[] = origin;
let { searchKey } = this.state;
searchKey = (searchKey + '').trim().toLowerCase();
data = searchKey ? origin.filter((item: IConfigGateway) =>
((item.name !== undefined && item.name !== null) && item.name.toLowerCase().includes(searchKey as string))
|| ((item.value !== undefined && item.value !== null) && item.value.toLowerCase().includes(searchKey as string))
|| ((item.description !== undefined && item.description !== null) &&
item.description.toLowerCase().includes(searchKey as string)),
) : origin;
return data;
}
public renderTable() { public renderTable() {
return ( return (
<Spin spinning={users.loading}> <Spin spinning={users.loading}>
<Table {this.props.isShow ? <Table
rowKey="key"
columns={getConfigColumns()}
dataSource={this.getGatewayData(admin.configGatewayList)}
pagination={pagination}
/> : <Table
rowKey="key" rowKey="key"
columns={getConfigureColumns()} columns={getConfigureColumns()}
dataSource={this.getData(admin.configureList)} dataSource={this.getData(admin.configureList)}
pagination={pagination} pagination={pagination}
/> />}
</Spin> </Spin>
); );
@@ -53,7 +77,7 @@ export class ConfigureManagement extends SearchAndFilterContainer {
<ul> <ul>
{this.renderSearch('', '请输入配置键、值或描述')} {this.renderSearch('', '请输入配置键、值或描述')}
<li className="right-btn-1"> <li className="right-btn-1">
<Button type="primary" onClick={() => showConfigureModal()}></Button> <Button type="primary" onClick={() => this.props.isShow ? showConfigGatewayModal() : showConfigureModal()}></Button>
</li> </li>
</ul> </ul>
); );

View File

@@ -6,6 +6,7 @@ import { curveKeys, CURVE_KEY_MAP, PERIOD_RADIO_MAP, PERIOD_RADIO } from './conf
import moment = require('moment'); import moment = require('moment');
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { timeStampStr } from 'constants/strategy'; import { timeStampStr } from 'constants/strategy';
import { adminMonitor } from 'store/admin-monitor';
@observer @observer
export class DataCurveFilter extends React.Component { export class DataCurveFilter extends React.Component {
@@ -21,6 +22,7 @@ export class DataCurveFilter extends React.Component {
} }
public refreshAll = () => { public refreshAll = () => {
adminMonitor.setRequestId(null);
Object.keys(curveKeys).forEach((c: curveKeys) => { Object.keys(curveKeys).forEach((c: curveKeys) => {
const { typeInfo, curveInfo: option } = CURVE_KEY_MAP.get(c); const { typeInfo, curveInfo: option } = CURVE_KEY_MAP.get(c);
const { parser } = typeInfo; const { parser } = typeInfo;
@@ -32,7 +34,7 @@ export class DataCurveFilter extends React.Component {
return ( return (
<> <>
<Radio.Group onChange={this.radioChange} defaultValue={curveInfo.periodKey}> <Radio.Group onChange={this.radioChange} defaultValue={curveInfo.periodKey}>
{PERIOD_RADIO.map(p => <Radio.Button key={p.key} value={p.key}>{p.label}</Radio.Button>)} {PERIOD_RADIO.map(p => <Radio.Button key={p.key} value={p.key}>{p.label}</Radio.Button>)}
</Radio.Group> </Radio.Group>
<DatePicker.RangePicker <DatePicker.RangePicker
format={timeStampStr} format={timeStampStr}

View File

@@ -11,3 +11,5 @@ export * from './operation-management/migration-detail';
export * from './configure-management'; export * from './configure-management';
export * from './individual-bill'; export * from './individual-bill';
export * from './bill-detail'; export * from './bill-detail';
export * from './operation-record';

View File

@@ -0,0 +1,134 @@
import * as React from 'react';
import { cellStyle } from 'constants/table';
import { Tooltip } from 'antd';
import { admin } from 'store/admin';
import moment = require('moment');
const moduleList = [
{ moduleId: 0, moduleName: 'Topic' },
{ moduleId: 1, moduleName: '应用' },
{ moduleId: 2, moduleName: '配额' },
{ moduleId: 3, moduleName: '权限' },
{ moduleId: 4, moduleName: '集群' },
{ moduleId: 5, moduleName: '分区' },
{ moduleId: 6, moduleName: 'Gateway配置' },
]
export const operateList = {
0: '新增',
1: '删除',
2: '修改'
}
// [
// { operate: '新增', operateId: 0 },
// { operate: '删除', operateId: 1 },
// { operate: '修改', operateId: 2 },
// ]
export const getJarFuncForm: any = (props: any) => {
const formMap = [
{
key: 'moduleId',
label: '模块',
type: 'select',
attrs: {
style: {
width: '130px'
},
placeholder: '请选择模块',
},
options: moduleList.map(item => {
return {
label: item.moduleName,
value: item.moduleId
}
}),
formAttrs: {
initialvalue: 0,
},
},
{
key: 'operator',
label: '操作人',
type: 'input',
attrs: {
style: {
width: '170px'
},
placeholder: '请输入操作人'
},
getvaluefromevent: (event: any) => {
return event.target.value.replace(/\s+/g, '')
},
},
// {
// key: 'resource',
// label: '资源名称',
// type: 'input',
// attrs: {
// style: {
// width: '170px'
// },
// placeholder: '请输入资源名称'
// },
// },
// {
// key: 'content',
// label: '操作内容',
// type: 'input',
// attrs: {
// style: {
// width: '170px'
// },
// placeholder: '请输入操作内容'
// },
// },
]
return formMap;
}
export const getOperateColumns = () => {
const columns: any = [
{
title: '模块',
dataIndex: 'module',
key: 'module',
align: 'center',
width: '12%'
},
{
title: '资源名称',
dataIndex: 'resource',
key: 'resource',
align: 'center',
width: '12%'
},
{
title: '操作内容',
dataIndex: 'content',
key: 'content',
align: 'center',
width: '25%',
onCell: () => ({
style: {
maxWidth: 350,
...cellStyle,
},
}),
render: (text: string, record: any) => {
return (
<Tooltip placement="topLeft" title={text} >{text}</Tooltip>);
},
},
{
title: '操作人',
dataIndex: 'operator',
align: 'center',
width: '12%'
},
];
return columns
}

View File

@@ -0,0 +1,130 @@
import * as React from 'react';
import { observer } from 'mobx-react';
import { SearchAndFilterContainer } from 'container/search-filter';
import { IXFormWrapper, IMetaData, IRegister } from 'types/base-type';
import { admin } from 'store/admin';
import { customPagination, cellStyle } from 'constants/table';
import { Table, Tooltip } from 'component/antd';
import { timeFormat } from 'constants/strategy';
import { SearchFormComponent } from '../searchForm';
import { getJarFuncForm, operateList, getOperateColumns } from './config'
import moment = require('moment');
import { tableFilter } from 'lib/utils';
@observer
export class OperationRecord extends SearchAndFilterContainer {
public state: any = {
searchKey: '',
filteredInfo: null,
sortedInfo: null,
};
public getData<T extends IMetaData>(origin: T[]) {
let data: T[] = origin;
let { searchKey } = this.state;
searchKey = (searchKey + '').trim().toLowerCase();
data = searchKey ? origin.filter((item: IMetaData) =>
(item.clusterName !== undefined && item.clusterName !== null) && item.clusterName.toLowerCase().includes(searchKey as string),
) : origin;
return data;
};
public searchForm = (params: any) => {
// this.props.setFuncSubValue(params)
// getSystemFuncList(params).then(res => {
// this.props.setSysFuncList(res.data)
// this.props.setPagination(res.pagination)
// })
const { operator, moduleId } = params || {}
operator ? admin.getOperationRecordData(params) : admin.getOperationRecordData({ moduleId })
// getJarList(params).then(res => {
// this.props.setJarList(res.data)
// this.props.setPagination(res.pagination)
// })
}
public clearAll = () => {
this.setState({
filteredInfo: null,
sortedInfo: null,
});
};
public setHandleChange = (pagination: any, filters: any, sorter: any) => {
this.setState({
filteredInfo: filters,
sortedInfo: sorter,
});
}
public renderOperationRecordList() {
let { sortedInfo, filteredInfo } = this.state;
sortedInfo = sortedInfo || {};
filteredInfo = filteredInfo || {};
const operatingTime = Object.assign({
title: '操作时间',
dataIndex: 'modifyTime',
key: 'modifyTime',
align: 'center',
sorter: (a: any, b: any) => a.modifyTime - b.modifyTime,
render: (t: number) => moment(t).format(timeFormat),
width: '15%',
sortOrder: sortedInfo.columnKey === 'modifyTime' && sortedInfo.order,
});
const operatingPractice = Object.assign({
title: '行为',
dataIndex: 'operate',
key: 'operate',
align: 'center',
width: '12%',
filters: tableFilter<any>(this.getData(admin.oRList), 'operateId', operateList),
// filteredValue: filteredInfo.operate || null,
onFilter: (value: any, record: any) => {
return record.operateId === value
}
}, this.renderColumnsFilter('modifyTime'))
const columns = getOperateColumns()
columns.splice(0, 0, operatingTime);
columns.splice(3, 0, operatingPractice);
return (
<>
<div className="container">
<div className="table-operation-panel">
<SearchFormComponent
formMap={getJarFuncForm()}
onSubmit={(params: any) => this.searchForm(params)}
clearAll={() => this.clearAll()}
isReset={true}
/>
</div>
<div className="table-wrapper">
<Table
rowKey="key"
loading={admin.loading}
dataSource={this.getData(admin.oRList)}
columns={columns}
pagination={customPagination}
bordered
onChange={this.setHandleChange}
/>
</div>
</div>
</>
)
};
componentDidMount() {
admin.getOperationRecordData({ moduleId: 0 });
}
render() {
return <div>
{
this.renderOperationRecordList()
}
</div>
}
}

View File

@@ -13,17 +13,20 @@ export class PlatformManagement extends React.Component {
public render() { public render() {
return ( return (
<> <>
<Tabs activeKey={location.hash.substr(1) || '1'} type="card" onChange={handleTabKey}> <Tabs activeKey={location.hash.substr(1) || '1'} type="card" onChange={handleTabKey}>
<TabPane tab="应用管理" key="1"> <TabPane tab="应用管理" key="1">
<AdminAppList /> <AdminAppList />
</TabPane> </TabPane>
<TabPane tab="用户管理" key="2"> <TabPane tab="用户管理" key="2">
<UserManagement /> <UserManagement />
</TabPane> </TabPane>
<TabPane tab="配置管理" key="3"> <TabPane tab="平台配置" key="3">
<ConfigureManagement /> <ConfigureManagement isShow={false} />
</TabPane> </TabPane>
</Tabs> <TabPane tab="网关配置" key="4">
<ConfigureManagement isShow={true} />
</TabPane>
</Tabs>
</> </>
); );
} }

View File

@@ -0,0 +1,120 @@
import * as React from 'react';
import { Select, Input, InputNumber, Form, Switch, Checkbox, DatePicker, Radio, Upload, Button, Icon, Tooltip } from 'component/antd';
// import './index.less';
const Search = Input.Search;
export interface IFormItem {
key: string;
label: string;
type: string;
value?: string;
// 内部组件属性注入
attrs?: any;
// form属性注入
formAttrs?: any;
defaultValue?: string | number | any[];
rules?: any[];
invisible?: boolean;
getvaluefromevent: Function;
}
interface SerachFormProps {
formMap: IFormItem[];
// formData: any;
form: any;
onSubmit: Function;
isReset?: boolean;
clearAll: Function;
layout?: 'inline' | 'horizontal' | 'vertical';
}
export interface IFormSelect extends IFormItem {
options: Array<{ key?: string | number, value: string | number, label: string }>;
}
class SearchForm extends React.Component<SerachFormProps>{
public onSubmit = () => {
// this.props.onSubmit()
//
}
public renderFormItem(item: IFormItem) {
switch (item.type) {
default:
case 'input':
return <Input key={item.key} {...item.attrs} />;
case 'select':
return (
<Select
// size="small"
key={item.key}
{...item.attrs}
invisibleValue={item.formAttrs.invisibleValue}
>
{(item as IFormSelect).options && (item as IFormSelect).options.map((v, index) => (
<Select.Option
key={v.value || v.key || index}
value={v.value}
>
{v.label}
{/* <Tooltip placement='left' title={v.value}>
{v.label}
</Tooltip> */}
</Select.Option>
))}
</Select>
);
}
}
public theQueryClick = (value: any) => {
this.props.onSubmit(value)
this.props.clearAll()
// this.props.form.resetFields()
}
public resetClick = () => {
this.props.form.resetFields()
this.props.clearAll()
this.theQueryClick(this.props.form.getFieldsValue())
}
public render() {
const { form, formMap, isReset } = this.props;
const { getFieldDecorator, getFieldsValue } = form;
return (
<Form layout='inline' onSubmit={this.onSubmit}>
{
formMap.map(formItem => {
// const { initialValue, valuePropName } = this.handleFormItem(formItem, formData);
// const getFieldValue = {
// initialValue,
// rules: formItem.rules || [{ required: false, message: '' }],
// valuePropName,
// };
return (
<Form.Item
key={formItem.key}
label={formItem.label}
{...formItem.formAttrs}
>
{getFieldDecorator(formItem.key, {
initialValue: formItem.formAttrs?.initialvalue,
getValueFromEvent: formItem?.getvaluefromevent,
})(
this.renderFormItem(formItem),
)}
</Form.Item>
);
})
}
<Form.Item>
{
isReset && <Button style={{ width: '80px', marginRight: '20px' }} type="primary" onClick={() => this.resetClick()}></Button>
}
<Button style={{ width: '80px' }} type="primary" onClick={() => this.theQueryClick(getFieldsValue())}></Button>
</Form.Item>
</Form>
);
}
}
export const SearchFormComponent = Form.create<SerachFormProps>({ name: 'search-form' })(SearchForm);

View File

@@ -29,7 +29,7 @@ export class UserManagement extends SearchAndFilterContainer {
searchKey = (searchKey + '').trim().toLowerCase(); searchKey = (searchKey + '').trim().toLowerCase();
data = searchKey ? origin.filter((item: IUser) => data = searchKey ? origin.filter((item: IUser) =>
(item.username !== undefined && item.username !== null) && item.username.toLowerCase().includes(searchKey as string)) : origin ; (item.username !== undefined && item.username !== null) && item.username.toLowerCase().includes(searchKey as string)) : origin;
return data; return data;
} }

View File

@@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { alarm } from 'store/alarm'; import { alarm } from 'store/alarm';
import { IMonitorGroups } from 'types/base-type'; import { IMonitorGroups } from 'types/base-type';
import { getValueFromLocalStorage, setValueToLocalStorage } from 'lib/local-storage'; import { getValueFromLocalStorage, setValueToLocalStorage, deleteValueFromLocalStorage } from 'lib/local-storage';
import { VirtualScrollSelect } from '../../../component/virtual-scroll-select'; import { VirtualScrollSelect } from '../../../component/virtual-scroll-select';
interface IAlarmSelectProps { interface IAlarmSelectProps {
@@ -36,6 +36,10 @@ export class AlarmSelect extends React.Component<IAlarmSelectProps> {
onChange && onChange(params); onChange && onChange(params);
} }
public componentWillUnmount() {
deleteValueFromLocalStorage('monitorGroups');
}
public render() { public render() {
const { value, isDisabled } = this.props; const { value, isDisabled } = this.props;
return ( return (

View File

@@ -149,9 +149,9 @@ export class DynamicSetFilter extends React.Component<IDynamicProps> {
public handleSelectChange = (e: string, type: 'topic' | 'consumerGroup' | 'location') => { public handleSelectChange = (e: string, type: 'topic' | 'consumerGroup' | 'location') => {
switch (type) { switch (type) {
case 'topic': case 'topic':
if (!this.clusterId) { // if (!this.clusterId) {
return message.info('请选择集群'); // return message.info('请选择集群');
} // }
this.topicName = e; this.topicName = e;
const type = this.dealMonitorType(); const type = this.dealMonitorType();
if (['kafka-consumer-maxLag', 'kafka-consumer-maxDelayTime', 'kafka-consumer-lag'].indexOf(type) > -1) { if (['kafka-consumer-maxLag', 'kafka-consumer-maxDelayTime', 'kafka-consumer-lag'].indexOf(type) > -1) {

View File

@@ -9,6 +9,7 @@ import { pagination } from 'constants/table';
import { urlPrefix } from 'constants/left-menu'; import { urlPrefix } from 'constants/left-menu';
import { alarm } from 'store/alarm'; import { alarm } from 'store/alarm';
import 'styles/table-filter.less'; import 'styles/table-filter.less';
import { Link } from 'react-router-dom';
@observer @observer
export class AlarmList extends SearchAndFilterContainer { export class AlarmList extends SearchAndFilterContainer {
@@ -24,7 +25,7 @@ export class AlarmList extends SearchAndFilterContainer {
if (app.active !== '-1' || searchKey !== '') { if (app.active !== '-1' || searchKey !== '') {
data = origin.filter(d => data = origin.filter(d =>
((d.name !== undefined && d.name !== null) && d.name.toLowerCase().includes(searchKey as string) ((d.name !== undefined && d.name !== null) && d.name.toLowerCase().includes(searchKey as string)
|| ((d.operator !== undefined && d.operator !== null) && d.operator.toLowerCase().includes(searchKey as string))) || ((d.operator !== undefined && d.operator !== null) && d.operator.toLowerCase().includes(searchKey as string)))
&& (app.active === '-1' || d.appId === (app.active + '')), && (app.active === '-1' || d.appId === (app.active + '')),
); );
} else { } else {
@@ -55,9 +56,7 @@ export class AlarmList extends SearchAndFilterContainer {
{this.renderSearch('名称:', '请输入告警规则或者操作人')} {this.renderSearch('名称:', '请输入告警规则或者操作人')}
<li className="right-btn-1"> <li className="right-btn-1">
<Button type="primary"> <Button type="primary">
<a href={`${urlPrefix}/alarm/add`}> <Link to={`/alarm/add`}></Link>
</a>
</Button> </Button>
</li> </li>
</> </>
@@ -68,6 +67,9 @@ export class AlarmList extends SearchAndFilterContainer {
if (!alarm.monitorStrategies.length) { if (!alarm.monitorStrategies.length) {
alarm.getMonitorStrategies(); alarm.getMonitorStrategies();
} }
if (!app.data.length) {
app.getAppList();
}
} }
public render() { public render() {

View File

@@ -52,8 +52,7 @@ export class CommonAppList extends SearchAndFilterContainer {
}, },
}), }),
render: (text: string, record: IAppItem) => { render: (text: string, record: IAppItem) => {
return ( return (<Tooltip placement="bottomLeft" title={record.name}>{text}</Tooltip>);
<Tooltip placement="bottomLeft" title={record.name}>{text}</Tooltip>);
}, },
}, },
{ {
@@ -103,7 +102,7 @@ export class CommonAppList extends SearchAndFilterContainer {
} }
public getOnlineConnect(record: IAppItem) { public getOnlineConnect(record: IAppItem) {
modal.showOfflineAppModal(record.appId); modal.showOfflineAppNewModal(record.appId);
} }
public getData<T extends IAppItem>(origin: T[]) { public getData<T extends IAppItem>(origin: T[]) {
@@ -114,7 +113,7 @@ export class CommonAppList extends SearchAndFilterContainer {
data = searchKey ? origin.filter((item: IAppItem) => data = searchKey ? origin.filter((item: IAppItem) =>
((item.name !== undefined && item.name !== null) && item.name.toLowerCase().includes(searchKey as string)) || ((item.name !== undefined && item.name !== null) && item.name.toLowerCase().includes(searchKey as string)) ||
((item.principals !== undefined && item.principals !== null) && item.principals.toLowerCase().includes(searchKey as string)) || ((item.principals !== undefined && item.principals !== null) && item.principals.toLowerCase().includes(searchKey as string)) ||
((item.appId !== undefined && item.appId !== null) && item.appId.toLowerCase().includes(searchKey as string)) ) : origin; ((item.appId !== undefined && item.appId !== null) && item.appId.toLowerCase().includes(searchKey as string))) : origin;
return data; return data;
} }

View File

@@ -29,16 +29,16 @@ export class MyCluster extends SearchAndFilterContainer {
public applyCluster() { public applyCluster() {
const xFormModal = { const xFormModal = {
formMap: [ formMap: [
{ // {
key: 'idc', // key: 'idc',
label: '数据中心', // label: '数据中心',
defaultValue: region.regionName, // defaultValue: region.regionName,
rules: [{ required: true, message: '请输入数据中心' }], // rules: [{ required: true, message: '请输入数据中心' }],
attrs: { // attrs: {
placeholder: '请输入数据中心', // placeholder: '请输入数据中心',
disabled: true, // disabled: true,
}, // },
}, // },
{ {
key: 'appId', key: 'appId',
label: '所属应用', label: '所属应用',
@@ -91,7 +91,7 @@ export class MyCluster extends SearchAndFilterContainer {
], ],
formData: {}, formData: {},
visible: true, visible: true,
title: '申请集群', title: <div><span></span><a className='applicationDocument' href="https://github.com/didi/Logi-KafkaManager/blob/master/docs/user_guide/resource_apply.md" target='_blank'></a></div>,
okText: '确认', okText: '确认',
onSubmit: (value: any) => { onSubmit: (value: any) => {
value.idc = region.currentRegion; value.idc = region.currentRegion;

View File

@@ -117,12 +117,12 @@ class DataMigrationFormTable extends React.Component<IFormTableProps> {
key: 'maxThrottle', key: 'maxThrottle',
editable: true, editable: true,
}, { }, {
title: '迁移保存时间(h)', title: '迁移后Topic保存时间(h)',
dataIndex: 'reassignRetentionTime', dataIndex: 'reassignRetentionTime',
key: 'reassignRetentionTime', key: 'reassignRetentionTime',
editable: true, editable: true,
}, { }, {
title: '原保存时间(h)', title: '原Topic保存时间(h)',
dataIndex: 'retentionTime', dataIndex: 'retentionTime',
key: 'retentionTime', // originalRetentionTime key: 'retentionTime', // originalRetentionTime
width: '132px', width: '132px',

View File

@@ -133,15 +133,15 @@ export class GovernanceTopic extends SearchAndFilterContainer {
width: '30%', width: '30%',
sorter: (a: IResource, b: IResource) => a.topicName.charCodeAt(0) - b.topicName.charCodeAt(0), sorter: (a: IResource, b: IResource) => a.topicName.charCodeAt(0) - b.topicName.charCodeAt(0),
render: (text: string, item: IResource) => render: (text: string, item: IResource) =>
( (
<Tooltip placement="bottomLeft" title={text}> <Tooltip placement="bottomLeft" title={text}>
<a <a
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
href={`${this.urlPrefix}/topic/topic-detail?clusterId=${item.clusterId}&topic=${item.topicName}&isPhysicalClusterId=true&region=${region.currentRegion}`} href={`${this.urlPrefix}/topic/topic-detail?clusterId=${item.clusterId}&topic=${item.topicName}&isPhysicalClusterId=true&region=${region.currentRegion}`}
> >
{text} {text}
</a> </a>
</Tooltip>), </Tooltip>),
}, },
{ {
title: '所在集群', title: '所在集群',
@@ -215,7 +215,7 @@ export class GovernanceTopic extends SearchAndFilterContainer {
return ( return (
<> <>
{this.pendingTopic(this.getData(expert.resourceData))} {this.pendingTopic(this.getData(expert.resourceData))}
</> </>
); );
} }

View File

@@ -16,6 +16,14 @@
line-height: 64px; line-height: 64px;
vertical-align: middle; vertical-align: middle;
} }
.kafka-header-version{
display: inline-block;
vertical-align: middle;
padding-top:5px;
font-size: 12px;
margin-left:10px;
color:#a0a0a0;
}
} }
.mid-content { .mid-content {

View File

@@ -145,6 +145,8 @@ export const Header = observer((props: IHeader) => {
<div className="left-content"> <div className="left-content">
<img className="kafka-header-icon" src={logoUrl} alt="" /> <img className="kafka-header-icon" src={logoUrl} alt="" />
<span className="kafka-header-text">Kafka Manager</span> <span className="kafka-header-text">Kafka Manager</span>
<a className='kafka-header-version' href="https://github.com/didi/Logi-KafkaManager/releases" target='_blank'>v2.4.0</a>
{/* 添加版本超链接 */}
</div> </div>
<div className="mid-content"> <div className="mid-content">
{headerMenu.map((item: IMenuItem, index: number) => {headerMenu.map((item: IMenuItem, index: number) =>

View File

@@ -22,11 +22,11 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
}, },
{ {
key: 'appId', key: 'appId',
label: '应用ID', label: '应用名称',
type: 'select', type: 'select',
options: app.adminAppData.map(item => { options: app.adminAppData.map(item => {
return { return {
label: item.appId, label: item.name,
value: item.appId, value: item.appId,
}; };
}), }),
@@ -61,6 +61,7 @@ export const showEditClusterTopic = (item: IClusterTopics) => {
attrs: { attrs: {
placeholder: '请输入保存时间', placeholder: '请输入保存时间',
suffix: '小时', suffix: '小时',
prompttype: '修改保存时间,预计一分钟左右生效!'
}, },
}, },
{ {

View File

@@ -35,7 +35,6 @@ class CustomForm extends React.Component<IXFormProps> {
this.props.form.validateFields((err: any, values: any) => { this.props.form.validateFields((err: any, values: any) => {
const deleteData = this.props.formData; const deleteData = this.props.formData;
if (!err) { if (!err) {
// console.log('values', values);
if (values.topicName !== this.props.formData.topicName) { if (values.topicName !== this.props.formData.topicName) {
notification.error({ message: 'topic名称不正确请重新输入' }); notification.error({ message: 'topic名称不正确请重新输入' });
} else { } else {
@@ -77,7 +76,6 @@ class CustomForm extends React.Component<IXFormProps> {
} }
public render() { public render() {
// console.log('props', this.props);
const { formData = {} as any, visible } = this.props; const { formData = {} as any, visible } = this.props;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
let metadata = [] as IBrokersMetadata[]; let metadata = [] as IBrokersMetadata[];

View File

@@ -111,11 +111,11 @@ class CustomForm extends React.Component<IXFormProps> {
})(<Input placeholder="请输入分区数" />)} })(<Input placeholder="请输入分区数" />)}
</Form.Item> </Form.Item>
<Form.Item label="类型"> <Form.Item label="类型">
{/* <Form.Item label={this.state.checked ? 'Region类型' : 'Borker类型'} > */} {/* <Form.Item label={this.state.checked ? 'Region类型' : 'Broker类型'} > */}
{/* <Switch onChange={(checked) => this.onSwitchChange(checked)} /> */} {/* <Switch onChange={(checked) => this.onSwitchChange(checked)} /> */}
<Radio.Group value={this.state.checked ? 'region' : 'broker'} onChange={(e) => { this.onSwitchChange(e.target.value === 'region' ? true : false); }}> <Radio.Group value={this.state.checked ? 'region' : 'broker'} onChange={(e) => { this.onSwitchChange(e.target.value === 'region' ? true : false); }}>
<Radio.Button value="region">Region类型</Radio.Button> <Radio.Button value="region">Region类型</Radio.Button>
<Radio.Button value="broker">Borker类型</Radio.Button> <Radio.Button value="broker">Broker类型</Radio.Button>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
<Form.Item label="brokerIdList" style={{ display: this.state.checked ? 'none' : '' }}> <Form.Item label="brokerIdList" style={{ display: this.state.checked ? 'none' : '' }}>

View File

@@ -28,8 +28,8 @@ const updateInputModal = (status?: string) => {
formMap[4].invisible = status === 'region'; formMap[4].invisible = status === 'region';
formMap[5].invisible = status !== 'region'; formMap[5].invisible = status !== 'region';
formMap[4].rules = [{required: status !== 'region'}]; formMap[4].rules = [{ required: status !== 'region' }];
formMap[5].rules = [{required: status === 'region'}]; formMap[5].rules = [{ required: status === 'region' }];
// tslint:disable-next-line:no-unused-expression // tslint:disable-next-line:no-unused-expression
wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData); wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData);
}; };
@@ -103,7 +103,7 @@ export const createMigrationTasks = () => {
label: 'Region', label: 'Region',
value: 'region', value: 'region',
}, { }, {
label: 'Borker', label: 'Broker',
value: 'broker', value: 'broker',
}], }],
rules: [{ rules: [{
@@ -141,7 +141,7 @@ export const createMigrationTasks = () => {
placeholder: '请选择目标Region', placeholder: '请选择目标Region',
}, },
}, },
{ {
key: 'beginTime', key: 'beginTime',
label: '计划开始时间', label: '计划开始时间',
@@ -158,26 +158,26 @@ export const createMigrationTasks = () => {
}, },
{ {
key: 'originalRetentionTime', key: 'originalRetentionTime',
label: '原保存时间', label: '原Topic保存时间',
rules: [{ rules: [{
required: true, required: true,
message: '请输入原保存时间', message: '请输入原Topic保存时间',
}], }],
attrs: { attrs: {
disabled: true, disabled: true,
placeholder: '请输入原保存时间', placeholder: '请输入原Topic保存时间',
suffix: '小时', suffix: '小时',
}, },
}, },
{ {
key: 'reassignRetentionTime', key: 'reassignRetentionTime',
label: '迁移保存时间', label: '迁移后Topic保存时间',
rules: [{ rules: [{
required: true, required: true,
message: '请输入迁移保存时间', message: '请输入迁移后Topic保存时间',
}], }],
attrs: { attrs: {
placeholder: '请输入迁移保存时间', placeholder: '请输入迁移后Topic保存时间',
suffix: '小时', suffix: '小时',
}, },
}, },

View File

@@ -24,26 +24,111 @@ export const showApplyModal = (record?: IUser) => {
value: +item, value: +item,
})), })),
rules: [{ required: true, message: '请选择角色' }], rules: [{ required: true, message: '请选择角色' }],
}, { },
key: 'password', // {
label: '密码', // key: 'password',
type: FormItemType.inputPassword, // label: '密码',
rules: [{ required: !record, message: '请输入密码' }], // type: FormItemType.inputPassword,
}, // rules: [{ required: !record, message: '请输入密码' }],
// },
], ],
formData: record || {}, formData: record || {},
visible: true, visible: true,
title: record ? '修改用户' : '新增用户', title: record ? '修改用户' : '新增用户',
onSubmit: (value: IUser) => { onSubmit: (value: IUser) => {
if (record) { if (record) {
return users.modfiyUser(value).then(() => { return users.modfiyUser(value)
message.success('操作成功');
});
} }
return users.addUser(value).then(() => { return users.addUser(value).then(() => {
message.success('操作成功'); message.success('操作成功');
}); });
}, },
}; };
if(!record){
let formMap: any = xFormModal.formMap
formMap.splice(2, 0,{
key: 'password',
label: '密码',
type: FormItemType.inputPassword,
rules: [{ required: !record, message: '请输入密码' }],
},)
}
wrapper.open(xFormModal); wrapper.open(xFormModal);
}; };
// const handleCfPassword = (rule:any, value:any, callback:any)=>{
// if()
// }
export const showApplyModalModifyPassword = (record: IUser) => {
const xFormModal:any = {
formMap: [
// {
// key: 'oldPassword',
// label: '旧密码',
// type: FormItemType.inputPassword,
// rules: [{
// required: true,
// message: '请输入旧密码',
// }]
// },
{
key: 'newPassword',
label: '新密码',
type: FormItemType.inputPassword,
rules: [
{
required: true,
message: '请输入新密码',
}
],
attrs:{
onChange:(e:any)=>{
users.setNewPassWord(e.target.value)
}
}
},
{
key: 'confirmPassword',
label: '确认密码',
type: FormItemType.inputPassword,
rules: [
{
required: true,
message: '请确认密码',
validator:(rule:any, value:any, callback:any) => {
// 验证新密码的一致性
if(users.newPassWord){
if(value!==users.newPassWord){
rule.message = "两次密码输入不一致";
callback('两次密码输入不一致')
}else{
callback()
}
}else if(!value){
rule.message = "请确认密码";
callback('请确认密码');
}else{
callback()
}
},
}
],
},
],
formData: record || {},
visible: true,
title: '修改密码',
onSubmit: (value: IUser) => {
let params:any = {
username:record?.username,
password:value.confirmPassword,
role:record?.role,
}
return users.modfiyUser(params).then(() => {
message.success('操作成功');
});
},
}
wrapper.open(xFormModal);
};

View File

@@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { notification } from 'component/antd'; import { notification, Select } from 'component/antd';
import { IUploadFile, IConfigure } from 'types/base-type'; import { IUploadFile, IConfigure, IConfigGateway } from 'types/base-type';
import { version } from 'store/version'; import { version } from 'store/version';
import { admin } from 'store/admin'; import { admin } from 'store/admin';
import { wrapper } from 'store'; import { wrapper } from 'store';
@@ -97,8 +97,8 @@ const updateFormModal = (type: number) => {
formMap[2].attrs = { formMap[2].attrs = {
accept: version.fileSuffix, accept: version.fileSuffix,
}, },
// tslint:disable-next-line:no-unused-expression // tslint:disable-next-line:no-unused-expression
wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData, true); wrapper.ref && wrapper.ref.updateFormMap$(formMap, wrapper.xFormWrapper.formData, true);
} }
}; };
@@ -157,8 +157,8 @@ export const showModifyModal = (record: IUploadFile) => {
export const showConfigureModal = async (record?: IConfigure) => { export const showConfigureModal = async (record?: IConfigure) => {
if (record) { if (record) {
const result:any = await format2json(record.configValue); const result: any = await format2json(record.configValue);
record.configValue = result.result; record.configValue = result.result || record.configValue;
} }
const xFormModal = { const xFormModal = {
formMap: [ formMap: [
@@ -193,10 +193,69 @@ export const showConfigureModal = async (record?: IConfigure) => {
return admin.editConfigure(value).then(data => { return admin.editConfigure(value).then(data => {
notification.success({ message: '编辑配置成功' }); notification.success({ message: '编辑配置成功' });
}); });
} else {
return admin.addNewConfigure(value).then(data => {
notification.success({ message: '新建配置成功' });
});
}
},
};
wrapper.open(xFormModal);
};
export const showConfigGatewayModal = async (record?: IConfigGateway) => {
const xFormModal = {
formMap: [
{
key: 'type',
label: '配置类型',
rules: [{ required: true, message: '请选择配置类型' }],
type: "select",
options: admin.gatewayType.map((item: any, index: number) => ({
key: index,
label: item.configName,
value: item.configType,
})),
attrs: {
disabled: record ? true : false,
}
}, {
key: 'name',
label: '配置键',
rules: [{ required: true, message: '请输入配置键' }],
attrs: {
disabled: record ? true : false,
},
}, {
key: 'value',
label: '配置值',
type: 'text_area',
rules: [{
required: true,
message: '请输入配置值',
}],
}, {
key: 'description',
label: '描述',
type: 'text_area',
rules: [{ required: true, message: '请输入备注' }],
},
],
formData: record || {},
visible: true,
isWaitting: true,
title: `${record ? '编辑配置' : '新建配置'}`,
onSubmit: async (parmas: IConfigGateway) => {
if (record) {
parmas.id = record.id;
return admin.editConfigGateway(parmas).then(data => {
notification.success({ message: '编辑配置成功' });
});
} else {
return admin.addNewConfigGateway(parmas).then(data => {
notification.success({ message: '新建配置成功' });
});
} }
return admin.addNewConfigure(value).then(data => {
notification.success({ message: '新建配置成功' });
});
}, },
}; };
wrapper.open(xFormModal); wrapper.open(xFormModal);

View File

@@ -85,7 +85,7 @@ export const showEditModal = (record?: IAppItem, from?: string, isDisabled?: boo
], ],
formData: record, formData: record,
visible: true, visible: true,
title: isDisabled ? '详情' : record ? '编辑' : <div><span></span><a className='applicationDocument' href="###" target='_blank'></a></div>, title: isDisabled ? '详情' : record ? '编辑' : <div><span></span><a className='applicationDocument' href="https://github.com/didi/Logi-KafkaManager/blob/master/docs/user_guide/resource_apply.md" target='_blank'></a></div>,
// customRenderElement: isDisabled ? '' : record ? '' : <span className="tips">集群资源充足时预计1分钟自动审批通过</span>, // customRenderElement: isDisabled ? '' : record ? '' : <span className="tips">集群资源充足时预计1分钟自动审批通过</span>,
isWaitting: true, isWaitting: true,
onSubmit: (value: IAppItem) => { onSubmit: (value: IAppItem) => {

View File

@@ -20,14 +20,14 @@ export interface IRenderData {
} }
export const migrationModal = (renderData: IRenderData[]) => { export const migrationModal = (renderData: IRenderData[]) => {
const xFormWrapper = { const xFormWrapper = {
type: 'drawer', type: 'drawer',
visible: true, visible: true,
width: 1000, width: 1000,
title: '新建迁移任务', title: '新建迁移任务',
customRenderElement: <WrappedDataMigrationFormTable data={renderData}/>, customRenderElement: <WrappedDataMigrationFormTable data={renderData} />,
nofooter: true, nofooter: true,
noform: true, noform: true,
}; };
wrapper.open(xFormWrapper as IXFormWrapper); wrapper.open(xFormWrapper as IXFormWrapper);
}; };

View File

@@ -0,0 +1,78 @@
import * as React from 'react';
import { Table, Modal, Tooltip, Icon, message, notification, Alert, Button } from 'component/antd';
import { app } from 'store/app';
import { getApplyOnlineColumns } from 'container/topic/config';
import { observer } from 'mobx-react';
import { modal } from 'store/modal';
import { users } from 'store/users';
import { urlPrefix } from 'constants/left-menu';
import { region } from 'store';
@observer
export class ConnectAppNewList extends React.Component {
public componentDidMount() {
app.getAppsConnections(modal.params);
}
public handleCancel = () => {
app.setAppsConnections([]);
modal.close();
}
public handleSubmit = () => {
const connectionList = app.appsConnections;
if (connectionList && connectionList.length) {
return message.warning('存在连接信息,无法申请下线!');
}
const offlineParams = {
type: 11,
applicant: users.currentUser.username,
description: '',
extensions: JSON.stringify({ appId: modal.params }),
};
app.applyAppOffline(offlineParams).then((data: any) => {
notification.success({ message: '申请下线成功' });
window.location.href = `${urlPrefix}/user/order-detail/?orderId=${data.id}&region=${region.currentRegion}`;
});
modal.close();
}
public render() {
const connectionList = app.appsConnections;
return (
<>
<Modal
visible={true}
className="stream-debug-modal"
title="提示"
maskClosable={false}
onCancel={this.handleCancel}
// onOk={this.handleSubmit}
// okText="确认"
// cancelText="取消"
okButtonProps={{ disabled: app.connectLoading || !!app.appsConnections.length }}
footer={connectionList && connectionList.length ?
<Button type="primary" onClick={this.handleCancel}></Button>
:
<>
<Button onClick={this.handleCancel}></Button>
<Button type="primary" onClick={this.handleSubmit}></Button>
</>
}
width={500}
>
<div style={{ textAlign: 'center', fontWeight: "bolder" }}>
{
connectionList && connectionList.length
?
<span>Topic关联Topic之间的关系<a href={`${urlPrefix}/topic/app-detail?appId=${modal.params}`}></a></span>
:
<span>线AppID</span>
}
</div>
</Modal>
</>
);
}
}

View File

@@ -4,6 +4,7 @@ import { message, Icon, notification, Modal, Table, Tooltip } from 'component/an
import { IApprovalOrder, IBaseOrder, IOrderInfo } from 'types/base-type'; import { IApprovalOrder, IBaseOrder, IOrderInfo } from 'types/base-type';
import { admin } from 'store/admin'; import { admin } from 'store/admin';
import { modal } from 'store/modal'; import { modal } from 'store/modal';
import { cluster } from 'store/cluster';
import { cellStyle } from 'constants/table'; import { cellStyle } from 'constants/table';
import * as React from 'react'; import * as React from 'react';
@@ -37,6 +38,12 @@ const renderModalTilte = (type: number, status: number) => {
export const showApprovalModal = (info: IOrderInfo, status: number, from?: string) => { export const showApprovalModal = (info: IOrderInfo, status: number, from?: string) => {
const { id, type } = info; const { id, type } = info;
const formMap = [{ const formMap = [{
key: 'clusterId',
label: '所属集群',
type: 'input_number',
defaultValue: info.detail.logicalClusterName,
attrs: { disabled: true },
}, {
key: 'partitionNum', key: 'partitionNum',
label: '分区数', label: '分区数',
type: 'input_number', type: 'input_number',
@@ -75,8 +82,8 @@ export const showApprovalModal = (info: IOrderInfo, status: number, from?: strin
// }], // }],
rules: [{ rules: [{
required: true, required: true,
message: '请输入大于12小于999的整数', message: '请输入大于0小于10000的整数',
pattern: /^([1-9]{1}[0-9]{2})$|^([2-9]{1}[0-9]{1})$|^(1[2-9]{1})$/, pattern: /^\+?[1-9]\d{0,3}(\.\d*)?$/,
}], }],
}, { }, {
key: 'species', key: 'species',
@@ -87,7 +94,7 @@ export const showApprovalModal = (info: IOrderInfo, status: number, from?: strin
label: 'Region', label: 'Region',
value: 'region', value: 'region',
}, { }, {
label: 'Borker', label: 'Broker',
value: 'broker', value: 'broker',
}], }],
rules: [{ required: false, message: '请选择类型' }], rules: [{ required: false, message: '请选择类型' }],

View File

@@ -88,7 +88,7 @@ export const applyTopic = () => {
], ],
formData: {}, formData: {},
visible: true, visible: true,
title: '申请Topic', title: <div><span>Topic</span><a className='applicationDocument' href="https://github.com/didi/Logi-KafkaManager/blob/master/docs/user_guide/resource_apply.md" target='_blank'></a></div>,
okText: '确认', okText: '确认',
// customRenderElement: <span className="tips">集群资源充足时预计1分钟自动审批通过</span>, // customRenderElement: <span className="tips">集群资源充足时预计1分钟自动审批通过</span>,
isWaitting: true, isWaitting: true,
@@ -399,8 +399,8 @@ export const updateAllTopicFormModal = () => {
const formMap = wrapper.xFormWrapper.formMap; const formMap = wrapper.xFormWrapper.formMap;
if (topic.authorities) { if (topic.authorities) {
const { consume, send, checkStatus } = judgeAccessStatus(topic.authorities.access); const { consume, send, checkStatus } = judgeAccessStatus(topic.authorities.access);
formMap[3].defaultValue = checkStatus; formMap[2].defaultValue = checkStatus;
formMap[3].options = [{ formMap[2].options = [{
label: `消费权限${consume ? '(已拥有)' : ''}`, label: `消费权限${consume ? '(已拥有)' : ''}`,
value: '1', value: '1',
disabled: consume, disabled: consume,
@@ -409,7 +409,7 @@ export const updateAllTopicFormModal = () => {
value: '2', value: '2',
disabled: send, disabled: send,
}]; }];
formMap[3].rules = [{ formMap[2].rules = [{
required: true, required: true,
validator: (rule: any, value: any, callback: any) => getPowerValidator(rule, value, callback, checkStatus, 'allTopic'), validator: (rule: any, value: any, callback: any) => getPowerValidator(rule, value, callback, checkStatus, 'allTopic'),
}]; }];
@@ -476,7 +476,6 @@ export const showAllPermissionModal = (item: ITopic) => {
const showAllPermission = (appId: string, item: ITopic, access: number) => { const showAllPermission = (appId: string, item: ITopic, access: number) => {
const { consume, send, checkStatus } = judgeAccessStatus(access); const { consume, send, checkStatus } = judgeAccessStatus(access);
const xFormModal = { const xFormModal = {
formMap: [ formMap: [
{ {
@@ -489,16 +488,6 @@ const showAllPermission = (appId: string, item: ITopic, access: number) => {
disabled: true, disabled: true,
}, },
}, },
{
key: 'clusterName',
label: '集群名称',
defaultValue: item.clusterName,
rules: [{ required: true, message: '请输入集群名称' }],
attrs: {
placeholder: '请输入集群名称',
disabled: true,
},
},
{ {
key: 'appId', key: 'appId',
label: '绑定应用', label: '绑定应用',
@@ -526,6 +515,26 @@ const showAllPermission = (appId: string, item: ITopic, access: number) => {
validator: (rule: any, value: any, callback: any) => getPowerValidator(rule, value, callback, checkStatus, 'allTopic'), validator: (rule: any, value: any, callback: any) => getPowerValidator(rule, value, callback, checkStatus, 'allTopic'),
}], }],
}, },
// {
// key: 'clusterName',
// label: '集群名称',
// defaultValue: item.clusterName,
// rules: [{ required: true, message: '请输入集群名称' }],
// attrs: {
// placeholder: '请输入集群名称',
// disabled: true,
// },
// },
// {
// key: 'clusterName',
// label: '集群名称',
// defaultValue: item.clusterName,
// rules: [{ required: true, message: '请输入集群名称' }],
// attrs: {
// placeholder: '请输入集群名称',
// disabled: true,
// },
// },
{ {
key: 'description', key: 'description',
label: '申请原因', label: '申请原因',
@@ -587,16 +596,16 @@ export const showPermissionModal = (item: ITopic) => {
disabled: true, disabled: true,
}, },
}, },
{ // {
key: 'clusterName', // key: 'clusterName',
label: '集群名称', // label: '集群名称',
defaultValue: item.clusterName, // defaultValue: item.clusterName,
rules: [{ required: true, message: '请输入集群名称' }], // rules: [{ required: true, message: '请输入集群名称' }],
attrs: { // attrs: {
placeholder: '请输入集群名称', // placeholder: '请输入集群名称',
disabled: true, // disabled: true,
}, // },
}, // },
{ {
key: 'appName', key: 'appName',
label: '绑定应用', label: '绑定应用',

View File

@@ -126,7 +126,7 @@ export class SearchAndFilterContainer extends React.Component<any, ISearchAndFil
); );
} }
public renderSearch(text?: string, placeholder?: string, keyName: string = 'searchKey') { public renderSearch(text?: string, placeholder?: string, keyName: string = 'searchKey',) {
const value = this.state[keyName] as string; const value = this.state[keyName] as string;
return ( return (
<li className="render-box"> <li className="render-box">
@@ -194,7 +194,7 @@ export class SearchAndFilterContainer extends React.Component<any, ISearchAndFil
); );
} }
public renderColumnsFilter = (type: string) => { public renderColumnsFilter = (type: string, params?: any) => {
return { return {
filterIcon: this.renderFilterIcon.bind(null, type), filterIcon: this.renderFilterIcon.bind(null, type),
filterDropdownVisible: this.state[type] as boolean, filterDropdownVisible: this.state[type] as boolean,

View File

@@ -28,7 +28,8 @@ export class StaffSelect extends React.Component<IStaffSelectProps> {
public getStaffList = () => { public getStaffList = () => {
const { value } = this.props; const { value } = this.props;
const current = users.currentUser.username || getCookie('username'); const current = users.currentUser.username || getCookie('username');
const principals = value || (current ? [current] : []); const principals = [''];
// const principals = value || (current ? [current] : []);
const promises: any[] = []; const promises: any[] = [];
for (const item of principals) { for (const item of principals) {
@@ -64,7 +65,6 @@ export class StaffSelect extends React.Component<IStaffSelectProps> {
const { value, isDisabled } = this.props; const { value, isDisabled } = this.props;
const current = users.currentUser.username || getCookie('username'); const current = users.currentUser.username || getCookie('username');
const principals = value || (current ? [current] : []); const principals = value || (current ? [current] : []);
return ( return (
<Select <Select
mode="multiple" mode="multiple"
@@ -72,6 +72,7 @@ export class StaffSelect extends React.Component<IStaffSelectProps> {
defaultValue={principals} defaultValue={principals}
onChange={(e: string[]) => this.handleChange(e)} onChange={(e: string[]) => this.handleChange(e)}
onSearch={(e: string) => this.handleSearch(e)} onSearch={(e: string) => this.handleSearch(e)}
onFocus={() => this.getFocus()}
disabled={isDisabled} disabled={isDisabled}
{...searchProps} {...searchProps}
> >
@@ -83,6 +84,10 @@ export class StaffSelect extends React.Component<IStaffSelectProps> {
); );
} }
public getFocus() {
this.getStaffList();
}
public handleSearch(params: string) { public handleSearch(params: string) {
debounce(() => { debounce(() => {
getStaff(params).then((data: IStaff[]) => { getStaff(params).then((data: IStaff[]) => {
@@ -98,9 +103,9 @@ export class StaffSelect extends React.Component<IStaffSelectProps> {
}); });
}, 300)(); }, 300)();
} }
public handleChange(params: string[]) { public handleChange(params: string[]) {
const { onChange } = this.props; const { onChange } = this.props;
// tslint:disable-next-line:no-unused-expression // tslint:disable-next-line:no-unused-expression
onChange && onChange(params); onChange && onChange(params);
} }

View File

@@ -129,16 +129,17 @@ export class BaseInformation extends React.Component<IInfoProps> {
} }
public realTimeTraffic() { public realTimeTraffic() {
const realTraffic = topic.realTraffic; // const realTraffic = topic.realTraffic;
if (realTraffic) {
return ( // if (realTraffic) {
<> return (
<Spin spinning={topic.realLoading}> <>
{renderTrafficTable(this.updateRealStatus, StatusGragh)} <Spin spinning={topic.realLoading}>
</Spin> {renderTrafficTable(this.updateRealStatus, StatusGragh)}
</> </Spin>
); </>
} );
// }
} }
public realTimeConsume() { public realTimeConsume() {

View File

@@ -101,7 +101,9 @@ export class ConnectInformation extends SearchAndFilterContainer {
<> <>
<div className="k-row" > <div className="k-row" >
<ul className="k-tab"> <ul className="k-tab">
<li></li> <li>
<span style={{ color: '#a7a8a9', fontSize: '12px', padding: '0 15px' }}>20</span>
</li>
{this.renderSearch('', '请输入连接信息', 'searchKey')} {this.renderSearch('', '请输入连接信息', 'searchKey')}
</ul> </ul>
{this.renderConnectionInfo(this.getData(topic.connectionInfo))} {this.renderConnectionInfo(this.getData(topic.connectionInfo))}

View File

@@ -138,7 +138,7 @@ export class GroupID extends SearchAndFilterContainer {
public renderConsumerDetails() { public renderConsumerDetails() {
const consumerGroup = this.consumerGroup; const consumerGroup = this.consumerGroup;
const columns = [{ const columns: any = [{
title: 'Partition ID', title: 'Partition ID',
dataIndex: 'partitionId', dataIndex: 'partitionId',
key: 'partitionId', key: 'partitionId',
@@ -179,7 +179,8 @@ export class GroupID extends SearchAndFilterContainer {
<> <>
<div className="details-box"> <div className="details-box">
<b>{consumerGroup}</b> <b>{consumerGroup}</b>
<div> <div style={{ display: 'flex' }}>
{this.renderSearch('', '请输入Consumer ID')}
<Button onClick={this.backToPage}></Button> <Button onClick={this.backToPage}></Button>
<Button onClick={this.updateDetailsStatus}></Button> <Button onClick={this.updateDetailsStatus}></Button>
<Button onClick={() => this.showResetOffset()}>Offset</Button> <Button onClick={() => this.showResetOffset()}>Offset</Button>
@@ -187,7 +188,7 @@ export class GroupID extends SearchAndFilterContainer {
</div> </div>
<Table <Table
columns={columns} columns={columns}
dataSource={topic.consumeDetails} dataSource={this.getDetailData(topic.consumeDetails)}
rowKey="key" rowKey="key"
pagination={pagination} pagination={pagination}
/> />
@@ -214,7 +215,12 @@ export class GroupID extends SearchAndFilterContainer {
dataIndex: 'location', dataIndex: 'location',
key: 'location', key: 'location',
width: '34%', width: '34%',
}, }, {
title: '状态',
dataIndex: 'state',
key: 'state',
width: '34%',
}
]; ];
return ( return (
<> <>
@@ -236,7 +242,17 @@ export class GroupID extends SearchAndFilterContainer {
data = searchKey ? origin.filter((item: IConsumerGroups) => data = searchKey ? origin.filter((item: IConsumerGroups) =>
(item.consumerGroup !== undefined && item.consumerGroup !== null) && item.consumerGroup.toLowerCase().includes(searchKey as string), (item.consumerGroup !== undefined && item.consumerGroup !== null) && item.consumerGroup.toLowerCase().includes(searchKey as string),
) : origin ; ) : origin;
return data;
}
public getDetailData<T extends IConsumeDetails>(origin: T[]) {
let data: T[] = origin;
let { searchKey } = this.state;
searchKey = (searchKey + '').trim().toLowerCase();
data = searchKey ? origin.filter((item: IConsumeDetails) =>
(item.clientId !== undefined && item.clientId !== null) && item.clientId.toLowerCase().includes(searchKey as string),
) : origin;
return data; return data;
} }

View File

@@ -71,32 +71,32 @@ class ResetOffset extends React.Component<any> {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { typeValue, offsetValue } = this.state; const { typeValue, offsetValue } = this.state;
return ( return (
<> <>
<Alert message="重置之前一定要关闭消费客户端" type="warning" showIcon={true} /> <Alert message="重置消费偏移前,请先关闭客户端,否则会重置失败 " type="warning" showIcon={true} />
<Alert message="重置之前一定要关闭消费客户端" type="warning" showIcon={true} /> <Alert message="关闭客户端后,请等待一分钟之后再重置消费偏移 " type="warning" showIcon={true} />
<Alert message="重置之前一定要关闭消费客户端!!!" type="warning" showIcon={true} className="mb-30"/> {/* <Alert message="重置之前一定要关闭消费客户端!!!" type="warning" showIcon={true} className="mb-30" /> */}
<div className="o-container"> <div className="o-container">
<Form labelAlign="left" onSubmit={this.handleSubmit} > <Form labelAlign="left" onSubmit={this.handleSubmit} >
<Radio.Group onChange={this.onChangeType} value={typeValue}> <Radio.Group onChange={this.onChangeType} value={typeValue}>
<Radio value="time"><span className="title-con"></span></Radio> <Radio value="time"><span className="title-con"></span></Radio>
<Row> <Row>
<Col span={26}> <Col span={26}>
<Form.Item label="" > <Form.Item label="" >
<Radio.Group <Radio.Group
onChange={this.onChangeOffset} onChange={this.onChangeOffset}
value={offsetValue} value={offsetValue}
disabled={typeValue === 'partition'} disabled={typeValue === 'partition'}
defaultValue="offset" defaultValue="offset"
className="mr-10" className="mr-10"
> >
<Radio.Button value="offset">offset</Radio.Button> <Radio.Button value="offset">offset</Radio.Button>
<Radio.Button value="custom"></Radio.Button> <Radio.Button value="custom"></Radio.Button>
</Radio.Group> </Radio.Group>
{typeValue === 'time' && offsetValue === 'custom' && {typeValue === 'time' && offsetValue === 'custom' &&
getFieldDecorator('timestamp', { getFieldDecorator('timestamp', {
rules: [{ required: false, message: '' }], rules: [{ required: false, message: '' }],
initialValue: moment(), initialValue: moment(),
})( })(
<DatePicker <DatePicker
showTime={true} showTime={true}
format={timeMinute} format={timeMinute}
@@ -109,7 +109,7 @@ class ResetOffset extends React.Component<any> {
</Col> </Col>
</Row> </Row>
<Radio value="partition"><span className="title-con"></span></Radio> <Radio value="partition"><span className="title-con"></span></Radio>
</Radio.Group> </Radio.Group>
<Row> <Row>
<Form.Item> <Form.Item>
<Row> <Row>

View File

@@ -30,7 +30,7 @@ export const getInfoRenderItem = (orderInfo: IOrderInfo, result: boolean) => {
value: orderInfo.detail.principals, value: orderInfo.detail.principals,
}]; }];
const clusterTypelist: ILabelValue[] = [ { const clusterTypelist: ILabelValue[] = [{
label: '物理集群名称', label: '物理集群名称',
value: orderInfo.detail.physicalClusterName, value: orderInfo.detail.physicalClusterName,
}, { }, {
@@ -80,23 +80,25 @@ export const getInfoRenderItem = (orderInfo: IOrderInfo, result: boolean) => {
phyAuthOfflineList.splice(3, 0, ...clusterTypelist); phyAuthOfflineList.splice(3, 0, ...clusterTypelist);
const clusterInfoList: ILabelValue[] = [{ const clusterInfoList: ILabelValue[] = [{
label: '流入流量', label: '流入流量',
value: `${transBToMB(orderInfo.detail.bytesIn)} MB/s`, value: `${transBToMB(orderInfo.detail.bytesIn)} MB/s`,
}, { },
label: '数据中心', // {
value: orderInfo.detail.idc, // label: '数据中心',
}, { // value: orderInfo.detail.idc,
label: '集群类型', // },
value: clusterTypeMap[orderInfo.detail.mode], {
}, { label: '集群类型',
label: '应用ID', value: clusterTypeMap[orderInfo.detail.mode],
value: orderInfo.detail.appId, }, {
}, label: '应用ID',
value: orderInfo.detail.appId,
},
]; ];
const clusterOfflineList: ILabelValue[] = expansionList; const clusterOfflineList: ILabelValue[] = expansionList;
const phyClusterOfflineList: ILabelValue[] = clusterTypelist; const phyClusterOfflineList: ILabelValue[] = clusterTypelist;
const maxAvgBytesIn = orderInfo.detail.maxAvgBytesInList && orderInfo.detail.maxAvgBytesInList.map(item => { const maxAvgBytesIn = orderInfo.detail.maxAvgBytesInList && orderInfo.detail.maxAvgBytesInList.map(item => {
const val = `${transBToMB(item)} MB/s`; const val = `${transBToMB(item)} MB/s`;
return val; return val;
}); });
@@ -125,18 +127,18 @@ export const getInfoRenderItem = (orderInfo: IOrderInfo, result: boolean) => {
phyQuotaInfoList.splice(3, 0, ...clusterTypelist); phyQuotaInfoList.splice(3, 0, ...clusterTypelist);
const partitionList: ILabelValue[] = expansionList.concat([{ const partitionList: ILabelValue[] = expansionList.concat([{
label: 'Topic名称', label: 'Topic名称',
value: orderInfo.detail.topicName, value: orderInfo.detail.topicName,
}, { }, {
label: '申请分区数', label: '申请分区数',
value: orderInfo.detail.needIncrPartitionNum, value: orderInfo.detail.needIncrPartitionNum,
}, { }, {
label: '当前流入流量', label: '当前流入流量',
value: `${transBToMB(orderInfo.detail.bytesIn)} MB/s`, value: `${transBToMB(orderInfo.detail.bytesIn)} MB/s`,
}, { }, {
label: '近三天峰值流入流量', label: '近三天峰值流入流量',
value: maxAvgBytesIn && maxAvgBytesIn.join('、'), value: maxAvgBytesIn && maxAvgBytesIn.join('、'),
}, },
]); ]);
const phyPartitionList: ILabelValue[] = partitionList.filter(i => !cluster.includes(i.label)); const phyPartitionList: ILabelValue[] = partitionList.filter(i => !cluster.includes(i.label));

View File

@@ -133,6 +133,12 @@ export class OrderDetail extends React.Component {
width: '20%', width: '20%',
render: (t: string) => <span>{t === 'consumer' ? '消费' : '生产'}</span>, render: (t: string) => <span>{t === 'consumer' ? '消费' : '生产'}</span>,
}, },
// {
// title: '客户端语言',
// dataIndex: 'language',
// key: 'language',
// width: '20%',
// },
]; ];
return ( return (
<> <>

View File

@@ -3,6 +3,7 @@ import { observer } from 'mobx-react';
import { modal } from 'store/modal'; import { modal } from 'store/modal';
import { ConnectTopicList } from '../modal/connect-topic-list'; import { ConnectTopicList } from '../modal/connect-topic-list';
import { ConnectAppList } from '../modal/offline-app-modal'; import { ConnectAppList } from '../modal/offline-app-modal';
import { ConnectAppNewList } from '../modal/offline-app-modal-new';
import { CancelTopicPermission } from 'container/modal/cancel-topic-permission'; import { CancelTopicPermission } from 'container/modal/cancel-topic-permission';
import { OfflineClusterModal } from 'container/modal/offline-cluster-modal'; import { OfflineClusterModal } from 'container/modal/offline-cluster-modal';
import { RenderOrderOpResult } from 'container/modal/order'; import { RenderOrderOpResult } from 'container/modal/order';
@@ -22,6 +23,7 @@ export default class AllCustomModalInOne extends React.Component {
const modalMap = { const modalMap = {
offlineTopicModal: <ConnectTopicList />, offlineTopicModal: <ConnectTopicList />,
offlineAppNewModal: <ConnectAppNewList />,
offlineAppModal: <ConnectAppList />, offlineAppModal: <ConnectAppList />,
cancelTopicPermission: <CancelTopicPermission />, cancelTopicPermission: <CancelTopicPermission />,
offlineClusterModal: <OfflineClusterModal />, offlineClusterModal: <OfflineClusterModal />,

View File

@@ -1,5 +1,5 @@
import fetch, { formFetch } from './fetch'; import fetch, { formFetch } from './fetch';
import { IUploadFile, IUser, IQuotaModelItem, ILimitsItem, ITopic, IOrderParams, ISample, IMigration, IExecute, IEepand, IUtils, ITopicMetriceParams, IRegister, IEditTopic, IExpand, IDeleteTopic, INewRegions, INewLogical, IRebalance, INewBulidEnums, ITrigger, IApprovalOrder, IMonitorSilences, IConfigure, IBatchApproval } from 'types/base-type'; import { IUploadFile, IUser, IQuotaModelItem, ILimitsItem, ITopic, IOrderParams, ISample, IMigration, IExecute, IEepand, IUtils, ITopicMetriceParams, IRegister, IEditTopic, IExpand, IDeleteTopic, INewRegions, INewLogical, IRebalance, INewBulidEnums, ITrigger, IApprovalOrder, IMonitorSilences, IConfigure, IConfigGateway, IBatchApproval } from 'types/base-type';
import { IRequestParams } from 'types/alarm'; import { IRequestParams } from 'types/alarm';
import { apiCache } from 'lib/api-cache'; import { apiCache } from 'lib/api-cache';
@@ -418,6 +418,13 @@ export const getMetaData = (needDetail: boolean = true) => {
return fetch(`/rd/clusters/basic-info?need-detail=${needDetail}`); return fetch(`/rd/clusters/basic-info?need-detail=${needDetail}`);
}; };
export const getOperationRecordData = (params: any) => {
return fetch(`/rd/operate-record`,{
method: 'POST',
body: JSON.stringify(params),
});
};
export const getConfigure = () => { export const getConfigure = () => {
return fetch(`/rd/configs`); return fetch(`/rd/configs`);
}; };
@@ -442,6 +449,34 @@ export const deleteConfigure = (configKey: string) => {
}); });
}; };
export const getGatewayList = () => {
return fetch(`/rd/gateway-configs`);
};
export const getGatewayType = () => {
return fetch(`/op/gateway-configs/type-enums`);
};
export const addNewConfigGateway = (params: IConfigGateway) => {
return fetch(`/op/gateway-configs`, {
method: 'POST',
body: JSON.stringify(params),
});
};
export const editConfigGateway = (params: IConfigGateway) => {
return fetch(`/op/gateway-configs`, {
method: 'PUT',
body: JSON.stringify(params),
});
};
export const deleteConfigGateway = (params: IConfigure) => {
return fetch(`/op/gateway-configs`, {
method: 'DELETE',
body: JSON.stringify(params),
});
};
export const getDataCenter = () => { export const getDataCenter = () => {
return fetch(`/normal/configs/idc`); return fetch(`/normal/configs/idc`);
}; };
@@ -530,6 +565,23 @@ export const getControllerHistory = (clusterId: number) => {
return fetch(`/rd/clusters/${clusterId}/controller-history`); return fetch(`/rd/clusters/${clusterId}/controller-history`);
}; };
export const getCandidateController = (clusterId: number) => {
return fetch(`/rd/clusters/${clusterId}/controller-preferred-candidates`);
};
export const addCandidateController = (params:any) => {
return fetch(`/op/cluster-controller/preferred-candidates`, {
method: 'POST',
body: JSON.stringify(params),
});
};
export const deleteCandidateCancel = (params:any)=>{
return fetch(`/op/cluster-controller/preferred-candidates`, {
method: 'DELETE',
body: JSON.stringify(params),
});
}
/** /**
* 运维管控 broker * 运维管控 broker
*/ */

View File

@@ -77,7 +77,7 @@ export const getControlMetricOption = (type: IOptionType, data: IClusterMetrics[
name = '条'; name = '条';
data.map(item => { data.map(item => {
item.messagesInPerSec = item.messagesInPerSec !== null ? Number(item.messagesInPerSec.toFixed(2)) : null; item.messagesInPerSec = item.messagesInPerSec !== null ? Number(item.messagesInPerSec.toFixed(2)) : null;
}); });
break; break;
case 'brokerNum': case 'brokerNum':
case 'topicNum': case 'topicNum':
@@ -224,7 +224,7 @@ export const getClusterMetricOption = (type: IOptionType, record: IClusterMetric
name = '条'; name = '条';
data.map(item => { data.map(item => {
item.messagesInPerSec = item.messagesInPerSec !== null ? Number(item.messagesInPerSec.toFixed(2)) : null; item.messagesInPerSec = item.messagesInPerSec !== null ? Number(item.messagesInPerSec.toFixed(2)) : null;
}); });
break; break;
default: default:
const { name: unitName, data: xData } = dealFlowData(metricTypeMap[type], data); const { name: unitName, data: xData } = dealFlowData(metricTypeMap[type], data);
@@ -248,8 +248,8 @@ export const getClusterMetricOption = (type: IOptionType, record: IClusterMetric
const unitSeries = item.data[item.seriesName] !== null ? Number(item.data[item.seriesName]) : null; const unitSeries = item.data[item.seriesName] !== null ? Number(item.data[item.seriesName]) : null;
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
result += '<span style="display:inline-block;margin-right:0px;border-radius:10px;width:9px;height:9px;background-color:' + item.color + '"></span>'; result += '<span style="display:inline-block;margin-right:0px;border-radius:10px;width:9px;height:9px;background-color:' + item.color + '"></span>';
if ( (item.data.produceThrottled && item.seriesName === 'appIdBytesInPerSec') if ((item.data.produceThrottled && item.seriesName === 'appIdBytesInPerSec')
|| (item.data.consumeThrottled && item.seriesName === 'appIdBytesOutPerSec') ) { || (item.data.consumeThrottled && item.seriesName === 'appIdBytesOutPerSec')) {
return result += item.seriesName + ': ' + unitSeries + '(被限流)' + '<br>'; return result += item.seriesName + ': ' + unitSeries + '(被限流)' + '<br>';
} }
return result += item.seriesName + ': ' + unitSeries + '<br>'; return result += item.seriesName + ': ' + unitSeries + '<br>';
@@ -317,7 +317,7 @@ export const getMonitorMetricOption = (seriesName: string, data: IMetricPoint[])
if (ele.name === item.seriesName) { if (ele.name === item.seriesName) {
// tslint:disable-next-line:max-line-length // tslint:disable-next-line:max-line-length
result += '<span style="display:inline-block;margin-right:0px;border-radius:10px;width:9px;height:9px;background-color:' + item.color + '"></span>'; result += '<span style="display:inline-block;margin-right:0px;border-radius:10px;width:9px;height:9px;background-color:' + item.color + '"></span>';
return result += item.seriesName + ': ' + (item.data.value === null ? '' : item.data.value.toFixed(2)) + '<br>'; return result += item.seriesName + ': ' + (item.data.value === null ? '' : item.data.value.toFixed(2)) + '<br>';
} }
}); });
}); });

View File

@@ -3,7 +3,7 @@ import CommonRoutePage from './common';
import urlParser from 'lib/url-parser'; import urlParser from 'lib/url-parser';
import urlQuery from 'store/url-query'; import urlQuery from 'store/url-query';
import { AppDetail } from 'container/app'; import { AppDetail } from 'container/app';
import { AdminAppList, ClusterList, ClusterDetail, BrokerDetail, UserManagement, VersionManagement, OperationManagement, OperationDetail, BillManagement, ConfigureManagement, IndividualBill, MigrationDetail, BillDetail } from 'container/admin'; import { AdminAppList, ClusterList, ClusterDetail, BrokerDetail, UserManagement, VersionManagement, OperationManagement, OperationDetail, BillManagement, ConfigureManagement, IndividualBill, MigrationDetail, BillDetail, OperationRecord } from 'container/admin';
import { PlatformManagement } from 'container/admin/platform-management'; import { PlatformManagement } from 'container/admin/platform-management';
export default class Home extends React.Component<any> { export default class Home extends React.Component<any> {
@@ -52,7 +52,11 @@ export default class Home extends React.Component<any> {
path: '/admin/migration-detail', path: '/admin/migration-detail',
exact: true, exact: true,
component: MigrationDetail, component: MigrationDetail,
}]; }, {
path: '/admin/operation-record',
exact: true,
component: OperationRecord,
},];
constructor(props: any) { constructor(props: any) {
super(props); super(props);
@@ -66,7 +70,7 @@ export default class Home extends React.Component<any> {
public render() { public render() {
return ( return (
<CommonRoutePage pageRoute={this.pageRoute} mode="admin" active="admin"/> <CommonRoutePage pageRoute={this.pageRoute} mode="admin" active="admin" />
); );
} }
} }

View File

@@ -3,6 +3,11 @@ import { observable, action } from 'mobx';
import { getBrokersMetricsHistory } from 'lib/api'; import { getBrokersMetricsHistory } from 'lib/api';
import { IClusterMetrics } from 'types/base-type'; import { IClusterMetrics } from 'types/base-type';
const STATUS = {
PENDING: 'pending',
REJECT: 'reject',
FULLFILLED: 'fullfilled'
}
class AdminMonitor { class AdminMonitor {
@observable @observable
public currentClusterId = null as number; public currentClusterId = null as number;
@@ -33,33 +38,42 @@ class AdminMonitor {
@action.bound @action.bound
public setBrokersChartsData(data: IClusterMetrics[]) { public setBrokersChartsData(data: IClusterMetrics[]) {
this.brokersMetricsHistory = data; this.brokersMetricsHistory = data;
this.setRequestId(null); this.setRequestId(STATUS.FULLFILLED);
Promise.all(this.taskQueue).then(() => {
this.setRequestId(null);
this.taskQueue = [];
})
return data; return data;
} }
public taskQueue = [] as any[];
public getBrokersMetricsList = async (startTime: string, endTime: string) => { public getBrokersMetricsList = async (startTime: string, endTime: string) => {
if (this.requestId && this.requestId !== 'error') { if (this.requestId) {
return new Promise((res, rej) => { //逐条定时查询任务状态
window.setTimeout(() => { const p = new Promise((res, rej) => {
if (this.requestId === 'error') { const timer = window.setInterval(() => {
rej(); if (this.requestId === STATUS.REJECT) {
} else { rej(this.brokersMetricsHistory);
window.clearInterval(timer);
} else if (this.requestId === STATUS.FULLFILLED) {
res(this.brokersMetricsHistory); res(this.brokersMetricsHistory);
window.clearInterval(timer);
} }
}, 800); // TODO: 该实现方式待优化 }, (this.taskQueue.length + 1) * 100);
}); });
this.taskQueue.push(p);
return p;
} }
this.setRequestId('requesting'); this.setRequestId(STATUS.PENDING);
return getBrokersMetricsHistory(this.currentClusterId, this.currentBrokerId, startTime, endTime) return getBrokersMetricsHistory(this.currentClusterId, this.currentBrokerId, startTime, endTime)
.then(this.setBrokersChartsData).catch(() => this.setRequestId('error')); .then(this.setBrokersChartsData).catch(() => this.setRequestId(STATUS.REJECT));
} }
public getBrokersChartsData = async (startTime: string, endTime: string, reload?: boolean) => { public getBrokersChartsData = async (startTime: string, endTime: string, reload?: boolean) => {
if (this.brokersMetricsHistory && !reload) { if (this.brokersMetricsHistory && !reload) {
return new Promise(res => res(this.brokersMetricsHistory)); return new Promise(res => res(this.brokersMetricsHistory));
} }
return this.getBrokersMetricsList(startTime, endTime); return this.getBrokersMetricsList(startTime, endTime);
} }
} }

View File

@@ -1,5 +1,5 @@
import { observable, action } from 'mobx'; import { observable, action } from 'mobx';
import { INewBulidEnums, ILabelValue, IClusterReal, IOptionType, IClusterMetrics, IClusterTopics, IKafkaFiles, IMetaData, IConfigure, IBrokerData, IOffset, IController, IBrokersBasicInfo, IBrokersStatus, IBrokersTopics, IBrokersPartitions, IBrokersAnalysis, IAnalysisTopicVO, IBrokersMetadata, IBrokersRegions, IThrottles, ILogicalCluster, INewRegions, INewLogical, ITaskManage, IPartitionsLocation, ITaskType, ITasksEnums, ITasksMetaData, ITaskStatusDetails, IKafkaRoles, IEnumsMap, IStaffSummary, IBill, IBillDetail } from 'types/base-type'; import { INewBulidEnums, ILabelValue, IClusterReal, IOptionType, IClusterMetrics, IClusterTopics, IKafkaFiles, IMetaData, IConfigure, IConfigGateway, IBrokerData, IOffset, IController, IBrokersBasicInfo, IBrokersStatus, IBrokersTopics, IBrokersPartitions, IBrokersAnalysis, IAnalysisTopicVO, IBrokersMetadata, IBrokersRegions, IThrottles, ILogicalCluster, INewRegions, INewLogical, ITaskManage, IPartitionsLocation, ITaskType, ITasksEnums, ITasksMetaData, ITaskStatusDetails, IKafkaRoles, IEnumsMap, IStaffSummary, IBill, IBillDetail } from 'types/base-type';
import { import {
deleteCluster, deleteCluster,
getBasicInfo, getBasicInfo,
@@ -9,10 +9,16 @@ import {
getTopicsBasicInfo, getTopicsBasicInfo,
getTasksKafkaFiles, getTasksKafkaFiles,
getMetaData, getMetaData,
getOperationRecordData,
getConfigure, getConfigure,
addNewConfigure, addNewConfigure,
editConfigure, editConfigure,
addNewConfigGateway,
deleteConfigure, deleteConfigure,
getGatewayList,
getGatewayType,
editConfigGateway,
deleteConfigGateway,
getDataCenter, getDataCenter,
getClusterBroker, getClusterBroker,
getClusterConsumer, getClusterConsumer,
@@ -49,6 +55,9 @@ import {
getStaffSummary, getStaffSummary,
getBillStaffSummary, getBillStaffSummary,
getBillStaffDetail, getBillStaffDetail,
getCandidateController,
addCandidateController,
deleteCandidateCancel
} from 'lib/api'; } from 'lib/api';
import { getControlMetricOption, getClusterMetricOption } from 'lib/line-charts-config'; import { getControlMetricOption, getClusterMetricOption } from 'lib/line-charts-config';
@@ -59,6 +68,7 @@ import { transBToMB } from 'lib/utils';
import moment from 'moment'; import moment from 'moment';
import { timestore } from './time'; import { timestore } from './time';
import { message } from 'component/antd';
class Admin { class Admin {
@observable @observable
@@ -94,9 +104,23 @@ class Admin {
@observable @observable
public metaList: IMetaData[] = []; public metaList: IMetaData[] = [];
@observable
public oRList: any[] = [];
@observable
public oRparams:any={
moduleId:0
};
@observable @observable
public configureList: IConfigure[] = []; public configureList: IConfigure[] = [];
@observable
public configGatewayList: IConfigGateway[] = [];
@observable
public gatewayType: [];
@observable @observable
public dataCenterList: string[] = []; public dataCenterList: string[] = [];
@@ -142,6 +166,12 @@ class Admin {
@observable @observable
public controllerHistory: IController[] = []; public controllerHistory: IController[] = [];
@observable
public controllerCandidate: IController[] = [];
@observable
public filtercontrollerCandidate: string = '';
@observable @observable
public brokersPartitions: IBrokersPartitions[] = []; public brokersPartitions: IBrokersPartitions[] = [];
@@ -152,7 +182,7 @@ class Admin {
public brokersAnalysisTopic: IAnalysisTopicVO[] = []; public brokersAnalysisTopic: IAnalysisTopicVO[] = [];
@observable @observable
public brokersMetadata: IBrokersMetadata[] = []; public brokersMetadata: IBrokersMetadata[] | any = [];
@observable @observable
public brokersRegions: IBrokersRegions[] = []; public brokersRegions: IBrokersRegions[] = [];
@@ -206,10 +236,10 @@ class Admin {
public kafkaRoles: IKafkaRoles[]; public kafkaRoles: IKafkaRoles[];
@observable @observable
public controlType: IOptionType = 'byteIn/byteOut' ; public controlType: IOptionType = 'byteIn/byteOut';
@observable @observable
public type: IOptionType = 'byteIn/byteOut' ; public type: IOptionType = 'byteIn/byteOut';
@observable @observable
public currentClusterId = null as number; public currentClusterId = null as number;
@@ -241,7 +271,7 @@ class Admin {
@action.bound @action.bound
public setClusterRealTime(data: IClusterReal) { public setClusterRealTime(data: IClusterReal) {
this.clusterRealData = data; this.clusterRealData = data;
this.getRealClusterLoading(false); this.getRealClusterLoading(false);
} }
@@ -284,7 +314,7 @@ class Admin {
return { return {
...item, ...item,
label: item.fileName, label: item.fileName,
value: item.fileName + ',' + item.fileMd5, value: item.fileName + ',' + item.fileMd5,
}; };
})); }));
} }
@@ -298,6 +328,15 @@ class Admin {
}) : []; }) : [];
} }
@action.bound
public setOperationRecordList(data:any){
this.setLoading(false);
this.oRList = data ? data.map((item:any, index: any) => {
item.key = index;
return item;
}) : [];
}
@action.bound @action.bound
public setConfigure(data: IConfigure[]) { public setConfigure(data: IConfigure[]) {
this.configureList = data ? data.map((item, index) => { this.configureList = data ? data.map((item, index) => {
@@ -306,6 +345,20 @@ class Admin {
}) : []; }) : [];
} }
@action.bound
public setConfigGatewayList(data: IConfigGateway[]) {
this.configGatewayList = data ? data.map((item, index) => {
item.key = index;
return item;
}) : [];
}
@action.bound
public setConfigGatewayType(data: any) {
this.setLoading(false);
this.gatewayType = data || [];
}
@action.bound @action.bound
public setDataCenter(data: string[]) { public setDataCenter(data: string[]) {
this.dataCenterList = data || []; this.dataCenterList = data || [];
@@ -335,6 +388,17 @@ class Admin {
}) : []; }) : [];
} }
@action.bound
public setCandidateController(data: IController[]) {
this.controllerCandidate = data ? data.map((item, index) => {
item.key = index;
return item;
}) : [];
this.filtercontrollerCandidate = data?data.map((item,index)=>{
return item.brokerId
}).join(','):''
}
@action.bound @action.bound
public setBrokersBasicInfo(data: IBrokersBasicInfo) { public setBrokersBasicInfo(data: IBrokersBasicInfo) {
this.brokersBasicInfo = data; this.brokersBasicInfo = data;
@@ -356,10 +420,10 @@ class Admin {
this.replicaStatus = data.brokerReplicaStatusList.slice(1); this.replicaStatus = data.brokerReplicaStatusList.slice(1);
this.bytesInStatus.forEach((item, index) => { this.bytesInStatus.forEach((item, index) => {
this.peakValueList.push({ name: peakValueMap[index], value: item}); this.peakValueList.push({ name: peakValueMap[index], value: item });
}); });
this.replicaStatus.forEach((item, index) => { this.replicaStatus.forEach((item, index) => {
this.copyValueList.push({name: copyValueMap[index], value: item}); this.copyValueList.push({ name: copyValueMap[index], value: item });
}); });
} }
@@ -415,16 +479,16 @@ class Admin {
} }
@action.bound @action.bound
public setBrokersMetadata(data: IBrokersMetadata[]) { public setBrokersMetadata(data: IBrokersMetadata[]|any) {
this.brokersMetadata = data ? data.map((item, index) => { this.brokersMetadata = data ? data.map((item:any, index:any) => {
item.key = index; item.key = index;
return { return {
...item, ...item,
text: `${item.host} BrokerID${item.brokerId}`, text: `${item.host} BrokerID${item.brokerId}`,
label: item.host, label: item.host,
value: item.brokerId, value: item.brokerId,
}; };
}) : []; }) : [];
} }
@action.bound @action.bound
@@ -461,9 +525,9 @@ class Admin {
@action.bound @action.bound
public setLogicalClusters(data: ILogicalCluster[]) { public setLogicalClusters(data: ILogicalCluster[]) {
this.logicalClusters = data ? data.map((item, index) => { this.logicalClusters = data ? data.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}) : []; }) : [];
} }
@action.bound @action.bound
@@ -474,25 +538,25 @@ class Admin {
@action.bound @action.bound
public setClustersThrottles(data: IThrottles[]) { public setClustersThrottles(data: IThrottles[]) {
this.clustersThrottles = data ? data.map((item, index) => { this.clustersThrottles = data ? data.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}) : []; }) : [];
} }
@action.bound @action.bound
public setPartitionsLocation(data: IPartitionsLocation[]) { public setPartitionsLocation(data: IPartitionsLocation[]) {
this.partitionsLocation = data ? data.map((item, index) => { this.partitionsLocation = data ? data.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}) : []; }) : [];
} }
@action.bound @action.bound
public setTaskManagement(data: ITaskManage[]) { public setTaskManagement(data: ITaskManage[]) {
this.taskManagement = data ? data.map((item, index) => { this.taskManagement = data ? data.map((item, index) => {
item.key = index; item.key = index;
return item; return item;
}) : []; }) : [];
} }
@action.bound @action.bound
@@ -568,7 +632,7 @@ class Admin {
return deleteCluster(clusterId).then(() => this.getMetaData(true)); return deleteCluster(clusterId).then(() => this.getMetaData(true));
} }
public getPeakFlowChartData(value: ILabelValue[], map: string []) { public getPeakFlowChartData(value: ILabelValue[], map: string[]) {
return getPieChartOption(value, map); return getPieChartOption(value, map);
} }
@@ -611,6 +675,12 @@ class Admin {
getMetaData(needDetail).then(this.setMetaList); getMetaData(needDetail).then(this.setMetaList);
} }
public getOperationRecordData(params: any) {
this.setLoading(true);
this.oRparams = params
getOperationRecordData(params).then(this.setOperationRecordList);
}
public getConfigure() { public getConfigure() {
getConfigure().then(this.setConfigure); getConfigure().then(this.setConfigure);
} }
@@ -627,6 +697,30 @@ class Admin {
deleteConfigure(configKey).then(() => this.getConfigure()); deleteConfigure(configKey).then(() => this.getConfigure());
} }
public getGatewayList() {
getGatewayList().then(this.setConfigGatewayList);
}
public getGatewayType() {
this.setLoading(true);
getGatewayType().then(this.setConfigGatewayType);
}
public addNewConfigGateway(params: IConfigGateway) {
return addNewConfigGateway(params).then(() => this.getGatewayList());
}
public editConfigGateway(params: IConfigGateway) {
return editConfigGateway(params).then(() => this.getGatewayList());
}
public deleteConfigGateway(params: any) {
deleteConfigGateway(params).then(() => {
// message.success('删除成功')
this.getGatewayList()
});
}
public getDataCenter() { public getDataCenter() {
getDataCenter().then(this.setDataCenter); getDataCenter().then(this.setDataCenter);
} }
@@ -643,6 +737,20 @@ class Admin {
return getControllerHistory(clusterId).then(this.setControllerHistory); return getControllerHistory(clusterId).then(this.setControllerHistory);
} }
public getCandidateController(clusterId: number) {
return getCandidateController(clusterId).then(data=>{
return this.setCandidateController(data)
});
}
public addCandidateController(clusterId: number, brokerIdList: any) {
return addCandidateController({clusterId, brokerIdList}).then(()=>this.getCandidateController(clusterId));
}
public deleteCandidateCancel(clusterId: number, brokerIdList: any){
return deleteCandidateCancel({clusterId, brokerIdList}).then(()=>this.getCandidateController(clusterId));
}
public getBrokersBasicInfo(clusterId: number, brokerId: number) { public getBrokersBasicInfo(clusterId: number, brokerId: number) {
return getBrokersBasicInfo(clusterId, brokerId).then(this.setBrokersBasicInfo); return getBrokersBasicInfo(clusterId, brokerId).then(this.setBrokersBasicInfo);
} }

View File

@@ -181,6 +181,7 @@ class Alarm {
public modifyMonitorStrategy(params: IRequestParams) { public modifyMonitorStrategy(params: IRequestParams) {
return modifyMonitorStrategy(params).then(() => { return modifyMonitorStrategy(params).then(() => {
message.success('操作成功'); message.success('操作成功');
window.location.href = `${urlPrefix}/alarm`;
}).finally(() => this.setLoading(false)); }).finally(() => this.setLoading(false));
} }

View File

@@ -31,6 +31,12 @@ class CustomModal {
this.params = value; this.params = value;
} }
@action.bound
public showOfflineAppNewModal(value: any) {
this.modalId = 'offlineAppNewModal';
this.params = value;
}
@action.bound @action.bound
public showOrderOpResult() { public showOrderOpResult() {
this.modalId = 'orderOpResult'; this.modalId = 'orderOpResult';

View File

@@ -19,6 +19,9 @@ export class Users {
@observable @observable
public staff: IStaff[] = []; public staff: IStaff[] = [];
@observable
public newPassWord: any = null;
@action.bound @action.bound
public setAccount(data: IUser) { public setAccount(data: IUser) {
setCookie([{ key: 'role', value: `${data.role}`, time: 1 }]); setCookie([{ key: 'role', value: `${data.role}`, time: 1 }]);
@@ -42,6 +45,11 @@ export class Users {
this.loading = value; this.loading = value;
} }
@action.bound
public setNewPassWord(value: boolean) {
this.newPassWord = value;
}
public getAccount() { public getAccount() {
getAccount().then(this.setAccount); getAccount().then(this.setAccount);
} }

View File

@@ -6,6 +6,16 @@
url('//at.alicdn.com/t/font_1251424_q66z80q0hio.ttf?t=1577526422376') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ url('//at.alicdn.com/t/font_1251424_q66z80q0hio.ttf?t=1577526422376') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('//at.alicdn.com/t/font_1251424_q66z80q0hio.svg?t=1577526422376#kafka-manager') format('svg'); /* iOS 4.1- */ url('//at.alicdn.com/t/font_1251424_q66z80q0hio.svg?t=1577526422376#kafka-manager') format('svg'); /* iOS 4.1- */
} }
@font-face {
font-family: 'kafka-manager';
/* project id 2406313 */
src: url('//at.alicdn.com/t/font_2406313_rbsze6uqtta.eot');
src: url('//at.alicdn.com/t/font_2406313_rbsze6uqtta.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_2406313_rbsze6uqtta.woff2') format('woff2'),
url('//at.alicdn.com/t/font_2406313_rbsze6uqtta.woff') format('woff'),
url('//at.alicdn.com/t/font_2406313_rbsze6uqtta.ttf') format('truetype'),
url('//at.alicdn.com/t/font_2406313_rbsze6uqtta.svg#iconfont') format('svg');
}
.kafka-manager { .kafka-manager {
font-family: "kafka-manager" !important; font-family: "kafka-manager" !important;
@@ -15,6 +25,15 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
/* .kafka-manager-record {
font-family: "kafka-manager" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
} */
.k-icon-fuwurenwuguanli:before { .k-icon-fuwurenwuguanli:before {
content: "\e660"; content: "\e660";
} }
@@ -47,6 +66,10 @@
content: "\e634"; content: "\e634";
} }
.k-icon-operationrecord:before {
content: "\e772";
}
.k-icon-menu2:before { .k-icon-menu2:before {
content: "\e609"; content: "\e609";
} }

View File

@@ -190,6 +190,7 @@ export interface IUser {
chineseName?: string; chineseName?: string;
department?: string; department?: string;
key?: number; key?: number;
confirmPassword?: string
} }
export interface IOffset { export interface IOffset {
@@ -486,6 +487,17 @@ export interface IConfigure {
key?: number; key?: number;
} }
export interface IConfigGateway {
id: number;
key?: number;
modifyTime: number;
name: string;
value: string;
version: string;
type: string;
description: string;
}
export interface IEepand { export interface IEepand {
brokerIdList: number[]; brokerIdList: number[];
clusterId: number; clusterId: number;
@@ -650,8 +662,10 @@ export interface IBrokerData {
export interface IController { export interface IController {
brokerId: number; brokerId: number;
host: string; host: string;
timestamp: number; timestamp?: number;
version: number; version?: number;
startTime?: number;
status?: number;
key?: number; key?: number;
} }
@@ -925,7 +939,7 @@ export interface INewLogical {
logicalClusterName?: string; logicalClusterName?: string;
logicalClusterNameCn?: string; logicalClusterNameCn?: string;
regionIdList: number[]; regionIdList: number[];
logicalClusterIdentification?:string logicalClusterIdentification?: string
} }
export interface IPartitionsLocation { export interface IPartitionsLocation {

View File

@@ -1,8 +1,8 @@
package com.xiaojukeji.kafka.manager.service.cache; package com.xiaojukeji.kafka.manager.service.cache;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO; import com.xiaojukeji.kafka.manager.common.entity.pojo.ClusterDO;
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
import com.xiaojukeji.kafka.manager.common.utils.factory.KafkaConsumerFactory; import com.xiaojukeji.kafka.manager.common.utils.factory.KafkaConsumerFactory;
import kafka.admin.AdminClient; import kafka.admin.AdminClient;
import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPool;
@@ -103,6 +103,21 @@ public class KafkaClientPool {
} }
} }
public static void closeKafkaConsumerPool(Long clusterId) {
lock.lock();
try {
GenericObjectPool<KafkaConsumer> objectPool = KAFKA_CONSUMER_POOL.remove(clusterId);
if (objectPool == null) {
return;
}
objectPool.close();
} catch (Exception e) {
LOGGER.error("close kafka consumer pool failed, clusterId:{}.", clusterId, e);
} finally {
lock.unlock();
}
}
public static KafkaConsumer borrowKafkaConsumerClient(ClusterDO clusterDO) { public static KafkaConsumer borrowKafkaConsumerClient(ClusterDO clusterDO) {
if (ValidateUtils.isNull(clusterDO)) { if (ValidateUtils.isNull(clusterDO)) {
return null; return null;
@@ -132,7 +147,11 @@ public class KafkaClientPool {
if (ValidateUtils.isNull(objectPool)) { if (ValidateUtils.isNull(objectPool)) {
return; return;
} }
objectPool.returnObject(kafkaConsumer); try {
objectPool.returnObject(kafkaConsumer);
} catch (Exception e) {
LOGGER.error("return kafka consumer client failed, clusterId:{}", physicalClusterId, e);
}
} }
public static AdminClient getAdminClient(Long clusterId) { public static AdminClient getAdminClient(Long clusterId) {

Some files were not shown because too many files have changed in this diff Show More