Repository: eagle Updated Branches: refs/heads/master 01553a346 -> e8d572dc1
[EAGLE-1002] fix chart component not handle event when force refresh chart lib refresh will generate new chart object which will miss chart event handle. Author: zombieJ <[email protected]> Closes #912 from zombieJ/EAGLE-1002. Project: http://git-wip-us.apache.org/repos/asf/eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/e8d572dc Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/e8d572dc Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/e8d572dc Branch: refs/heads/master Commit: e8d572dc1630e024a270fce1e04a52b885d935a9 Parents: 01553a3 Author: zombieJ <[email protected]> Authored: Fri Apr 14 05:24:43 2017 +0000 Committer: r7raul1984 <[email protected]> Committed: Fri Apr 14 05:24:43 2017 +0000 ---------------------------------------------------------------------- .../webapp/app/apps/jpm/ctrl/statisticCtrl.js | 9 ++++- .../app/dev/public/js/components/chart.js | 42 +++++++++++--------- 2 files changed, 30 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/eagle/blob/e8d572dc/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/statisticCtrl.js ---------------------------------------------------------------------- diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/statisticCtrl.js b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/statisticCtrl.js index e74a22c..10b6c5c 100644 --- a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/statisticCtrl.js +++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/statisticCtrl.js @@ -303,7 +303,7 @@ $scope.topUserJobCountTrendSeries = []; JPM.aggMetricsToEntities( JPM.groups("JobExecutionService", {site: $scope.site, currentState: $scope.distributionSelectedType}, ["user"], "count desc", intervalMin, startTime, endTime, 10, 1000000) - )._promise.then(function (list) { + , [0])._promise.then(function (list) { $scope.topUserJobCountTrendSeries = $.map(list, function (subList) { return JPM.metricsToSeries(subList[0].tags.user, subList, { stack: "user", @@ -321,7 +321,7 @@ $scope.topTypeJobCountTrendSeries = []; JPM.aggMetricsToEntities( JPM.groups("JobExecutionService", {site: $scope.site, currentState: $scope.distributionSelectedType}, ["jobType"], "count desc", intervalMin, startTime, endTime, 10, 1000000) - )._promise.then(function (list) { + , [0])._promise.then(function (list) { $scope.topTypeJobCountTrendSeries = $.map(list, function (subList) { return JPM.metricsToSeries(subList[0].tags.jobType, subList, { stack: "type", @@ -377,6 +377,11 @@ }); } + // UI refresh + setTimeout(function () { + $(window).resize(); + }, 100); + return true; }; http://git-wip-us.apache.org/repos/asf/eagle/blob/e8d572dc/eagle-server/src/main/webapp/app/dev/public/js/components/chart.js ---------------------------------------------------------------------- diff --git a/eagle-server/src/main/webapp/app/dev/public/js/components/chart.js b/eagle-server/src/main/webapp/app/dev/public/js/components/chart.js index 63855b6..0093ce5 100644 --- a/eagle-server/src/main/webapp/app/dev/public/js/components/chart.js +++ b/eagle-server/src/main/webapp/app/dev/public/js/components/chart.js @@ -87,6 +87,8 @@ wrapChart(); }; + + refreshEventHandler(); } function refreshChart() { @@ -170,29 +172,31 @@ // Event handle var chartClick = false; - chart.on("click", function (e) { - if($scope.click) { - if($scope.click(e)) { - refreshChart(); + function refreshEventHandler() { + chart.on("click", function (e) { + if($scope.click) { + if($scope.click(e)) { + refreshChart(); + } } - } - chartClick = true; - }); + chartClick = true; + }); - chart.getZr().on('click', function () { - if(!chartClick && $scope.click) { - if($scope.click($.extend({ - componentType: "tooltip" - }, lastTooltipEvent))) { - refreshChart(); + chart.getZr().on('click', function () { + if(!chartClick && $scope.click) { + if($scope.click($.extend({ + componentType: "tooltip" + }, lastTooltipEvent))) { + refreshChart(); + } } - } - chartClick = false; - }); + chartClick = false; + }); - chart.on('showtip', function (e) { - lastTooltipEvent = e; - }); + chart.on('showtip', function (e) { + lastTooltipEvent = e; + }); + } // Insert chart object to parent scope if($attrs.chart) {
