Skip to content

Commit 3554a6a

Browse files
author
liyue25
committed
Merge branch '4.1.0-snapshot' into '4.1.0-SNAPSHOT'
管理端issue完结 See merge request laf/journalQ!250
2 parents 7151ea9 + bd433c4 commit 3554a6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+915
-718
lines changed

joyqueue-console/joyqueue-data/joyqueue-data-service/src/main/java/com/jd/joyqueue/service/ArchiveService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,10 @@ public interface ArchiveService {
4949
* @throws JoyQueueException
5050
*/
5151
List<ConsumeLog> findConsumeLog(String messageId, Integer count) throws JoyQueueException;
52+
53+
/**
54+
* 归档服务是否可用
55+
* @throws Exception
56+
*/
57+
boolean isServerEnabled();
5258
}

joyqueue-console/joyqueue-data/joyqueue-data-service/src/main/java/com/jd/joyqueue/service/RetryService.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ public interface RetryService {
3939
void recover(ConsumeRetry retry) throws Exception;
4040

4141
void delete(ConsumeRetry retry) throws Exception;
42+
43+
/**
44+
* 重试服务是否可用
45+
* @throws Exception
46+
*/
47+
boolean isServerEnabled();
4248
}

joyqueue-console/joyqueue-data/joyqueue-data-service/src/main/java/com/jd/joyqueue/service/impl/ArchiveServiceImpl.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package com.jd.joyqueue.service.impl;
1515

1616
import com.jd.joyqueue.exception.JoyQueueException;
17+
import com.jd.joyqueue.exception.ServiceException;
1718
import com.jd.joyqueue.model.query.QArchive;
1819
import com.jd.joyqueue.server.archive.store.QueryCondition;
1920
import com.jd.joyqueue.server.archive.store.api.ArchiveStore;
@@ -24,11 +25,15 @@
2425
import org.slf4j.Logger;
2526
import org.slf4j.LoggerFactory;
2627
import org.springframework.beans.factory.annotation.Autowired;
28+
import org.springframework.beans.factory.annotation.Value;
2729
import org.springframework.context.annotation.Lazy;
2830
import org.springframework.stereotype.Service;
2931

3032
import java.util.List;
3133

