Skip to content

Commit

Permalink
Merge pull request #4 from tcrow/tcrow
Browse files Browse the repository at this point in the history
update cluster UI
  • Loading branch information
StyleTang committed Jan 17, 2017
2 parents db17c14 + 8365073 commit a900f60
Show file tree
Hide file tree
Showing 33 changed files with 200 additions and 198 deletions.
58 changes: 29 additions & 29 deletions src/main/webapp/WEB-INF/springmvc-servlet.xml
@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
"
default-autowire="byType">

<mvc:annotation-driven>
<mvc:return-value-handlers>
<bean class="org.apache.rocketmq.console.support.JsonBodyReturnValueProcessor"></bean>
</mvc:return-value-handlers>
</mvc:annotation-driven>


<!-- 自动扫描且只扫描@Controller -->
<context:component-scan base-package="org.apache.rocketmq.console.controller" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--<mvc:resources mapping="/static/**" location="/WEB-INF/static/" />-->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="" />
<property name="suffix" value=".htm" />
</bean>

<?xml version="1.0" encoding="utf-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
"
default-autowire="byType">

<mvc:annotation-driven>
<mvc:return-value-handlers>
<bean class="org.apache.rocketmq.console.support.JsonBodyReturnValueProcessor"></bean>
</mvc:return-value-handlers>
</mvc:annotation-driven>


<!-- 自动扫描且只扫描@Controller -->
<context:component-scan base-package="org.apache.rocketmq.console.controller" use-default-filters="false">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!--<mvc:resources mapping="/static/**" location="/WEB-INF/static/" />-->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="" />
<property name="suffix" value=".htm" />
</bean>

</beans>
76 changes: 38 additions & 38 deletions src/main/webapp/WEB-INF/web.xml
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>rocketmq-console</display-name>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/applicationContext.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.query</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>/index.html</welcome-file>
</welcome-file-list>

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>rocketmq-console</display-name>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/applicationContext.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.query</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>/index.html</welcome-file>
</welcome-file-list>

