You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by as...@apache.org on 2018/08/28 13:08:21 UTC

[incubator-servicecomb-service-center] branch master updated: [SCB-808]Aut-refresh the dashboard and service-list page every 10sec (#430)

This is an automated email from the ASF dual-hosted git repository.

asifdxtreme pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-service-center.git


The following commit(s) were added to refs/heads/master by this push:
     new 80ee70a  [SCB-808]Aut-refresh the dashboard and service-list page every 10sec (#430)
80ee70a is described below

commit 80ee70a8f01078c441e153915f1b07d0d382225d
Author: xiaoyimei <38...@users.noreply.github.com>
AuthorDate: Tue Aug 28 21:08:19 2018 +0800

    [SCB-808]Aut-refresh the dashboard and service-list page every 10sec (#430)
---
 .../scripts/modules/dashboard/controllers/dashboardCtrl.js   |  7 +++++++
 .../modules/serviceCenter/controllers/servicesListCtrl.js    | 12 ++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/frontend/app/scripts/modules/dashboard/controllers/dashboardCtrl.js b/frontend/app/scripts/modules/dashboard/controllers/dashboardCtrl.js
index ead2f05..ba2541f 100644
--- a/frontend/app/scripts/modules/dashboard/controllers/dashboardCtrl.js
+++ b/frontend/app/scripts/modules/dashboard/controllers/dashboardCtrl.js
@@ -163,4 +163,11 @@ angular.module('serviceCenter.dashboard', [])
 
         $scope.getAllServices();
 
+        var dashboardRefresh = $interval(function(){
+            $scope.getAllServices();
+        }, 10000);
+ 
+        $scope.$on('$destroy', function(){
+            $interval.cancel(dashboardRefresh);
+        })
     }]);
\ No newline at end of file
diff --git a/frontend/app/scripts/modules/serviceCenter/controllers/servicesListCtrl.js b/frontend/app/scripts/modules/serviceCenter/controllers/servicesListCtrl.js
index ab449c7..50e5f21 100644
--- a/frontend/app/scripts/modules/serviceCenter/controllers/servicesListCtrl.js
+++ b/frontend/app/scripts/modules/serviceCenter/controllers/servicesListCtrl.js
@@ -16,8 +16,8 @@
  */
 'use strict';
 angular.module('serviceCenter.sc', [])
-    .controller('servicesListController', ['$scope', 'httpService', 'apiConstant', 'commonService', '$stateParams', '$mdDialog',
-        function($scope, httpService, apiConstant, commonService, $stateParams, $mdDialog) {
+    .controller('servicesListController', ['$scope', 'httpService', 'apiConstant', 'commonService', '$stateParams', '$mdDialog', '$interval',
+        function($scope, httpService, apiConstant, commonService, $stateParams, $mdDialog, $interval) {
 
             $scope.appList = 'fetching';
             $scope.serviceList = 'serviceList';
@@ -153,6 +153,14 @@ angular.module('serviceCenter.sc', [])
             };
             $scope.getAllServices();
 
+            var serviceRefresh = $interval(function(){
+                $scope.getAllServices();
+            }, 10000);
+     
+            $scope.$on('$destroy', function(){
+                $interval.cancel(serviceRefresh);
+            })
+
             function processService(service) {
                 var instanceApi = apiConstant.api.instances.url;
                 var instanceUrl = instanceApi.replace("{{serviceId}}", service.serviceId);