34+
import static com.jd.joyqueue.exception.ServiceException.FORBIDDEN;
35+
import static com.jd.joyqueue.exception.ServiceException.INTERNAL_SERVER_ERROR;
36+
3237
/**
3338
* Created by wangxiaofei1 on 2018/12/7.
3439
*/
@@ -39,20 +44,25 @@ public class ArchiveServiceImpl implements ArchiveService {
3944
@Autowired(required = false)
4045
private ArchiveStore archiveStore;
4146

47+
@Value("${archive.enable:false}")
48+
private Boolean archiveEnable;
49+
4250
@Override
4351
public void register(ArchiveStore archiveStore) {
4452
this.archiveStore = archiveStore;
4553
}
4654

4755
@Override
4856
public List<SendLog> findByQuery(QArchive qPageQuery) throws JoyQueueException {
57+
check();
4958
QueryCondition queryCondition = conditionConvert(qPageQuery);
5059
List<SendLog> sendLogs = archiveStore.scanSendLog(queryCondition);
5160
return sendLogs;
5261
}
5362

5463
@Override
5564
public SendLog findSendLog(String topic,Long time,String businessId,String messageId) throws JoyQueueException {
65+
check();
5666
QueryCondition queryCondition = new QueryCondition();
5767
QueryCondition.RowKey startRow = new QueryCondition.RowKey();
5868
startRow.setBusinessId(businessId);
@@ -66,10 +76,28 @@ public SendLog findSendLog(String topic,Long time,String businessId,String messa
6676

6777
@Override
6878
public List<ConsumeLog> findConsumeLog(String messageId, Integer count) throws JoyQueueException {
79+
check();
6980
return archiveStore.scanConsumeLog(messageId,count);
7081
}
7182

83+
/**
84+
* 归档服务是否可用
85+
* @return
86+
*/
87+
@Override
88+
public boolean isServerEnabled() {
89+
return archiveEnable != null && archiveEnable.booleanValue();
90+
}
91+
92+
private void check() {
93+
if (!isServerEnabled()) {
94+
throw new ServiceException(FORBIDDEN, "archive service is disabled. please set archive.enable to be true first.");
95+
}
7296

97+
if (archiveStore == null) {
98+
throw new ServiceException(INTERNAL_SERVER_ERROR, "archiveStore can not be null. ");
99+
}
100+
}
73101

74102
/**
75103
* query转QueryCondition

joyqueue-console/joyqueue-data/joyqueue-data-service/src/main/java/com/jd/joyqueue/service/impl/PartitionGroupReplicaServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ public List<PartitionGroupReplica> findByQuery(QPartitionGroupReplica query) thr
127127
try {
128128
Broker broker = brokerNameServerService.findById(Long.valueOf(replica.getBrokerId()));
129129
BrokerGroupRelated brokerGroupRelatedId = brokerGroupRelatedService.findById(Long.valueOf(replica.getBrokerId()));
130-
broker.setGroup(brokerGroupRelatedId.getGroup());
130+
if (brokerGroupRelatedId != null) {
131+
broker.setGroup(brokerGroupRelatedId.getGroup());
132+
}
131133
replica.setBroker(broker);
132134
} catch (Exception e) {
133135
logger.error("findById error",e);

joyqueue-console/joyqueue-data/joyqueue-data-service/src/main/java/com/jd/joyqueue/service/impl/RetryServiceImpl.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import com.jd.joyqueue.domain.ConsumeRetry;
1717
import com.jd.joyqueue.exception.JoyQueueException;
18+
import com.jd.joyqueue.exception.ServiceException;
1819
import com.jd.joyqueue.model.PageResult;
1920
import com.jd.joyqueue.model.QPageQuery;
2021
import com.jd.joyqueue.model.query.QRetry;
@@ -26,11 +27,15 @@
2627
import org.slf4j.Logger;
2728
import org.slf4j.LoggerFactory;
2829
import org.springframework.beans.factory.annotation.Autowired;
30+
import org.springframework.beans.factory.annotation.Value;
2931
import org.springframework.stereotype.Service;
3032

3133
import java.util.ArrayList;
3234
import java.util.List;
3335

36+
import static com.jd.joyqueue.exception.ServiceException.FORBIDDEN;
37+
import static com.jd.joyqueue.exception.ServiceException.INTERNAL_SERVER_ERROR;
38+
3439
/**
3540
* Created by wangxiaofei1 on 2018/12/5.
3641
*/
@@ -41,9 +46,12 @@ public class RetryServiceImpl implements RetryService {
4146
@Autowired(required = false)
4247
private ConsoleMessageRetry consoleMessageRetry;
4348

49+
@Value("${retry.enable:false}")
50+
private Boolean retryEnable;
4451

4552
@Override
4653
public PageResult<ConsumeRetry> findByQuery(QPageQuery<QRetry> qPageQuery) throws JoyQueueException {
54+
check();
4755
RetryQueryCondition queryCondition = new RetryQueryCondition();
4856
if (qPageQuery != null) {
4957
QRetry qRetry = qPageQuery.getQuery();
@@ -70,11 +78,13 @@ public PageResult<ConsumeRetry> findByQuery(QPageQuery<QRetry> qPageQuery) throw
7078

7179
@Override
7280
public ConsumeRetry getDataById(Long id) throws JoyQueueException {
81+
check();
7382
return consoleMessageRetry.getConsumeRetryById(id);
7483
}
7584

7685
@Override
7786
public void add(RetryMessageModel retryMessageModel) {
87+
check();
7888
List<RetryMessageModel> retryMessageModels = new ArrayList<>();
7989
retryMessageModels.add(retryMessageModel);
8090
try {
@@ -83,6 +93,7 @@ public void add(RetryMessageModel retryMessageModel) {
8393
throw new RuntimeException("add retry error",e);
8494
}
8595
}
96+
8697
/**
8798
* 恢复不修改缓存
8899
* broker定时去db拉取要重试的消息
@@ -92,6 +103,7 @@ public void add(RetryMessageModel retryMessageModel) {
92103
*/
93104
@Override
94105
public void recover(ConsumeRetry retry) throws Exception {
106+
check();
95107
Long[] messageIds = {Long.valueOf(retry.getMessageId())};
96108
consoleMessageRetry.updateStatus(retry.getTopic(),retry.getApp(),messageIds, RetryStatus.RETRY_ING,retry.getUpdateTime(),retry.getUpdateBy());
97109
}
@@ -103,7 +115,27 @@ public void recover(ConsumeRetry retry) throws Exception {
103115
*/
104116
@Override
105117
public void delete(ConsumeRetry retry) throws Exception {
118+
check();
106119
Long[] messageIds = {Long.valueOf(retry.getMessageId())};
107120
consoleMessageRetry.updateStatus(retry.getTopic(),retry.getApp(),messageIds, RetryStatus.RETRY_ING,retry.getUpdateTime(),retry.getUpdateBy());
108121
}
122+
123+
/**
124+
* 重试服务是否可用
125+
* @return
126+
*/
127+
@Override
128+
public boolean isServerEnabled() {
129+
return retryEnable != null && retryEnable.booleanValue();
130+
}
131+
132+
private void check() {
133+
if (!isServerEnabled()) {
134+
throw new ServiceException(FORBIDDEN, "retry service is disabled. please set retry.enable to be true first.");
135+
}
136+
137+
if (consoleMessageRetry == null) {
138+
throw new ServiceException(INTERNAL_SERVER_ERROR, "consoleMessageRetry can not be null. ");
139+
}
140+
}
109141
}

joyqueue-console/joyqueue-portal/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "joyqueue-web",
3-
"version": "1.0.5",
3+
"version": "1.1.1",
44
"description": "JoyQueue web administration console",
5-
"author": "yuanchanglong <[email protected]>",
5+
"author": "yuanchanglong, chenyanying3",
66
"scripts": {
77
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
88
"start": "npm run dev",

joyqueue-console/joyqueue-portal/src/assets/css/dui.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10827,6 +10827,9 @@ span.dui-radio + * {
1082710827
white-space: nowrap;
1082810828
word-wrap: normal;
1082910829
vertical-align: middle; }
10830+
.dui-dialog__content {
10831+
width: 100%;
10832+
height: 100%; }
1083010833
.dui-dialog__close {
1083110834
position: absolute;
1083210835
top: 16px;
@@ -10837,8 +10840,10 @@ span.dui-radio + * {
1083710840
cursor: pointer; }
1083810841
.dui-dialog__body {
1083910842
padding: 16px;
10843+
padding-bottom: 73px;
1084010844
font-size: 13px;
10841-
line-height: 1.5; }
10845+
line-height: 1.5;
10846+
overflow: auto; }
1084210847
.dui-dialog__body p {
1084310848
font-size: 13px; }
1084410849
.dui-dialog__icon {
@@ -10853,11 +10858,24 @@ span.dui-radio + * {
1085310858
margin-top: 8px;
1085410859
width: 100%; }
1085510860
.dui-dialog__footer {
10861+
position: absolute;
10862+
width: 100%;
10863+
bottom: 0;
1085610864
padding: 12px 16px;
1085710865
border-top: 1px solid #ECECEC;
1085810866
text-align: right; }
1085910867
.dui-dialog__footer .dui-btn + .dui-btn {
1086010868
margin-left: 8px; }
10869+
.dui-dialog__resize {
10870+
position: absolute;
10871+
width: 10px;
10872+
height: 10px;
10873+
right: 3px;
10874+
bottom: 3px;
10875+
z-index: 1;
10876+
cursor: nw-resize;
10877+
background: url(../images/resize.png) no-repeat;
10878+
background-size: contain; }
1086110879
.dui-dialog--hidden {
1086210880
display: none !important; }
1086310881
.dui-dialog--confirm .dui-dialog__header {
971 Bytes
Loading

joyqueue-console/joyqueue-portal/src/components/common/header.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{{ langConfig.setting }}
1818
</d-menu-item>
1919
</div>
20-
<div class="right">
20+
<div class="right mr40">
2121
<!-- 语言选择 -->
2222
<d-dropdown class="lang-select" @on-command="switchLang">
2323
<a class="d-dropdown-link">
@@ -30,16 +30,6 @@
3030
:command="key">{{ value }}</d-dropdown-item>
3131
</d-dropdown-menu>
3232
</d-dropdown>
33-
<d-submenu name="6" class="right">
34-
<template slot="title">
35-
<icon name="user"/>
36-
{{loginUserName}}
37-
</template>
38-
<d-menu-item name="6-1" @click.native="logout()">
39-
<icon name="log-out" />
40-
{{ langConfig.logout }}
41-
</d-menu-item>
42-
</d-submenu>
4333
</div>
4434
</d-menu>
4535
</template>

joyqueue-console/joyqueue-portal/src/components/common/myDialog.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@
99
:styles="styles"
1010
@on-confirm="handleSave"
1111
@on-cancel="handleCancel"
12-
>
12+
:maskClosable="false"
13+
:draggable="dialog.draggable || true"
14+
:resizable="dialog.resizable || true">
1315
<slot></slot>
1416
</d-dialog>
1517
</template>
1618

1719
<script>
1820
export default {
1921
name: 'myDialog',
20-
data() {
22+
data () {
2123
return {
22-
};
24+
}
2325
},
2426
props: {
2527
dialog: {
2628
type: Object,
27-
default (){
29+
default () {
2830
return {
2931
visible: false
3032
}
@@ -38,11 +40,11 @@ export default {
3840
}
3941
},
4042
methods: {
41-
handleSave(){
42-
this.$emit('on-dialog-confirm');
43+
handleSave () {
44+
this.$emit('on-dialog-confirm')
4345
},
44-
handleCancel(){
45-
this.$emit('on-dialog-cancel');
46+
handleCancel () {
47+
this.$emit('on-dialog-cancel')
4648
}
4749
}
4850
}

0 commit comments

Comments
 (0)