</web-app>
72 changes: 36 additions & 36 deletions src/main/webapp/src/app.js
Expand Up @@ -17,28 +17,28 @@ var app = angular.module('app', [
]).run(
['$rootScope','$location','$cookies',
function ($rootScope,$location,$cookies) {
var filter = function(url){
var outFilterArrs = []
outFilterArrs.push("/login");
outFilterArrs.push("/reg");
outFilterArrs.push("/logout");
outFilterArrs.push("/404");
var flag = false;
$.each(outFilterArrs,function(i,value){
if(url.indexOf(value) > -1){
flag = true;
return false;
}
});
return flag;
}
// var filter = function(url){
// var outFilterArrs = []
// outFilterArrs.push("/login");
// outFilterArrs.push("/reg");
// outFilterArrs.push("/logout");
// outFilterArrs.push("/404");
// var flag = false;
// $.each(outFilterArrs,function(i,value){
// if(url.indexOf(value) > -1){
// flag = true;
// return false;
// }
// });
// return flag;
// }

// if(angular.isDefined($cookies.get("isLogin")) && $cookies.get("isLogin") == 'true'){
// chatApi.login();
// }


$rootScope.$on('$routeChangeSuccess', function(evt, current, previous) {
$rootScope.$on('$routeChangeSuccess', function() {
var pathArray = $location.url().split("/");
var index = pathArray.indexOf("");
if(index >= 0){
Expand All @@ -65,7 +65,7 @@ var app = angular.module('app', [
});

//路由跳转检查过滤器,未登陆的用户直接跳转到登陆页面,已登陆但未实名用户跳转到实名页面
$rootScope.$on('$routeChangeStart',function (evt, next,current) {
// $rootScope.$on('$routeChangeStart',function (evt, next,current) {
//登陆和注册页面豁免检查是否登陆状态
// if(angular.isUndefined($rootScope.userInfo)){
// $rootScope.userInfo = {};
Expand All @@ -85,7 +85,7 @@ var app = angular.module('app', [
// }else{
// $location.path("/login");
// }
})
// })
}
]
).animation('.view', function () {
Expand Down Expand Up @@ -137,24 +137,24 @@ app.config(['$routeProvider', '$httpProvider','$cookiesProvider','getDictNamePro
* @param ele
* @param showTime
*/
var removeAlertMsg = function(ele,showTime){
if(showTime > -1){
setTimeout(function(){
$(ele).remove();
},showTime);
}
}

var alertMsg = function (classes,errorMsg) {
$(".alertModal").modal();
var alertEle = new Date().getTime(); //标记警告框
$(".alertModalBody").prepend('<div class="alert alert-dismissible ' + classes + ' ' + alertEle +'">\
<button type="button" class="close" data-dismiss="alert">×</button>\
<strong>'+ errorMsg + '</strong>\
</div>'
)
removeAlertMsg("." +alertEle,5000);
}
// var removeAlertMsg = function(ele,showTime){
// if(showTime > -1){
// setTimeout(function(){
// $(ele).remove();
// },showTime);
// }
// }
//
// var alertMsg = function (classes,errorMsg) {
// $(".alertModal").modal();
// var alertEle = new Date().getTime(); //标记警告框
// $(".alertModalBody").prepend('<div class="alert alert-dismissible ' + classes + ' ' + alertEle +'">\
// <button type="button" class="close" data-dismiss="alert">×</button>\
// <strong>'+ errorMsg + '</strong>\
// </div>'
// )
// removeAlertMsg("." +alertEle,5000);
// }

//设置ajax默认配置
$.ajaxSetup({
Expand Down
12 changes: 6 additions & 6 deletions src/main/webapp/src/consumer.js
Expand Up @@ -4,7 +4,7 @@

var module = app;

module.controller('consumerController', function ($scope, ngDialog, $http,Notification) {
module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) {
$scope.paginationConf = {
currentPage: 1,
totalItems: 0,
Expand Down Expand Up @@ -187,9 +187,9 @@ module.controller('consumerController', function ($scope, ngDialog, $http,Notifi
});
}

})
}])

module.controller('deleteConsumerDialogController', function ($scope, ngDialog, $http,Notification) {
module.controller('deleteConsumerDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) {
$scope.selectedClusterList = [];
$scope.selectedBrokerNameList = [];
$scope.delete = function () {
Expand All @@ -209,10 +209,10 @@ module.controller('deleteConsumerDialogController', function ($scope, ngDialog,
}
});
}
}
}]
);

module.controller('consumerModifyDialogController', function ($scope, ngDialog, $http,Notification) {
module.controller('consumerModifyDialogController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) {
$scope.postConsumerRequest = function (consumerRequest) {
var request = JSON.parse(JSON.stringify(consumerRequest));
console.log(request);
Expand All @@ -228,5 +228,5 @@ module.controller('consumerModifyDialogController', function ($scope, ngDialog,
}
});
}
}
}]
);
40 changes: 34 additions & 6 deletions src/main/webapp/src/controller.js
Expand Up @@ -2,10 +2,6 @@
* Created by tcrow on 2016/3/24 0024.
*/
app.controller('AppCtrl', ['$scope','$rootScope','$cookies','$location','$translate', function ($scope,$rootScope,$cookies,$location,$translate) {
$scope.gotoDemoPage = function(){
$location.path("/demo");
}

$scope.changeTranslate = function(langKey){
$translate.use(langKey);
}
Expand All @@ -16,6 +12,7 @@ app.controller('ClusterController', ['$scope','$location','$http','Notification'
$scope.clusterMap = {};//cluster:brokerNameList
$scope.brokerMap = {};//brokerName:{id:addr}
$scope.brokerDetail = {};//{brokerName,id:detail}
$scope.clusterNames = [];
$http({
method: "GET",
url: "/cluster/list.query"
Expand All @@ -24,13 +21,44 @@ app.controller('ClusterController', ['$scope','$location','$http','Notification'
$scope.clusterMap = resp.data.clusterInfo.clusterAddrTable;
$scope.brokerMap = resp.data.clusterInfo.brokerAddrTable;
$scope.brokerDetail = resp.data.brokerServer;
$.each($scope.clusterMap,function(clusterName,clusterBrokersNames){
$scope.clusterNames.push(clusterName);
})
var map = {};
$.each($scope.brokerDetail,function(k,v){
$.each($scope.clusterMap,function (ck, cv) {
if(angular.isUndefined(map[ck])){
map[ck] = [];
}
$.each(cv,function(cvi,cvv){
if(cvv == k){
var index = 0;
$.each(v,function(vi,vv){
vv.split = k;
vv.index = index;
vv.address = $scope.brokerMap[cvv].brokerAddrs[index];
vv.brokerName = $scope.brokerMap[cvv].brokerName;
map[ck].push(vv);
index++;
})
}
})
})
})
$scope.brokers = map;
$scope.selectedCluster = 'DefaultCluster'; //Default select DefaultCluster
$scope.switchCluster();
}else{
Notification.error({message: resp.errMsg, delay: 2000});
}
});

$scope.showDetail = function (brokerDetail,brokerName,index) {
$scope.detail = brokerDetail[brokerName][index];
$scope.switchCluster = function(){
$scope.instances = $scope.brokers[$scope.selectedCluster];
}

$scope.showDetail = function (brokerName,index) {
$scope.detail = $scope.brokerDetail[brokerName][index];
$scope.brokerName = brokerName;
$scope.index = index;
$(".brokerModal").modal();
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/src/message.js
Expand Up @@ -4,7 +4,7 @@

var module = app;

module.controller('messageController', function ($scope, ngDialog, $http,Notification) {
module.controller('messageController', ['$scope', 'ngDialog', '$http','Notification',function ($scope, ngDialog, $http,Notification) {
$scope.allTopicList = [];
$scope.selectedTopic =[];
$scope.key ="";
Expand Down Expand Up @@ -139,9 +139,9 @@ module.controller('messageController', function ($scope, ngDialog, $http,Notific
$scope.messageShowList = $scope.queryMessageByTopicResult.slice(from, to);
$scope.paginationConf.totalItems = totalItem ;
};
});
}]);

module.controller('messageDetailViewDialogController', function ($scope, ngDialog, $http,Notification) {
module.controller('messageDetailViewDialogController',['$scope', 'ngDialog', '$http','Notification', function ($scope, ngDialog, $http,Notification) {

$scope.resendMessage = function (msgId,consumerGroup) {
$http({
Expand All @@ -165,5 +165,5 @@ module.controller('messageDetailViewDialogController', function ($scope, ngDialo
$scope.showExceptionDesc = function (errmsg) {
alert(errmsg);
};
}
}]
);
4 changes: 2 additions & 2 deletions src/main/webapp/src/producer.js
Expand Up @@ -3,7 +3,7 @@
*/

var module = app;
module.controller('producerController', function ($scope, $http,Notification) {
module.controller('producerController', ['$scope', '$http','Notification',function ($scope, $http,Notification) {
$scope.selectedTopic=[];
$scope.producerGroup="";
$http({
Expand Down Expand Up @@ -33,4 +33,4 @@ module.controller('producerController', function ($scope, $http,Notification) {
}
});
}
} );
} ]);

0 comments on commit a900f60

Please sign in to comment.