[ISSUE #5]Different pages are displayed based on the user role. (#7)

* [ISSUE #5]Different pages are displayed based on the user role.

* Put the role judgment logic into js

Co-authored-by: zhangjidi <zhangjidi@cmss.chinamobile.com>
This commit is contained in:
zhangjidi2016
2021-08-19 12:29:16 +08:00
committed by GitHub
parent 62a4cafea0
commit 1a751091b3
14 changed files with 413 additions and 333 deletions

View File

@@ -19,6 +19,7 @@ package org.apache.rocketmq.dashboard.controller;
import org.apache.rocketmq.dashboard.config.RMQConfigure; import org.apache.rocketmq.dashboard.config.RMQConfigure;
import org.apache.rocketmq.dashboard.model.LoginInfo; import org.apache.rocketmq.dashboard.model.LoginInfo;
import org.apache.rocketmq.dashboard.model.LoginResult;
import org.apache.rocketmq.dashboard.model.User; import org.apache.rocketmq.dashboard.model.User;
import org.apache.rocketmq.dashboard.model.UserInfo; import org.apache.rocketmq.dashboard.model.UserInfo;
import org.apache.rocketmq.dashboard.service.UserService; import org.apache.rocketmq.dashboard.service.UserService;
@@ -65,10 +66,10 @@ public class LoginController {
@RequestMapping(value = "/login.do", method = RequestMethod.POST) @RequestMapping(value = "/login.do", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public JsonResult<String> login(@RequestParam("username") String username, public Object login(@RequestParam("username") String username,
@RequestParam(value = "password") String password, @RequestParam(value = "password") String password,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response) throws Exception { HttpServletResponse response) throws Exception {
logger.info("user:{} login", username); logger.info("user:{} login", username);
User user = userService.queryByUsernameAndPassword(username, password); User user = userService.queryByUsernameAndPassword(username, password);
@@ -80,7 +81,8 @@ public class LoginController {
WebUtil.setSessionValue(request, WebUtil.USER_INFO, userInfo); WebUtil.setSessionValue(request, WebUtil.USER_INFO, userInfo);
WebUtil.setSessionValue(request, WebUtil.USER_NAME, username); WebUtil.setSessionValue(request, WebUtil.USER_NAME, username);
userInfo.setSessionId(WebUtil.getSessionId(request)); userInfo.setSessionId(WebUtil.getSessionId(request));
return new JsonResult<>(contextPath); LoginResult result = new LoginResult(username, user.getType(), contextPath);
return result;
} }
} }

View File

@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.rocketmq.dashboard.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginResult {
private String loginUserName;
/**
* 0: normal 1: admin
*/
private int loginUserRole;
private String contextPath;
}

View File

@@ -17,7 +17,7 @@
var module = app; var module = app;
module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('consumerController', ['$scope', 'ngDialog', '$http', 'Notification', '$window', function ($scope, ngDialog, $http, Notification, $window) {
$scope.paginationConf = { $scope.paginationConf = {
currentPage: 1, currentPage: 1,
totalItems: 0, totalItems: 0,
@@ -26,34 +26,44 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica
perPageOptions: [10], perPageOptions: [10],
rememberPerPage: 'perPageItems', rememberPerPage: 'perPageItems',
onChange: function () { onChange: function () {
$scope.showConsumerGroupList(this.currentPage,this.totalItems); $scope.showConsumerGroupList(this.currentPage, this.totalItems);
} }
}; };
$scope.sortKey = null; $scope.sortKey = null;
$scope.sortOrder=1; $scope.sortOrder = 1;
$scope.intervalProcessSwitch = false; $scope.intervalProcessSwitch = false;
$scope.intervalProcess = null; $scope.intervalProcess = null;
$scope.allConsumerGrouopList = []; $scope.allConsumerGrouopList = [];
$scope.consumerGroupShowList = []; $scope.consumerGroupShowList = [];
$scope.sortByKey = function (key) { $scope.sortByKey = function (key) {
$scope.paginationConf.currentPage=1; $scope.paginationConf.currentPage = 1;
$scope.sortOrder = -$scope.sortOrder; $scope.sortOrder = -$scope.sortOrder;
$scope.sortKey = key; $scope.sortKey = key;
$scope.doSort(); $scope.doSort();
}; };
$scope.userRole = $window.sessionStorage.getItem("userrole");
$scope.writeOperationEnabled = $scope.userRole == null ? true : ($scope.userRole == 1 ? true : false);
$scope.doSort = function (){// todo how to change this fe's code ? (it's dirty) $scope.doSort = function () {// todo how to change this fe's code ? (it's dirty)
if($scope.sortKey == 'diffTotal'){ if ($scope.sortKey == 'diffTotal') {
$scope.allConsumerGrouopList.sort(function(a,b) {return (a.diffTotal > b.diffTotal) ? $scope.sortOrder : ((b.diffTotal > a.diffTotal) ? -$scope.sortOrder : 0);} ); $scope.allConsumerGrouopList.sort(function (a, b) {
return (a.diffTotal > b.diffTotal) ? $scope.sortOrder : ((b.diffTotal > a.diffTotal) ? -$scope.sortOrder : 0);
});
} }
if($scope.sortKey == 'group'){ if ($scope.sortKey == 'group') {
$scope.allConsumerGrouopList.sort(function(a,b) {return (a.group > b.group) ? $scope.sortOrder : ((b.group > a.group) ? -$scope.sortOrder : 0);} ); $scope.allConsumerGrouopList.sort(function (a, b) {
return (a.group > b.group) ? $scope.sortOrder : ((b.group > a.group) ? -$scope.sortOrder : 0);
});
} }
if($scope.sortKey == 'count'){ if ($scope.sortKey == 'count') {
$scope.allConsumerGrouopList.sort(function(a,b) {return (a.count > b.count) ? $scope.sortOrder : ((b.count > a.count) ? -$scope.sortOrder : 0);} ); $scope.allConsumerGrouopList.sort(function (a, b) {
return (a.count > b.count) ? $scope.sortOrder : ((b.count > a.count) ? -$scope.sortOrder : 0);
});
} }
if($scope.sortKey == 'consumeTps'){ if ($scope.sortKey == 'consumeTps') {
$scope.allConsumerGrouopList.sort(function(a,b) {return (a.consumeTps > b.consumeTps) ? $scope.sortOrder : ((b.consumeTps > a.consumeTps) ? -$scope.sortOrder : 0);} ); $scope.allConsumerGrouopList.sort(function (a, b) {
return (a.consumeTps > b.consumeTps) ? $scope.sortOrder : ((b.consumeTps > a.consumeTps) ? -$scope.sortOrder : 0);
});
} }
$scope.filterList($scope.paginationConf.currentPage) $scope.filterList($scope.paginationConf.currentPage)
}; };
@@ -65,31 +75,31 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica
method: "GET", method: "GET",
url: "consumer/groupList.query" url: "consumer/groupList.query"
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
$scope.allConsumerGrouopList = resp.data; $scope.allConsumerGrouopList = resp.data;
console.log($scope.allConsumerGrouopList); console.log($scope.allConsumerGrouopList);
console.log(JSON.stringify(resp)); console.log(JSON.stringify(resp));
$scope.showConsumerGroupList($scope.paginationConf.currentPage,$scope.allConsumerGrouopList.length); $scope.showConsumerGroupList($scope.paginationConf.currentPage, $scope.allConsumerGrouopList.length);
//Hide loader //Hide loader
$('#loaderConsumer').addClass("hide-myloader"); $('#loaderConsumer').addClass("hide-myloader");
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.monitor = function(consumerGroupName){ $scope.monitor = function (consumerGroupName) {
$http({ $http({
method: "GET", method: "GET",
url: "monitor/consumerMonitorConfigByGroupName.query", url: "monitor/consumerMonitorConfigByGroupName.query",
params:{consumeGroupName:consumerGroupName} params: {consumeGroupName: consumerGroupName}
}).success(function (resp) { }).success(function (resp) {
// if(resp.status ==0){ // if(resp.status ==0){
ngDialog.open({ ngDialog.open({
template: 'consumerMonitorDialog', template: 'consumerMonitorDialog',
controller: 'consumerMonitorDialogController', controller: 'consumerMonitorDialogController',
data:{consumerGroupName:consumerGroupName,data:resp.data} data: {consumerGroupName: consumerGroupName, data: resp.data}
}); });
// }else { // }else {
// Notification.error({message: resp.errMsg, delay: 2000}); // Notification.error({message: resp.errMsg, delay: 2000});
// } // }
@@ -109,35 +119,35 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica
$scope.refreshConsumerData(); $scope.refreshConsumerData();
$scope.filterStr=""; $scope.filterStr = "";
$scope.$watch('filterStr', function() { $scope.$watch('filterStr', function () {
$scope.paginationConf.currentPage=1; $scope.paginationConf.currentPage = 1;
$scope.filterList(1) $scope.filterList(1)
}); });
$scope.filterList = function (currentPage) { $scope.filterList = function (currentPage) {
var lowExceptStr = $scope.filterStr.toLowerCase(); var lowExceptStr = $scope.filterStr.toLowerCase();
var canShowList = []; var canShowList = [];
$scope.allConsumerGrouopList.forEach(function(element) { $scope.allConsumerGrouopList.forEach(function (element) {
console.log(element) console.log(element)
if (element.group.toLowerCase().indexOf(lowExceptStr) != -1){ if (element.group.toLowerCase().indexOf(lowExceptStr) != -1) {
canShowList.push(element); canShowList.push(element);
} }
}); });
$scope.paginationConf.totalItems =canShowList.length; $scope.paginationConf.totalItems = canShowList.length;
var perPage = $scope.paginationConf.itemsPerPage; var perPage = $scope.paginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage; var from = (currentPage - 1) * perPage;
var to = (from + perPage)>canShowList.length?canShowList.length:from + perPage; var to = (from + perPage) > canShowList.length ? canShowList.length : from + perPage;
$scope.consumerGroupShowList = canShowList.slice(from, to); $scope.consumerGroupShowList = canShowList.slice(from, to);
}; };
$scope.showConsumerGroupList = function (currentPage,totalItem) { $scope.showConsumerGroupList = function (currentPage, totalItem) {
var perPage = $scope.paginationConf.itemsPerPage; var perPage = $scope.paginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage; var from = (currentPage - 1) * perPage;
var to = (from + perPage)>totalItem?totalItem:from + perPage; var to = (from + perPage) > totalItem ? totalItem : from + perPage;
$scope.consumerGroupShowList = $scope.allConsumerGrouopList.slice(from, to); $scope.consumerGroupShowList = $scope.allConsumerGrouopList.slice(from, to);
$scope.paginationConf.totalItems = totalItem ; $scope.paginationConf.totalItems = totalItem;
console.log($scope.consumerGroupShowList) console.log($scope.consumerGroupShowList)
console.log($scope.paginationConf.totalItems) console.log($scope.paginationConf.totalItems)
$scope.doSort() $scope.doSort()
@@ -145,9 +155,9 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica
$scope.openAddDialog = function () { $scope.openAddDialog = function () {
$scope.openCreateOrUpdateDialog(null); $scope.openCreateOrUpdateDialog(null);
}; };
$scope.openCreateOrUpdateDialog = function(request){ $scope.openCreateOrUpdateDialog = function (request) {
var bIsUpdate = true; var bIsUpdate = true;
if(request == null){ if (request == null) {
request = [{ request = [{
brokerNameList: [], brokerNameList: [],
subscriptionGroupConfig: { subscriptionGroupConfig: {
@@ -168,123 +178,126 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica
method: "GET", method: "GET",
url: "cluster/list.query" url: "cluster/list.query"
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
console.log(resp); console.log(resp);
ngDialog.open({ ngDialog.open({
preCloseCallback: function(value) { preCloseCallback: function (value) {
// Refresh topic list // Refresh topic list
$scope.refreshConsumerData(); $scope.refreshConsumerData();
}, },
template: 'consumerModifyDialog', template: 'consumerModifyDialog',
controller: 'consumerModifyDialogController', controller: 'consumerModifyDialogController',
data:{ data: {
consumerRequestList:request, consumerRequestList: request,
allClusterNameList:Object.keys(resp.data.clusterInfo.clusterAddrTable), allClusterNameList: Object.keys(resp.data.clusterInfo.clusterAddrTable),
allBrokerNameList:Object.keys(resp.data.brokerServer), allBrokerNameList: Object.keys(resp.data.brokerServer),
bIsUpdate:bIsUpdate bIsUpdate: bIsUpdate,
writeOperationEnabled: $scope.writeOperationEnabled
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.detail = function(consumerGroupName){ $scope.detail = function (consumerGroupName) {
$http({ $http({
method: "GET", method: "GET",
url: "consumer/queryTopicByConsumer.query", url: "consumer/queryTopicByConsumer.query",
params:{consumerGroup:consumerGroupName} params: {consumerGroup: consumerGroupName}
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
console.log(resp); console.log(resp);
ngDialog.open({ ngDialog.open({
template: 'consumerTopicViewDialog', template: 'consumerTopicViewDialog',
controller: 'consumerTopicViewDialogController', controller: 'consumerTopicViewDialogController',
data:{consumerGroupName:consumerGroupName,data:resp.data} data: {consumerGroupName: consumerGroupName, data: resp.data}
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.client = function(consumerGroupName){ $scope.client = function (consumerGroupName) {
$http({ $http({
method: "GET", method: "GET",
url: "consumer/consumerConnection.query", url: "consumer/consumerConnection.query",
params:{consumerGroup:consumerGroupName} params: {consumerGroup: consumerGroupName}
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
console.log(resp); console.log(resp);
ngDialog.open({ ngDialog.open({
template: 'clientInfoDialog', template: 'clientInfoDialog',
// controller: 'addTopicDialogController', // controller: 'addTopicDialogController',
data:{data:resp.data,consumerGroupName:consumerGroupName} data: {data: resp.data, consumerGroupName: consumerGroupName}
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.updateConfigDialog = function(consumerGroupName){ $scope.updateConfigDialog = function (consumerGroupName) {
$http({ $http({
method: "GET", method: "GET",
url: "consumer/examineSubscriptionGroupConfig.query", url: "consumer/examineSubscriptionGroupConfig.query",
params:{consumerGroup:consumerGroupName} params: {consumerGroup: consumerGroupName}
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
console.log(resp); console.log(resp);
$scope.openCreateOrUpdateDialog(resp.data); $scope.openCreateOrUpdateDialog(resp.data);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.delete = function(consumerGroupName){ $scope.delete = function (consumerGroupName) {
$http({ $http({
method: "GET", method: "GET",
url: "consumer/fetchBrokerNameList.query", url: "consumer/fetchBrokerNameList.query",
params:{ params: {
consumerGroup:consumerGroupName consumerGroup: consumerGroupName
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
console.log(resp); console.log(resp);
ngDialog.open({ ngDialog.open({
preCloseCallback: function(value) { preCloseCallback: function (value) {
// Refresh topic list // Refresh topic list
$scope.refreshConsumerData(); $scope.refreshConsumerData();
}, },
template: 'deleteConsumerDialog', template: 'deleteConsumerDialog',
controller: 'deleteConsumerDialogController', controller: 'deleteConsumerDialogController',
data:{ data: {
// allClusterList:Object.keys(resp.data.clusterInfo.clusterAddrTable), // allClusterList:Object.keys(resp.data.clusterInfo.clusterAddrTable),
allBrokerNameList:resp.data, allBrokerNameList: resp.data,
consumerGroupName:consumerGroupName consumerGroupName: consumerGroupName
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
} }
}]) }])
module.controller('consumerMonitorDialogController', function ($scope, ngDialog, $http,Notification) { module.controller('consumerMonitorDialogController', function ($scope, ngDialog, $http, Notification) {
$scope.createOrUpdateConsumerMonitor = function () { $scope.createOrUpdateConsumerMonitor = function () {
$http({ $http({
method: "POST", method: "POST",
url: "monitor/createOrUpdateConsumerMonitor.do", url: "monitor/createOrUpdateConsumerMonitor.do",
params:{consumeGroupName:$scope.ngDialogData.consumerGroupName, params: {
minCount:$scope.ngDialogData.data.minCount, consumeGroupName: $scope.ngDialogData.consumerGroupName,
maxDiffTotal:$scope.ngDialogData.data.maxDiffTotal} minCount: $scope.ngDialogData.data.minCount,
maxDiffTotal: $scope.ngDialogData.data.maxDiffTotal
}
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
Notification.info({message: "update success!", delay: 2000}); Notification.info({message: "update success!", delay: 2000});
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -293,7 +306,7 @@ module.controller('consumerMonitorDialogController', function ($scope, ngDialog,
); );
module.controller('deleteConsumerDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('deleteConsumerDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.selectedClusterList = []; $scope.selectedClusterList = [];
$scope.selectedBrokerNameList = []; $scope.selectedBrokerNameList = [];
$scope.delete = function () { $scope.delete = function () {
@@ -303,13 +316,15 @@ module.controller('deleteConsumerDialogController', ['$scope', 'ngDialog', '$htt
$http({ $http({
method: "POST", method: "POST",
url: "consumer/deleteSubGroup.do", url: "consumer/deleteSubGroup.do",
data:{groupName:$scope.ngDialogData.consumerGroupName, data: {
brokerNameList:$scope.selectedBrokerNameList} groupName: $scope.ngDialogData.consumerGroupName,
brokerNameList: $scope.selectedBrokerNameList
}
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
Notification.info({message: "delete success!", delay: 2000}); Notification.info({message: "delete success!", delay: 2000});
ngDialog.close(this); ngDialog.close(this);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -317,19 +332,19 @@ module.controller('deleteConsumerDialogController', ['$scope', 'ngDialog', '$htt
}] }]
); );
module.controller('consumerModifyDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('consumerModifyDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.postConsumerRequest = function (consumerRequest) { $scope.postConsumerRequest = function (consumerRequest) {
var request = JSON.parse(JSON.stringify(consumerRequest)); var request = JSON.parse(JSON.stringify(consumerRequest));
console.log(request); console.log(request);
$http({ $http({
method: "POST", method: "POST",
url: "consumer/createOrUpdate.do", url: "consumer/createOrUpdate.do",
data:request data: request
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
Notification.info({message: "update success!", delay: 2000}); Notification.info({message: "update success!", delay: 2000});
ngDialog.close(this); ngDialog.close(this);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -351,8 +366,10 @@ module.controller('consumerTopicViewDialogController', ['$scope', 'ngDialog', '$
if (resp.status == 0) { if (resp.status == 0) {
ngDialog.open({ ngDialog.open({
template: 'consumerClientDialog', template: 'consumerClientDialog',
data:{consumerClientInfo:resp.data, data: {
clientId:clientId} consumerClientInfo: resp.data,
clientId: clientId
}
}); });
} else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
@@ -361,6 +378,3 @@ module.controller('consumerTopicViewDialogController', ['$scope', 'ngDialog', '$
}; };
}] }]
); );

View File

@@ -20,6 +20,9 @@ var en = {
"CONSUMER":"Consumer", "CONSUMER":"Consumer",
"PRODUCER":"Producer", "PRODUCER":"Producer",
"MESSAGE":"Message", "MESSAGE":"Message",
"MESSAGE_DETAIL":"Message Detail",
"RESEND_MESSAGE":"Resend Message",
"VIEW_EXCEPTION":"View Exception",
"MESSAGETRACE":"MessageTrace", "MESSAGETRACE":"MessageTrace",
"COMMIT": "Commit", "COMMIT": "Commit",
"OPERATION": "Operation", "OPERATION": "Operation",

View File

@@ -21,6 +21,9 @@ var zh = {
"CONSUMER":"消费者", "CONSUMER":"消费者",
"PRODUCER":"生产者", "PRODUCER":"生产者",
"MESSAGE":"消息", "MESSAGE":"消息",
"MESSAGE_DETAIL":"消息详情",
"RESEND_MESSAGE":"重新消费",
"VIEW_EXCEPTION":"查看异常",
"MESSAGETRACE":"消息轨迹", "MESSAGETRACE":"消息轨迹",
"OPERATION": "操作", "OPERATION": "操作",
"ADD": "新增", "ADD": "新增",

View File

@@ -15,28 +15,29 @@
* limitations under the License. * limitations under the License.
*/ */
app.controller('loginController', ['$scope','$location','$http','Notification','$cookies','$window', function ($scope,$location,$http,Notification,$cookies, $window) { app.controller('loginController', ['$scope', '$location', '$http', 'Notification', '$cookies', '$window', function ($scope, $location, $http, Notification, $cookies, $window) {
$scope.login = function () { $scope.login = function () {
if(!$("#username").val()) { if (!$("#username").val()) {
alert("用户名不能为空"); alert("用户名不能为空");
return; return;
} }
if(!$("#password").val()) { if (!$("#password").val()) {
alert("密码不能为空"); alert("密码不能为空");
return; return;
} }
$http({ $http({
method: "POST", method: "POST",
url: "login/login.do", url: "login/login.do",
params:{username:$("#username").val(), password:$("#password").val()} params: {username: $("#username").val(), password: $("#password").val()}
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
Notification.info({message: 'Login successful, redirect now', delay: 2000}); Notification.info({message: 'Login successful, redirect now', delay: 2000});
$window.sessionStorage.setItem("username", $("#username").val()); $window.sessionStorage.setItem("username", resp.data.loginUserName);
window.location = resp.data; $window.sessionStorage.setItem("userrole", resp.data.loginUserRole);
window.location = resp.data.contextPath;
initFlag = false; initFlag = false;
} else{ } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });

View File

@@ -17,14 +17,14 @@
var module = app; var module = app;
module.controller('messageController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('messageController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.allTopicList = []; $scope.allTopicList = [];
$scope.selectedTopic =[]; $scope.selectedTopic = [];
$scope.key =""; $scope.key = "";
$scope.messageId =""; $scope.messageId = "";
$scope.queryMessageByTopicResult=[]; $scope.queryMessageByTopicResult = [];
$scope.queryMessageByTopicAndKeyResult=[]; $scope.queryMessageByTopicAndKeyResult = [];
$scope.queryMessageByMessageIdResult={}; $scope.queryMessageByMessageIdResult = {};
$http({ $http({
method: "GET", method: "GET",
url: "topic/list.query", url: "topic/list.query",
@@ -32,16 +32,16 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
skipSysProcess: 'true' skipSysProcess: 'true'
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
$scope.allTopicList = resp.data.topicList.sort(); $scope.allTopicList = resp.data.topicList.sort();
console.log($scope.allTopicList); console.log($scope.allTopicList);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
$scope.timepickerBegin = moment().subtract(1, 'hour').format('YYYY-MM-DD HH:mm'); $scope.timepickerBegin = moment().subtract(3, 'hour').format('YYYY-MM-DD HH:mm');
$scope.timepickerEnd = moment().add(1,'hour').format('YYYY-MM-DD HH:mm'); $scope.timepickerEnd = moment().format('YYYY-MM-DD HH:mm');
$scope.timepickerOptions ={format: 'YYYY-MM-DD HH:mm', showClear: true}; $scope.timepickerOptions = {format: 'YYYY-MM-DD HH:mm', showClear: true};
$scope.taskId = ""; $scope.taskId = "";
@@ -62,7 +62,7 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
Notification.error({message: "endTime is later than beginTime!", delay: 2000}); Notification.error({message: "endTime is later than beginTime!", delay: 2000});
return return
} }
if( $scope.selectedTopic === [] || (typeof $scope.selectedTopic) == "object"){ if ($scope.selectedTopic === [] || (typeof $scope.selectedTopic) == "object") {
return return
} }
$http({ $http({
@@ -80,13 +80,13 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
if (resp.status === 0) { if (resp.status === 0) {
console.log(resp); console.log(resp);
$scope.messageShowList = resp.data.page.content; $scope.messageShowList = resp.data.page.content;
if(resp.data.page.first){ if (resp.data.page.first) {
$scope.paginationConf.currentPage = 1; $scope.paginationConf.currentPage = 1;
} }
$scope.paginationConf.currentPage = resp.data.page.number + 1; $scope.paginationConf.currentPage = resp.data.page.number + 1;
$scope.paginationConf.totalItems = resp.data.page.totalElements; $scope.paginationConf.totalItems = resp.data.page.totalElements;
$scope.taskId = resp.data.taskId $scope.taskId = resp.data.taskId
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -114,10 +114,10 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
if (resp.status == 0) { if (resp.status == 0) {
console.log(resp); console.log(resp);
$scope.queryMessageByTopicResult = resp.data; $scope.queryMessageByTopicResult = resp.data;
$scope.changeShowMessageList(1,$scope.queryMessageByTopicResult.length); $scope.changeShowMessageList(1, $scope.queryMessageByTopicResult.length);
// todo // todo
// console.log($scope.queryMessageByTopicResult); // console.log($scope.queryMessageByTopicResult);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -131,26 +131,26 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
url: "message/queryMessageByTopicAndKey.query", url: "message/queryMessageByTopicAndKey.query",
params: { params: {
topic: $scope.selectedTopic, topic: $scope.selectedTopic,
key:$scope.key key: $scope.key
} }
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
console.log(resp); console.log(resp);
$scope.queryMessageByTopicAndKeyResult = resp.data; $scope.queryMessageByTopicAndKeyResult = resp.data;
console.log($scope.queryMessageByTopicAndKeyResult); console.log($scope.queryMessageByTopicAndKeyResult);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.queryMessageByBrokerAndOffset = function (storeHost,commitLogOffset) { $scope.queryMessageByBrokerAndOffset = function (storeHost, commitLogOffset) {
$http({ $http({
method: "GET", method: "GET",
url: "message/viewMessageByBrokerAndOffset.query", url: "message/viewMessageByBrokerAndOffset.query",
params: { params: {
brokerHost: storeHost.address, brokerHost: storeHost.address,
port:storeHost.port, port: storeHost.port,
offset: commitLogOffset offset: commitLogOffset
} }
}).success(function (resp) { }).success(function (resp) {
@@ -167,13 +167,13 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
}); });
}; };
$scope.queryMessageByMessageId = function (messageId,topic) { $scope.queryMessageByMessageId = function (messageId, topic) {
$http({ $http({
method: "GET", method: "GET",
url: "message/viewMessage.query", url: "message/viewMessage.query",
params: { params: {
msgId: messageId, msgId: messageId,
topic:topic topic: topic
} }
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
@@ -181,23 +181,23 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
ngDialog.open({ ngDialog.open({
template: 'messageDetailViewDialog', template: 'messageDetailViewDialog',
controller: 'messageDetailViewDialogController', controller: 'messageDetailViewDialogController',
data:resp.data data: resp.data
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
}; };
$scope.changeShowMessageList = function (currentPage,totalItem) { $scope.changeShowMessageList = function (currentPage, totalItem) {
var perPage = $scope.paginationConf.itemsPerPage; var perPage = $scope.paginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage; var from = (currentPage - 1) * perPage;
var to = (from + perPage)>totalItem?totalItem:from + perPage; var to = (from + perPage) > totalItem ? totalItem : from + perPage;
$scope.messageShowList = $scope.queryMessageByTopicResult.slice(from, to); $scope.messageShowList = $scope.queryMessageByTopicResult.slice(from, to);
$scope.paginationConf.totalItems = totalItem ; $scope.paginationConf.totalItems = totalItem;
}; };
$scope.onChangeQueryCondition = function (){ $scope.onChangeQueryCondition = function () {
console.log("change") console.log("change")
$scope.taskId = ""; $scope.taskId = "";
$scope.paginationConf.currentPage = 1; $scope.paginationConf.currentPage = 1;
@@ -205,12 +205,12 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
} }
}]); }]);
module.controller('messageDetailViewDialogController',['$scope', 'ngDialog', '$http','Notification', function ($scope, ngDialog, $http,Notification) { module.controller('messageDetailViewDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.resendMessage = function (messageView,consumerGroup) { $scope.resendMessage = function (messageView, consumerGroup) {
var topic = messageView.topic; var topic = messageView.topic;
var msgId = messageView.msgId; var msgId = messageView.msgId;
console.log('==='+topic+'==='+msgId); console.log('===' + topic + '===' + msgId);
if (topic.startsWith('%DLQ%')) { if (topic.startsWith('%DLQ%')) {
if (messageView.properties.hasOwnProperty("RETRY_TOPIC")) { if (messageView.properties.hasOwnProperty("RETRY_TOPIC")) {
topic = messageView.properties.RETRY_TOPIC; topic = messageView.properties.RETRY_TOPIC;
@@ -220,42 +220,41 @@ module.controller('messageDetailViewDialogController',['$scope', 'ngDialog', '$h
} }
} }
console.log('==='+topic+'==='+msgId); console.log('===' + topic + '===' + msgId);
$http({ $http({
method: "POST", method: "POST",
url: "message/consumeMessageDirectly.do", url: "message/consumeMessageDirectly.do",
params: { params: {
msgId: msgId, msgId: msgId,
consumerGroup:consumerGroup, consumerGroup: consumerGroup,
topic:topic topic: topic
} }
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
ngDialog.open({ ngDialog.open({
template: 'operationResultDialog', template: 'operationResultDialog',
data:{ data: {
result:resp.data result: resp.data
} }
}); });
} } else {
else {
ngDialog.open({ ngDialog.open({
template: 'operationResultDialog', template: 'operationResultDialog',
data:{ data: {
result:resp.errMsg result: resp.errMsg
} }
}); });
} }
}); });
}; };
$scope.showExceptionDesc = function (errmsg) { $scope.showExceptionDesc = function (errmsg) {
if(errmsg == null){ if (errmsg == null) {
errmsg = "Don't have Exception" errmsg = "Don't have Exception"
} }
ngDialog.open({ ngDialog.open({
template: 'operationResultDialog', template: 'operationResultDialog',
data:{ data: {
result:errmsg result: errmsg
} }
}); });
}; };

View File

@@ -15,10 +15,12 @@
* limitations under the License. * limitations under the License.
*/ */
app.controller('opsController', ['$scope','$location','$http','Notification','remoteApi','tools', function ($scope,$location,$http,Notification,remoteApi,tools) { app.controller('opsController', ['$scope', '$location', '$http', 'Notification', 'remoteApi', 'tools', '$window', function ($scope, $location, $http, Notification, remoteApi, tools, $window) {
$scope.namesvrAddrList = ""; $scope.namesvrAddrList = "";
$scope.useVIPChannel = true; $scope.useVIPChannel = true;
$scope.useTLS = false; $scope.useTLS = false;
$scope.userRole = $window.sessionStorage.getItem("userrole");
$scope.writeOperationEnabled = $scope.userRole == null ? true : ($scope.userRole == 1 ? true : false);
$http({ $http({
method: "GET", method: "GET",
url: "ops/homePage.query" url: "ops/homePage.query"
@@ -27,7 +29,7 @@ app.controller('opsController', ['$scope','$location','$http','Notification','re
$scope.namesvrAddrList = resp.data.namesvrAddrList.join(";"); $scope.namesvrAddrList = resp.data.namesvrAddrList.join(";");
$scope.useVIPChannel = resp.data.useVIPChannel; $scope.useVIPChannel = resp.data.useVIPChannel;
$scope.useTLS = resp.data.useTLS; $scope.useTLS = resp.data.useTLS;
}else{ } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -36,11 +38,11 @@ app.controller('opsController', ['$scope','$location','$http','Notification','re
$http({ $http({
method: "POST", method: "POST",
url: "ops/updateNameSvrAddr.do", url: "ops/updateNameSvrAddr.do",
params:{nameSvrAddrList:$scope.namesvrAddrList} params: {nameSvrAddrList: $scope.namesvrAddrList}
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
Notification.info({message: "SUCCESS", delay: 2000}); Notification.info({message: "SUCCESS", delay: 2000});
}else{ } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -49,11 +51,11 @@ app.controller('opsController', ['$scope','$location','$http','Notification','re
$http({ $http({
method: "POST", method: "POST",
url: "ops/updateIsVIPChannel.do", url: "ops/updateIsVIPChannel.do",
params:{useVIPChannel:$scope.useVIPChannel} params: {useVIPChannel: $scope.useVIPChannel}
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
Notification.info({message: "SUCCESS", delay: 2000}); Notification.info({message: "SUCCESS", delay: 2000});
}else{ } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -62,11 +64,11 @@ app.controller('opsController', ['$scope','$location','$http','Notification','re
$http({ $http({
method: "POST", method: "POST",
url: "ops/updateUseTLS.do", url: "ops/updateUseTLS.do",
params:{useTLS:$scope.useTLS} params: {useTLS: $scope.useTLS}
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
Notification.info({message: "SUCCESS", delay: 2000}); Notification.info({message: "SUCCESS", delay: 2000});
}else{ } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });

View File

@@ -4,20 +4,20 @@
var module = app; var module = app;
module.directive('ngConfirmClick', [ module.directive('ngConfirmClick', [
function(){ function () {
return { return {
link: function (scope, element, attr) { link: function (scope, element, attr) {
var msg = attr.ngConfirmClick || "Are you sure?"; var msg = attr.ngConfirmClick || "Are you sure?";
var clickAction = attr.confirmedClick; var clickAction = attr.confirmedClick;
element.bind('click',function (event) { element.bind('click', function (event) {
if ( window.confirm(msg) ) { if (window.confirm(msg)) {
scope.$eval(clickAction) scope.$eval(clickAction)
} }
}); });
} }
}; };
}]); }]);
module.controller('topicController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('topicController', ['$scope', 'ngDialog', '$http', 'Notification', '$window', function ($scope, ngDialog, $http, Notification, $window) {
$scope.paginationConf = { $scope.paginationConf = {
currentPage: 1, currentPage: 1,
totalItems: 0, totalItems: 0,
@@ -26,7 +26,7 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
perPageOptions: [10], perPageOptions: [10],
rememberPerPage: 'perPageItems', rememberPerPage: 'perPageItems',
onChange: function () { onChange: function () {
$scope.showTopicList(this.currentPage,this.totalItems); $scope.showTopicList(this.currentPage, this.totalItems);
} }
}; };
@@ -36,19 +36,21 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
$scope.filterSystem = false $scope.filterSystem = false
$scope.allTopicList = []; $scope.allTopicList = [];
$scope.topicShowList = []; $scope.topicShowList = [];
$scope.userRole = $window.sessionStorage.getItem("userrole");
$scope.writeOperationEnabled = $scope.userRole == null ? true : ($scope.userRole == 1 ? true : false);
$scope.refreshTopicList = function () { $scope.refreshTopicList = function () {
$http({ $http({
method: "GET", method: "GET",
url: "topic/list.query" url: "topic/list.query"
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
$scope.allTopicList = resp.data.topicList.sort(); $scope.allTopicList = resp.data.topicList.sort();
console.log($scope.allTopicList); console.log($scope.allTopicList);
console.log(JSON.stringify(resp)); console.log(JSON.stringify(resp));
$scope.showTopicList(1,$scope.allTopicList.length); $scope.showTopicList(1, $scope.allTopicList.length);
}else { } else {
Notification.error({message: resp.errMsg, delay: 5000}); Notification.error({message: resp.errMsg, delay: 5000});
} }
}); });
@@ -56,93 +58,93 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
$scope.refreshTopicList(); $scope.refreshTopicList();
$scope.filterStr=""; $scope.filterStr = "";
$scope.$watch('filterStr', function() { $scope.$watch('filterStr', function () {
$scope.filterList(1); $scope.filterList(1);
}); });
$scope.$watch('filterNormal', function() { $scope.$watch('filterNormal', function () {
$scope.filterList(1); $scope.filterList(1);
}); });
$scope.$watch('filterRetry', function() { $scope.$watch('filterRetry', function () {
$scope.filterList(1); $scope.filterList(1);
}); });
$scope.$watch('filterDLQ', function() { $scope.$watch('filterDLQ', function () {
$scope.filterList(1); $scope.filterList(1);
}); });
$scope.$watch('filterSystem', function() { $scope.$watch('filterSystem', function () {
$scope.filterList(1); $scope.filterList(1);
}); });
$scope.filterList = function (currentPage) { $scope.filterList = function (currentPage) {
var lowExceptStr = $scope.filterStr.toLowerCase(); var lowExceptStr = $scope.filterStr.toLowerCase();
var canShowList = []; var canShowList = [];
$scope.allTopicList.forEach(function(element) { $scope.allTopicList.forEach(function (element) {
if($scope.filterByType(element)){ if ($scope.filterByType(element)) {
if (element.toLowerCase().indexOf(lowExceptStr) != -1){ if (element.toLowerCase().indexOf(lowExceptStr) != -1) {
canShowList.push(element); canShowList.push(element);
} }
} }
}); });
$scope.paginationConf.totalItems =canShowList.length; $scope.paginationConf.totalItems = canShowList.length;
var perPage = $scope.paginationConf.itemsPerPage; var perPage = $scope.paginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage; var from = (currentPage - 1) * perPage;
var to = (from + perPage)>canShowList.length?canShowList.length:from + perPage; var to = (from + perPage) > canShowList.length ? canShowList.length : from + perPage;
$scope.topicShowList = canShowList.slice(from, to); $scope.topicShowList = canShowList.slice(from, to);
}; };
$scope.filterByType = function(str){ $scope.filterByType = function (str) {
if($scope.filterRetry){ if ($scope.filterRetry) {
if(str.startsWith("%R")){ if (str.startsWith("%R")) {
return true return true
} }
} }
if($scope.filterDLQ){ if ($scope.filterDLQ) {
if(str.startsWith("%D")){ if (str.startsWith("%D")) {
return true return true
} }
} }
if($scope.filterSystem){ if ($scope.filterSystem) {
if(str.startsWith("%S")){ if (str.startsWith("%S")) {
return true return true
} }
} }
if($scope.filterNormal){ if ($scope.filterNormal) {
if(str.startsWith("%") == false){ if (str.startsWith("%") == false) {
return true return true
} }
} }
return false; return false;
}; };
$scope.showTopicList = function (currentPage,totalItem) { $scope.showTopicList = function (currentPage, totalItem) {
if($scope.filterStr != ""){ if ($scope.filterStr != "") {
$scope.filterList(currentPage); $scope.filterList(currentPage);
return; return;
} }
var perPage = $scope.paginationConf.itemsPerPage; var perPage = $scope.paginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage; var from = (currentPage - 1) * perPage;
var to = (from + perPage)>totalItem?totalItem:from + perPage; var to = (from + perPage) > totalItem ? totalItem : from + perPage;
console.log($scope.allTopicList); console.log($scope.allTopicList);
console.log(from) console.log(from)
console.log(to) console.log(to)
$scope.topicShowList = $scope.allTopicList.slice(from, to); $scope.topicShowList = $scope.allTopicList.slice(from, to);
$scope.paginationConf.totalItems = totalItem ; $scope.paginationConf.totalItems = totalItem;
console.log($scope.topicShowList) console.log($scope.topicShowList)
console.log($scope.paginationConf.totalItems) console.log($scope.paginationConf.totalItems)
$scope.filterList(currentPage); $scope.filterList(currentPage);
}; };
$scope.deleteTopic= function (topic) { $scope.deleteTopic = function (topic) {
$http({ $http({
method: "POST", method: "POST",
url: "topic/deleteTopic.do", url: "topic/deleteTopic.do",
params:{ params: {
topic:topic topic: topic
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
Notification.info({message: "delete success!", delay: 2000}); Notification.info({message: "delete success!", delay: 2000});
$scope.refreshTopicList(); $scope.refreshTopicList();
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -157,13 +159,13 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
console.log(JSON.stringify(resp)); console.log(JSON.stringify(resp));
ngDialog.open({ ngDialog.open({
template: 'statsViewDialog', template: 'statsViewDialog',
trapFocus:false, trapFocus: false,
data:{ data: {
topic:topic, topic: topic,
statsData:resp.data statsData: resp.data
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
@@ -179,13 +181,13 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
ngDialog.open({ ngDialog.open({
template: 'routerViewDialog', template: 'routerViewDialog',
controller: 'routerViewDialogController', controller: 'routerViewDialogController',
trapFocus:false, trapFocus: false,
data:{ data: {
topic:topic, topic: topic,
routeData:resp.data routeData: resp.data
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
@@ -202,13 +204,13 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
console.log(JSON.stringify(resp)); console.log(JSON.stringify(resp));
ngDialog.open({ ngDialog.open({
template: 'consumerViewDialog', template: 'consumerViewDialog',
data:{ data: {
topic:topic, topic: topic,
consumerData:resp.data, consumerData: resp.data,
consumerGroupCount:Object.keys(resp.data).length consumerGroupCount: Object.keys(resp.data).length
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
@@ -217,9 +219,9 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
ngDialog.open({ ngDialog.open({
template: 'deleteTopicDialog', template: 'deleteTopicDialog',
controller: 'deleteTopicDialogController', controller: 'deleteTopicDialogController',
data:{ data: {
topic:topic, topic: topic,
consumerData:"asd" consumerData: "asd"
} }
}); });
}; };
@@ -229,25 +231,25 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
$http({ $http({
method: "GET", method: "GET",
url: "topic/queryTopicConsumerInfo.query", url: "topic/queryTopicConsumerInfo.query",
params:{ params: {
topic:topic topic: topic
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
if(resp.data.groupList == null){ if (resp.data.groupList == null) {
Notification.error({message: "don't have consume group!", delay: 2000}); Notification.error({message: "don't have consume group!", delay: 2000});
return return
} }
ngDialog.open({ ngDialog.open({
template: 'consumerResetOffsetDialog', template: 'consumerResetOffsetDialog',
controller: 'consumerResetOffsetDialogController', controller: 'consumerResetOffsetDialogController',
data:{ data: {
topic: topic, topic: topic,
selectedConsumerGroup:[], selectedConsumerGroup: [],
allConsumerGroupList:resp.data.groupList allConsumerGroupList: resp.data.groupList
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -258,25 +260,25 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
$http({ $http({
method: "GET", method: "GET",
url: "topic/queryTopicConsumerInfo.query", url: "topic/queryTopicConsumerInfo.query",
params:{ params: {
topic:topic topic: topic
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
if(resp.data.groupList == null){ if (resp.data.groupList == null) {
Notification.error({message: "don't have consume group!", delay: 2000}); Notification.error({message: "don't have consume group!", delay: 2000});
return return
} }
ngDialog.open({ ngDialog.open({
template: 'skipMessageAccumulateDialog', template: 'skipMessageAccumulateDialog',
controller: 'skipMessageAccumulateDialogController', controller: 'skipMessageAccumulateDialogController',
data:{ data: {
topic: topic, topic: topic,
selectedConsumerGroup:[], selectedConsumerGroup: [],
allConsumerGroupList:resp.data.groupList allConsumerGroupList: resp.data.groupList
} }
}); });
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -296,13 +298,13 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
$http({ $http({
method: "GET", method: "GET",
url: "topic/examineTopicConfig.query", url: "topic/examineTopicConfig.query",
params:{ params: {
topic:topic topic: topic
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
$scope.openCreateOrUpdateDialog(resp.data, sysFlag); $scope.openCreateOrUpdateDialog(resp.data, sysFlag);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
@@ -310,14 +312,14 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
$scope.openCreateOrUpdateDialog = function (request, sysFlag) { $scope.openCreateOrUpdateDialog = function (request, sysFlag) {
var bIsUpdate = true; var bIsUpdate = true;
if(request == null){ if (request == null) {
request = [{ request = [{
writeQueueNums:16, writeQueueNums: 16,
readQueueNums:16, readQueueNums: 16,
perm:6, perm: 6,
order:false, order: false,
topicName:"", topicName: "",
brokerNameList:[] brokerNameList: []
}]; }];
bIsUpdate = false; bIsUpdate = false;
} }
@@ -325,21 +327,22 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
method: "GET", method: "GET",
url: "cluster/list.query" url: "cluster/list.query"
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
console.log(resp); console.log(resp);
ngDialog.open({ ngDialog.open({
preCloseCallback: function(value) { preCloseCallback: function (value) {
// Refresh topic list // Refresh topic list
$scope.refreshTopicList(); $scope.refreshTopicList();
}, },
template: 'topicModifyDialog', template: 'topicModifyDialog',
controller: 'topicModifyDialogController', controller: 'topicModifyDialogController',
data:{ data: {
sysFlag:sysFlag, sysFlag: sysFlag,
topicRequestList:request, topicRequestList: request,
allClusterNameList:Object.keys(resp.data.clusterInfo.clusterAddrTable), allClusterNameList: Object.keys(resp.data.clusterInfo.clusterAddrTable),
allBrokerNameList:Object.keys(resp.data.brokerServer), allBrokerNameList: Object.keys(resp.data.brokerServer),
bIsUpdate:bIsUpdate bIsUpdate: bIsUpdate,
writeOperationEnabled: $scope.writeOperationEnabled
} }
}); });
} }
@@ -352,7 +355,7 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio
}]); }]);
module.controller('topicModifyDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('topicModifyDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.postTopicRequest = function (topicRequestItem) { $scope.postTopicRequest = function (topicRequestItem) {
console.log(topicRequestItem); console.log(topicRequestItem);
var request = JSON.parse(JSON.stringify(topicRequestItem)); var request = JSON.parse(JSON.stringify(topicRequestItem));
@@ -360,19 +363,19 @@ module.controller('topicModifyDialogController', ['$scope', 'ngDialog', '$http',
$http({ $http({
method: "POST", method: "POST",
url: "topic/createOrUpdate.do", url: "topic/createOrUpdate.do",
data:request data: request
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
Notification.info({message: "success!", delay: 2000}); Notification.info({message: "success!", delay: 2000});
ngDialog.close(this); ngDialog.close(this);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}); });
} }
}] }]
); );
module.controller('consumerResetOffsetDialogController',['$scope', 'ngDialog', '$http','Notification', function ($scope, ngDialog, $http,Notification) { module.controller('consumerResetOffsetDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.timepicker = {}; $scope.timepicker = {};
$scope.timepicker.date = moment().format('YYYY-MM-DD HH:mm'); $scope.timepicker.date = moment().format('YYYY-MM-DD HH:mm');
$scope.timepicker.options = {format: 'YYYY-MM-DD HH:mm', showClear: true}; $scope.timepicker.options = {format: 'YYYY-MM-DD HH:mm', showClear: true};
@@ -386,19 +389,19 @@ module.controller('consumerResetOffsetDialogController',['$scope', 'ngDialog', '
data: { data: {
resetTime: $scope.timepicker.date.valueOf(), resetTime: $scope.timepicker.date.valueOf(),
consumerGroupList: $scope.ngDialogData.selectedConsumerGroup, consumerGroupList: $scope.ngDialogData.selectedConsumerGroup,
topic:$scope.ngDialogData.topic, topic: $scope.ngDialogData.topic,
force:true force: true
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
ngDialog.open({ ngDialog.open({
template: 'resetOffsetResultDialog', template: 'resetOffsetResultDialog',
data:{ data: {
result:resp.data result: resp.data
} }
}); });
ngDialog.close(this); ngDialog.close(this);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
@@ -406,7 +409,7 @@ module.controller('consumerResetOffsetDialogController',['$scope', 'ngDialog', '
}] }]
); );
module.controller('skipMessageAccumulateDialogController',['$scope', 'ngDialog', '$http','Notification', function ($scope, ngDialog, $http,Notification) { module.controller('skipMessageAccumulateDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.skipAccumulate = function () { $scope.skipAccumulate = function () {
console.log($scope.ngDialogData.selectedConsumerGroup); console.log($scope.ngDialogData.selectedConsumerGroup);
$http({ $http({
@@ -415,19 +418,19 @@ module.controller('skipMessageAccumulateDialogController',['$scope', 'ngDialog',
data: { data: {
resetTime: -1, resetTime: -1,
consumerGroupList: $scope.ngDialogData.selectedConsumerGroup, consumerGroupList: $scope.ngDialogData.selectedConsumerGroup,
topic:$scope.ngDialogData.topic, topic: $scope.ngDialogData.topic,
force:true force: true
} }
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
ngDialog.open({ ngDialog.open({
template: 'resetOffsetResultDialog', template: 'resetOffsetResultDialog',
data:{ data: {
result:resp.data result: resp.data
} }
}); });
ngDialog.close(this); ngDialog.close(this);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
@@ -435,7 +438,7 @@ module.controller('skipMessageAccumulateDialogController',['$scope', 'ngDialog',
}] }]
); );
module.controller('sendTopicMessageDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('sendTopicMessageDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.sendTopicMessage = { $scope.sendTopicMessage = {
topic: $scope.ngDialogData.topic, topic: $scope.ngDialogData.topic,
key: "key", key: "key",
@@ -449,37 +452,35 @@ module.controller('sendTopicMessageDialogController', ['$scope', 'ngDialog', '$h
url: "topic/sendTopicMessage.do", url: "topic/sendTopicMessage.do",
data: $scope.sendTopicMessage data: $scope.sendTopicMessage
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
ngDialog.open({ ngDialog.open({
template: 'sendResultDialog', template: 'sendResultDialog',
data:{ data: {
result:resp.data result: resp.data
} }
}); });
ngDialog.close(this); ngDialog.close(this);
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
} }
}] }]
); );
module.controller('routerViewDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) { module.controller('routerViewDialogController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.deleteTopicByBroker = function (broker) { $scope.deleteTopicByBroker = function (broker) {
$http({ $http({
method: "POST", method: "POST",
url: "topic/deleteTopicByBroker.do", url: "topic/deleteTopicByBroker.do",
params: {brokerName:broker.brokerName,topic:$scope.ngDialogData.topic} params: {brokerName: broker.brokerName, topic: $scope.ngDialogData.topic}
}).success(function (resp) { }).success(function (resp) {
if(resp.status ==0){ if (resp.status == 0) {
Notification.info({message: "delete success", delay: 2000}); Notification.info({message: "delete success", delay: 2000});
}else { } else {
Notification.error({message: resp.errMsg, delay: 2000}); Notification.error({message: resp.errMsg, delay: 2000});
} }
}) })
}; };
}] }]
); );

View File

@@ -25,13 +25,11 @@
<input type="text" class="form-control" ng-model="filterStr"> <input type="text" class="form-control" ng-model="filterStr">
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="openAddDialog()">{{'ADD' | ng-click="openAddDialog()">{{'ADD' | translate}}/ {{'UPDATE' | translate}}
translate}}/ {{'UPDATE' | translate}}
</button> </button>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="refreshConsumerData()"> <button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="refreshConsumerData()">
{{'REFRESH' | translate}} {{'REFRESH' | translate}}
</button> </button>
@@ -48,8 +46,7 @@
<div id="deployList" class="row"> <div id="deployList" class="row">
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<th class="text-center"><a ng-click="sortByKey('group')">{{ 'SUBSCRIPTION_GROUP' | <th class="text-center"><a ng-click="sortByKey('group')">{{ 'SUBSCRIPTION_GROUP' | translate}}</a></th>
translate}}</a></th>
<th class="text-center"><a ng-click="sortByKey('count')">{{ 'QUANTITY' | translate}}</a></th> <th class="text-center"><a ng-click="sortByKey('count')">{{ 'QUANTITY' | translate}}</a></th>
<th class="text-center">{{ 'VERSION' | translate}}</th> <th class="text-center">{{ 'VERSION' | translate}}</th>
<th class="text-center">{{ 'TYPE' | translate}}</th> <th class="text-center">{{ 'TYPE' | translate}}</th>
@@ -83,6 +80,7 @@
<!--</button>--> <!--</button>-->
<button name="client" ng-click="delete(consumerGroup.group)" <button name="client" ng-click="delete(consumerGroup.group)"
class="btn btn-raised btn-sm btn-danger" class="btn btn-raised btn-sm btn-danger"
ng-show="{{writeOperationEnabled}}"
type="button">{{'DELETE' | translate}} type="button">{{'DELETE' | translate}}
</button> </button>
@@ -242,25 +240,28 @@
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4">consumeEnable:</label> <label class="control-label col-sm-4">consumeEnable:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="item.subscriptionGroupConfig.consumeEnable"> <md-switch class="md-primary" ng-disabled="{{!ngDialogData.writeOperationEnabled}}" md-no-ink
aria-label="Switch No Ink" ng-model="item.subscriptionGroupConfig.consumeEnable">
</md-switch> </md-switch>
<!--<input class="form-control" ng-model="item.subscriptionGroupConfig.consumeEnable"--> <!--<input class="form-control" ng-model="item.subscriptionGroupConfig.consumeEnable"-->
<!--type="text"--> <!--type="text"-->
<!--required/>--> <!--required/>-->
<!--<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>--> <!--<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>-->
</div> </div>
</div> </div>
<!--<div class="form-group">--> <!--<div class="form-group">-->
<!--<label class="control-label col-sm-4">consumeFromMinEnable:</label>--> <!--<label class="control-label col-sm-4">consumeFromMinEnable:</label>-->
<!--<div class="col-sm-8">--> <!--<div class="col-sm-8">-->
<!--<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="item.subscriptionGroupConfig.consumeFromMinEnable">--> <!--<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="item.subscriptionGroupConfig.consumeFromMinEnable">-->
<!--</md-switch>--> <!--</md-switch>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4">consumeBroadcastEnable:</label> <label class="control-label col-sm-4">consumeBroadcastEnable:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="item.subscriptionGroupConfig.consumeBroadcastEnable"> <md-switch class="md-primary" ng-disabled="{{!ngDialogData.writeOperationEnabled}}" md-no-ink
aria-label="Switch No Ink"
ng-model="item.subscriptionGroupConfig.consumeBroadcastEnable">
</md-switch> </md-switch>
</div> </div>
</div> </div>
@@ -268,25 +269,25 @@
<label class="control-label col-sm-4">retryQueueNums:</label> <label class="control-label col-sm-4">retryQueueNums:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control" ng-model="item.subscriptionGroupConfig.retryQueueNums" <input class="form-control" ng-model="item.subscriptionGroupConfig.retryQueueNums"
type="text" type="text" ng-disabled="{{!ngDialogData.writeOperationEnabled}}"
required/> required/>
<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span> <span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>
</div> </div>
</div> </div>
<!--<div class="form-group">--> <!--<div class="form-group">-->
<!--<label class="control-label col-sm-4">retryMaxTimes:</label>--> <!--<label class="control-label col-sm-4">retryMaxTimes:</label>-->
<!--<div class="col-sm-8">--> <!--<div class="col-sm-8">-->
<!--<input class="form-control" ng-model="item.subscriptionGroupConfig.retryMaxTimes"--> <!--<input class="form-control" ng-model="item.subscriptionGroupConfig.retryMaxTimes"-->
<!--type="text"--> <!--type="text"-->
<!--required/>--> <!--required/>-->
<!--<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>--> <!--<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>-->
<!--</div>--> <!--</div>-->
<!--</div>--> <!--</div>-->
<div class="form-group"> <div class="form-group">
<label class="control-label col-sm-4">brokerId:</label> <label class="control-label col-sm-4">brokerId:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control" ng-model="item.subscriptionGroupConfig.brokerId" type="text" <input class="form-control" ng-model="item.subscriptionGroupConfig.brokerId" type="text"
required/> ng-disabled="{{!ngDialogData.writeOperationEnabled}}" required/>
<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span> <span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>
</div> </div>
</div> </div>
@@ -295,18 +296,26 @@
<div class="col-sm-8"> <div class="col-sm-8">
<input class="form-control" <input class="form-control"
ng-model="item.subscriptionGroupConfig.whichBrokerWhenConsumeSlowly" type="text" ng-model="item.subscriptionGroupConfig.whichBrokerWhenConsumeSlowly" type="text"
required/> ng-disabled="{{!ngDialogData.writeOperationEnabled}}" required/>
<span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span> <span class="text-danger" ng-show="addAppForm.name.$error.required">编号不能为空.</span>
</div> </div>
</div> </div>
</form> </form>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-raised btn-primary" ng-disabled="addAppForm.$invalid" <div class="ngdialog-buttons">
ng-click="postConsumerRequest(item)">{{ 'COMMIT' | translate }} <button type="button" class="ngdialog-button ngdialog-button-primary"
</button> ng-disabled="addAppForm.$invalid"
ng-show="{{ngDialogData.writeOperationEnabled}}"
ng-click="postConsumerRequest(item)">{{ 'COMMIT' | translate }}
</button>
<button type="button" class="ngdialog-button ngdialog-button-secondary"
ng-click="closeThisDialog('Cancel')">{{ 'CLOSE' | translate }}
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
</script> </script>
@@ -396,7 +405,9 @@
<td><label>{{ 'DELAY' | translate }}</label></td> <td><label>{{ 'DELAY' | translate }}</label></td>
<td>{{consumeDetail.diffTotal}}</td> <td>{{consumeDetail.diffTotal}}</td>
<td><label>{{ 'LAST_CONSUME_TIME' | translate }}</label></td> <td><label>{{ 'LAST_CONSUME_TIME' | translate }}</label></td>
<td>{{(consumeDetail.lastTimestamp == 0)?"N/A":consumeDetail.lastTimestamp | date:'yyyy-MM-dd HH:mm:ss'}}</td> <td>{{(consumeDetail.lastTimestamp == 0)?"N/A":consumeDetail.lastTimestamp |
date:'yyyy-MM-dd HH:mm:ss'}}
</td>
</tr> </tr>
</table> </table>
</td> </td>
@@ -422,7 +433,8 @@
<td class="text-center">{{item.brokerOffset}}</td> <td class="text-center">{{item.brokerOffset}}</td>
<td class="text-center">{{item.consumerOffset}}</td> <td class="text-center">{{item.consumerOffset}}</td>
<td class="text-center">{{item.brokerOffset-item.consumerOffset}}</td> <td class="text-center">{{item.brokerOffset-item.consumerOffset}}</td>
<td class="text-center">{{(item.lastTimestamp == 0)?"N/A":item.lastTimestamp | date:'yyyy-MM-dd HH:mm:ss'}}</td> <td class="text-center">{{(item.lastTimestamp == 0)?"N/A":item.lastTimestamp | date:'yyyy-MM-dd HH:mm:ss'}}
</td>
</tr> </tr>
</table> </table>
</td> </td>

View File

@@ -41,7 +41,8 @@
<div class="form-group "> <div class="form-group ">
<label>{{'BEGIN' | translate}}:</label> <label>{{'BEGIN' | translate}}:</label>
<div class="input-group"> <div class="input-group">
<input class="form-control" datetimepicker ng-change="onChangeQueryCondition()" ng-model="timepickerBegin" <input class="form-control" datetimepicker
ng-change="onChangeQueryCondition()" ng-model="timepickerBegin"
options="timepickerOptions"/> options="timepickerOptions"/>
<span class="input-group-addon"><span <span class="input-group-addon"><span
class="glyphicon glyphicon-calendar"></span></span> class="glyphicon glyphicon-calendar"></span></span>
@@ -50,7 +51,8 @@
<div class="form-group"> <div class="form-group">
<label>{{'END' | translate}}:</label> <label>{{'END' | translate}}:</label>
<div class="input-group"> <div class="input-group">
<input class="form-control" datetimepicker ng-change="onChangeQueryCondition()" ng-model="timepickerEnd" <input class="form-control" datetimepicker
ng-change="onChangeQueryCondition()" ng-model="timepickerEnd"
options="timepickerOptions"/> options="timepickerOptions"/>
<span class="input-group-addon"><span <span class="input-group-addon"><span
class="glyphicon glyphicon-calendar"></span></span> class="glyphicon glyphicon-calendar"></span></span>
@@ -79,8 +81,7 @@
</td> </td>
<td class="text-center"> <td class="text-center">
<button class="btn btn-raised btn-sm btn-primary" type="button" <button class="btn btn-raised btn-sm btn-primary" type="button"
ng-click="queryMessageByMessageId(item.msgId,item.topic)">Message ng-click="queryMessageByMessageId(item.msgId,item.topic)">{{'MESSAGE_DETAIL' | translate}}
Detail
</button> </button>
</td> </td>
</tr> </tr>
@@ -237,11 +238,11 @@
<td class="text-center"> <td class="text-center">
<button class="btn btn-raised btn-sm btn-primary" type="button" <button class="btn btn-raised btn-sm btn-primary" type="button"
ng-click="resendMessage(ngDialogData.messageView,item.consumerGroup)"> ng-click="resendMessage(ngDialogData.messageView,item.consumerGroup)">
Resend Message {{ 'RESEND_MESSAGE' | translate}}
</button> </button>
<button class="btn btn-raised btn-sm btn-primary" type="button" <button class="btn btn-raised btn-sm btn-primary" type="button"
ng-click="showExceptionDesc(item.exceptionDesc)"> ng-click="showExceptionDesc(item.exceptionDesc)">
View Exception {{ 'VIEW_EXCEPTION' | translate}}
</button> </button>
</td> </td>
</tr> </tr>

View File

@@ -18,21 +18,24 @@
<div class="page-content"> <div class="page-content">
<h2 class="md-title">NameServerAddressList</h2> <h2 class="md-title">NameServerAddressList</h2>
<div class="pull-left"> <div class="pull-left">
<input type="text" class="form-control" ng-model="namesvrAddrList" /> <input type="text" class="form-control" ng-model="namesvrAddrList" ng-disabled="{{!writeOperationEnabled}}"/>
</div> </div>
<div class="pull-left"> <div class="pull-left">
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="updateNameSvrAddr()">{{'UPDATE' | translate}} <button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"
ng-click="updateNameSvrAddr()">{{'UPDATE' | translate}}
</button> </button>
</div> </div>
<br/> <br/>
<br/> <br/>
<h2 class="md-title">IsUseVIPChannel</h2> <h2 class="md-title">IsUseVIPChannel</h2>
<div class="pull-left"> <div class="pull-left">
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="useVIPChannel"> <md-switch class="md-primary" ng-disabled="{{!writeOperationEnabled}}" md-no-ink aria-label="Switch No Ink"
ng-model="useVIPChannel">
</md-switch> </md-switch>
</div> </div>
<div class="pull-left"> <div class="pull-left">
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="updateIsVIPChannel()">{{'UPDATE' | translate}} <button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"
ng-click="updateIsVIPChannel()">{{'UPDATE' | translate}}
</button> </button>
</div> </div>
@@ -40,12 +43,14 @@
<br/> <br/>
<br/> <br/>
<h2 class="md-title">useTLS</h2> <h2 class="md-title">useTLS</h2>
<div class="pull-left"> <div class="pull-left">
<md-switch class="md-primary" md-no-ink aria-label="Switch No Ink" ng-model="useTLS"> <md-switch class="md-primary" ng-disabled="{{!writeOperationEnabled}}" md-no-ink aria-label="Switch No Ink"
ng-model="useTLS">
</md-switch> </md-switch>
</div> </div>
<div class="pull-left"> <div class="pull-left">
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="updateUseTLS()">{{'UPDATE' | translate}} <button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"
ng-click="updateUseTLS()">{{'UPDATE' | translate}}
</button> </button>
</div> </div>
</div> </div>

View File

@@ -30,8 +30,8 @@
</md-checkbox> </md-checkbox>
<md-checkbox aria-label="Checkbox" ng-model="filterSystem" class="md-primary">{{'SYSTEM' | translate}} <md-checkbox aria-label="Checkbox" ng-model="filterSystem" class="md-primary">{{'SYSTEM' | translate}}
</md-checkbox> </md-checkbox>
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="openAddDialog()">{{'ADD' | <button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"
translate}}/ {{'UPDATE' | translate}} ng-click="openAddDialog()">{{'ADD' | translate}}/ {{'UPDATE' | translate}}
</button> </button>
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="refreshTopicList()"> <button class="btn btn-raised btn-sm btn-primary" type="button" ng-click="refreshTopicList()">
{{'REFRESH' | translate}} {{'REFRESH' | translate}}
@@ -68,15 +68,16 @@
ng-click="openSendTopicMessageDialog(topic)">{{'SEND_MSG' | translate}} ng-click="openSendTopicMessageDialog(topic)">{{'SEND_MSG' | translate}}
</button> </button>
<button class="btn btn-raised btn-sm btn-danger" type="button" <button class="btn btn-raised btn-sm btn-danger" type="button"
ng-show="{{!sysFlag}}" ng-show="{{!sysFlag && writeOperationEnabled}}"
ng-click="openConsumerResetOffsetDialog(topic)">{{'RESET_CUS_OFFSET' | translate}} ng-click="openConsumerResetOffsetDialog(topic)">{{'RESET_CUS_OFFSET' | translate}}
</button> </button>
<button class="btn btn-raised btn-sm btn-danger" type="button" <button class="btn btn-raised btn-sm btn-danger" type="button"
ng-show="{{!sysFlag}}" ng-show="{{!sysFlag && writeOperationEnabled}}"
ng-click="openSkipMessageAccumulateDialog(topic)">{{'SKIP_MESSAGE_ACCUMULATE' | translate}} ng-click="openSkipMessageAccumulateDialog(topic)">{{'SKIP_MESSAGE_ACCUMULATE' |
translate}}
</button> </button>
<button class="btn btn-raised btn-sm btn-danger" type="button" <button class="btn btn-raised btn-sm btn-danger" type="button"
ng-show="{{!sysFlag}}" ng-show="{{!sysFlag && writeOperationEnabled}}"
ng-confirm-click="Are you sure to delete?" ng-confirm-click="Are you sure to delete?"
confirmed-click="deleteTopic(topic)">{{'DELETE' | translate}} confirmed-click="deleteTopic(topic)">{{'DELETE' | translate}}
</button> </button>
@@ -192,7 +193,7 @@
<label class="control-label col-sm-2">{{'WRITE_QUEUE_NUMS'|translate}}:</label> <label class="control-label col-sm-2">{{'WRITE_QUEUE_NUMS'|translate}}:</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control" ng-model="item.writeQueueNums" name="writeQueueNums" type="text" <input class="form-control" ng-model="item.writeQueueNums" name="writeQueueNums" type="text"
required/> ng-disabled="{{!ngDialogData.writeOperationEnabled}}" required/>
<span class="text-danger" ng-show="addAppForm.writeQueueNums.$error.required">{{'WRITE_QUEUE_NUMS'|translate}}不能为空.</span> <span class="text-danger" ng-show="addAppForm.writeQueueNums.$error.required">{{'WRITE_QUEUE_NUMS'|translate}}不能为空.</span>
</div> </div>
</div> </div>
@@ -200,7 +201,7 @@
<label class="control-label col-sm-2">{{'READ_QUEUE_NUMS'|translate}}:</label> <label class="control-label col-sm-2">{{'READ_QUEUE_NUMS'|translate}}:</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control" ng-model="item.readQueueNums" name="readQueueNums" type="text" <input class="form-control" ng-model="item.readQueueNums" name="readQueueNums" type="text"
required/> ng-disabled="{{!ngDialogData.writeOperationEnabled}}" required/>
<span class="text-danger" ng-show="addAppForm.readQueueNums.$error.required">{{'READ_QUEUE_NUMS'|translate}}不能为空.</span> <span class="text-danger" ng-show="addAppForm.readQueueNums.$error.required">{{'READ_QUEUE_NUMS'|translate}}不能为空.</span>
</div> </div>
</div> </div>
@@ -208,7 +209,7 @@
<label class="control-label col-sm-2">{{'PERM'|translate}}:</label> <label class="control-label col-sm-2">{{'PERM'|translate}}:</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input class="form-control" ng-model="item.perm" name="perm" type="text" <input class="form-control" ng-model="item.perm" name="perm" type="text"
required/> ng-disabled="{{!ngDialogData.writeOperationEnabled}}" required/>
<span class="text-danger" ng-show="addAppForm.perm.$error.required">{{'PERM'|translate}}不能为空.</span> <span class="text-danger" ng-show="addAppForm.perm.$error.required">{{'PERM'|translate}}不能为空.</span>
</div> </div>
</div> </div>
@@ -216,7 +217,7 @@
<div class="modal-footer"> <div class="modal-footer">
<div class="ngdialog-buttons"> <div class="ngdialog-buttons">
<button type="button" class="ngdialog-button ngdialog-button-primary" <button type="button" class="ngdialog-button ngdialog-button-primary"
ng-show="{{!ngDialogData.sysFlag}}" ng-show="{{!ngDialogData.sysFlag && ngDialogData.writeOperationEnabled}}"
ng-click="postTopicRequest(item)">{{ 'COMMIT' | translate }} ng-click="postTopicRequest(item)">{{ 'COMMIT' | translate }}
</button> </button>
<button type="button" class="ngdialog-button ngdialog-button-secondary" <button type="button" class="ngdialog-button ngdialog-button-secondary"

View File

@@ -96,7 +96,7 @@ public class LoginControllerTest extends BaseControllerTest {
.param("password", rightPwd); .param("password", rightPwd);
perform = mockMvc.perform(requestBuilder); perform = mockMvc.perform(requestBuilder);
perform.andExpect(status().isOk()) perform.andExpect(status().isOk())
.andExpect(jsonPath("$.data").value(contextPath)); .andExpect(jsonPath("$.data.contextPath").value(contextPath));
} }