From 3b05c7ee5763011d555574aa7c80aa12157cb423 Mon Sep 17 00:00:00 2001 From: walking98 Date: Thu, 9 May 2019 14:14:18 +0800 Subject: [PATCH] ISSUE #260, #261: AutoRefresh + i18n processing --- src/main/resources/application.properties | 2 +- src/main/resources/static/src/consumer.js | 8 +++++ src/main/resources/static/src/i18n/en.js | 1 + src/main/resources/static/src/i18n/zh.js | 1 + src/main/resources/static/src/topic.js | 36 ++++++++++++------- .../resources/static/view/pages/topic.html | 6 ++-- 6 files changed, 38 insertions(+), 16 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c34688e..d75f709 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -14,7 +14,7 @@ spring.http.encoding.enabled=true spring.http.encoding.force=true logging.config=classpath:logback.xml #if this value is empty,use env value rocketmq.config.namesrvAddr NAMESRV_ADDR | now, you can set it in ops page.default localhost:9876 -rocketmq.config.namesrvAddr= +rocketmq.config.namesrvAddr=11.239.187.178:9876 #if you use rocketmq version < 3.5.8, rocketmq.config.isVIPChannel should be false.default true rocketmq.config.isVIPChannel= #rocketmq-console's data path:dashboard/monitor diff --git a/src/main/resources/static/src/consumer.js b/src/main/resources/static/src/consumer.js index cd093d4..4743115 100644 --- a/src/main/resources/static/src/consumer.js +++ b/src/main/resources/static/src/consumer.js @@ -165,6 +165,10 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica if(resp.status ==0){ console.log(resp); ngDialog.open({ + preCloseCallback: function(value) { + // Refresh topic list + $scope.refreshConsumerData(); + }, template: 'consumerModifyDialog', controller: 'consumerModifyDialogController', data:{ @@ -244,6 +248,10 @@ module.controller('consumerController', ['$scope', 'ngDialog', '$http','Notifica console.log(resp); ngDialog.open({ + preCloseCallback: function(value) { + // Refresh topic list + $scope.refreshConsumerData(); + }, template: 'deleteConsumerDialog', controller: 'deleteConsumerDialogController', data:{ diff --git a/src/main/resources/static/src/i18n/en.js b/src/main/resources/static/src/i18n/en.js index 41917c3..c022984 100644 --- a/src/main/resources/static/src/i18n/en.js +++ b/src/main/resources/static/src/i18n/en.js @@ -82,5 +82,6 @@ var en = { "LOGIN":"Login", "USER_NAME":"Username", "PASSWORD":"Password", + "NO_DATA":"Don't have ", "WELCOME":"Hi, welcome using RocketMQ Console" } \ No newline at end of file diff --git a/src/main/resources/static/src/i18n/zh.js b/src/main/resources/static/src/i18n/zh.js index 550d849..48e2a97 100644 --- a/src/main/resources/static/src/i18n/zh.js +++ b/src/main/resources/static/src/i18n/zh.js @@ -82,5 +82,6 @@ var zh = { "LOGIN":"登录", "USER_NAME":"用户名", "PASSWORD":"密码", + "NO_DATA":"不存在 ", "WELCOME":"您好,欢迎使用RocketMQ控制台" } \ No newline at end of file diff --git a/src/main/resources/static/src/topic.js b/src/main/resources/static/src/topic.js index 047fbe2..4543018 100644 --- a/src/main/resources/static/src/topic.js +++ b/src/main/resources/static/src/topic.js @@ -35,21 +35,26 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio $scope.filterDLQ = false $scope.allTopicList = []; $scope.topicShowList = []; - $http({ - method: "GET", - url: "topic/list.query" - }).success(function (resp) { - if(resp.status ==0){ - $scope.allTopicList = resp.data.topicList.sort(); - console.log($scope.allTopicList); - console.log(JSON.stringify(resp)); - $scope.showTopicList(1,$scope.allTopicList.length); - }else { - Notification.error({message: resp.errMsg, delay: 5000}); - } + $scope.refreshTopicList = function () { + $http({ + method: "GET", + url: "topic/list.query" + }).success(function (resp) { + if(resp.status ==0){ + $scope.allTopicList = resp.data.topicList.sort(); + console.log($scope.allTopicList); + console.log(JSON.stringify(resp)); + $scope.showTopicList(1,$scope.allTopicList.length); + + }else { + Notification.error({message: resp.errMsg, delay: 5000}); + } + }); + }; + + $scope.refreshTopicList(); - }); $scope.filterStr=""; $scope.$watch('filterStr', function() { $scope.filterList(1); @@ -127,6 +132,7 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio }).success(function (resp) { if(resp.status ==0){ Notification.info({message: "delete success!", delay: 2000}); + $scope.refreshTopicList(); }else { Notification.error({message: resp.errMsg, delay: 2000}); } @@ -287,6 +293,10 @@ module.controller('topicController', ['$scope', 'ngDialog', '$http','Notificatio if(resp.status ==0){ console.log(resp); ngDialog.open({ + preCloseCallback: function(value) { + // Refresh topic list + $scope.refreshTopicList(); + }, template: 'topicModifyDialog', controller: 'topicModifyDialogController', data:{ diff --git a/src/main/resources/static/view/pages/topic.html b/src/main/resources/static/view/pages/topic.html index 77afa72..8418a9e 100644 --- a/src/main/resources/static/view/pages/topic.html +++ b/src/main/resources/static/view/pages/topic.html @@ -31,7 +31,9 @@ - +
@@ -221,7 +223,7 @@