From 39f7443dfa9e25d0e81c94a7d75b50d0644cc531 Mon Sep 17 00:00:00 2001 From: denz Date: Wed, 19 Oct 2016 17:43:08 +0900 Subject: [PATCH 1/2] bug fix. - wrong select2 init. - remove ng-model --- .../serverMap/server-map.directive.js | 30 +++++++++---------- .../webapp/features/serverMap/serverMap.html | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/web/src/main/webapp/features/serverMap/server-map.directive.js b/web/src/main/webapp/features/serverMap/server-map.directive.js index f9caa63ba5e4..0b487b16704b 100644 --- a/web/src/main/webapp/features/serverMap/server-map.directive.js +++ b/web/src/main/webapp/features/serverMap/server-map.directive.js @@ -51,7 +51,7 @@ // define private variables var bUseNodeContextMenu, bUseLinkContextMenu, htLastQuery, bUseBackgroundContextMenu, oServerMap, oAlertService, oProgressBarService, htLastMapData, htLastLink, htLastNode, - sLastSelection, $fromAgentName, $toAgentName, bIsFilterWizardLoaded, htLastMergedMapData, $serverMapTime; + sLastSelection, $fromAgentName, $toAgentName, bIsFilterWizardLoaded, htLastMergedMapData, $serverMapTime, $urlPattern; // define private variables of methods var showServerMap, setNodeContextMenuPosition, reset, emitDataExisting, @@ -92,6 +92,7 @@ $toAgentName = element.find('.toAgentName'); $fromAgentName.select2(); $toAgentName.select2(); + $urlPattern = element.find("#urlPattern"); bIsFilterWizardLoaded = false; scope.mergeTypeList = []; scope.mergeStatus = {}; @@ -118,7 +119,7 @@ scope.nodeContextMenuStyle = ''; scope.linkContextMenuStyle = ''; scope.backgroundContextMenuStyle = ''; - scope.urlPattern = ''; + $urlPattern.val(""); scope.responseTime = { from: 0, to: 30000 @@ -503,27 +504,24 @@ oSidebarTitleVoService .setImageType2(htLastLink.toNode.serviceType) .setTitle2(htLastLink.toNode.applicationName); - - scope.fromAgent = htLastLink.fromAgent || []; + + scope.fromAgent = htLastLink.fromAgent || []; scope.toAgent = htLastLink.toAgent || []; scope.sourceInfo = htLastLink.sourceInfo; scope.targetInfo = htLastLink.targetInfo; scope.fromApplicationName = htLastLink.fromNode.applicationName; scope.toApplicationName = htLastLink.toNode.applicationName; - $fromAgentName.select2('val', ''); - $toAgentName.select2('val', ''); - scope.fromAgentName = ''; - scope.toAgentName = ''; - + scope.$broadcast('sidebarTitleDirective.initialize.forServerMap', oSidebarTitleVoService, htLastLink); - + $('#filterWizard').modal('show'); if (!bIsFilterWizardLoaded) { bIsFilterWizardLoaded = true; $('#filterWizard') .on('shown.bs.modal', function () { - // scope.$broadcast('loadChartDirective.initAndSimpleRenderWithData.forFilterWizard', htLastLink.timeSeriesHistogram, '100%', '150px'); - $('slider', this).addClass('auto'); + $fromAgentName.select2().val("").trigger("change"); + $toAgentName.select2().val("").trigger("change"); + $('slider', this).addClass('auto'); setTimeout(function () { $('#filterWizard slider').removeClass('auto'); }, 500); @@ -535,13 +533,13 @@ htLastLink.toNode.serviceType, scope.oNavbarVoService); if (result) { - scope.urlPattern = result.oServerMapFilterVoService.getRequestUrlPattern(); + $urlPattern.val(result.oServerMapFilterVoService.getRequestUrlPattern()); scope.responseTime.from = result.oServerMapFilterVoService.getResponseFrom(); var to = result.oServerMapFilterVoService.getResponseTo(); scope.responseTime.to = to === 'max' ? 30000 : to; scope.includeFailed = result.oServerMapFilterVoService.getIncludeException(); - $fromAgentName.select2('val', result.oServerMapFilterVoService.getFromAgentName()); - $toAgentName.select2('val', result.oServerMapFilterVoService.getToAgentName()); + $fromAgentName.select2().val(result.oServerMapFilterVoService.getFromAgentName()).trigger("change"); + $toAgentName.select2().val(result.oServerMapFilterVoService.getToAgentName()).trigger("change"); } else { scope.responseTime = { from: 0, @@ -655,7 +653,7 @@ .setResponseFrom(scope.responseTime.from) .setResponseTo(scope.responseTime.to) .setIncludeException(scope.includeFailed) - .setRequestUrlPattern($base64.encode(scope.urlPattern)); + .setRequestUrlPattern($base64.encode($urlPattern.val())); if (scope.fromAgentName) { oServerMapFilterVoService.setFromAgentName(scope.fromAgentName); diff --git a/web/src/main/webapp/features/serverMap/serverMap.html b/web/src/main/webapp/features/serverMap/serverMap.html index 8e53b33b07f4..25f7cb62d7c9 100644 --- a/web/src/main/webapp/features/serverMap/serverMap.html +++ b/web/src/main/webapp/features/serverMap/serverMap.html @@ -119,7 +119,7 @@
- +
ant-style From bfc58858777a699f26293224fde3e0666582187a Mon Sep 17 00:00:00 2001 From: denz Date: Thu, 20 Oct 2016 11:45:05 +0900 Subject: [PATCH 2/2] remove wrong angular timer --- .../active-trace-chart.directive.js | 63 +++++++-------- .../agentInfo/agent-info.directive.js | 6 +- .../cpuLoadChart/cpu-load-chart.directive.js | 72 +++++++----------- .../jvm-memory-chart.directive.js | 76 +++++++------------ .../features/tpsChart/tps-chart.directive.js | 72 +++++++----------- 5 files changed, 110 insertions(+), 179 deletions(-) diff --git a/web/src/main/webapp/features/activeTraceChart/active-trace-chart.directive.js b/web/src/main/webapp/features/activeTraceChart/active-trace-chart.directive.js index 9c215a8deb32..6f17e485bcc7 100644 --- a/web/src/main/webapp/features/activeTraceChart/active-trace-chart.directive.js +++ b/web/src/main/webapp/features/activeTraceChart/active-trace-chart.directive.js @@ -12,34 +12,28 @@ link: function postLink(scope, element, attrs) { // define variables - var sId, oChart; + var sId = "", oChart; - // define variables of methods - var setIdAutomatically, setWidthHeight, render, showCursorAt, resize; - - /** - * set id automatically - */ - setIdAutomatically = function () { + function setIdAutomatically() { sId = 'multipleValueAxesId-' + scope.namespace; element.attr('id', sId); - }; + } + + function hasId() { + return sId === "" ? false : true; + } - /** - * set width height - * @param w - * @param h - */ - setWidthHeight = function (w, h) { + function setWidthHeight(w, h) { if (w) element.css('width', w); if (h) element.css('height', h); - }; + } + + function renderUpdate(data) { + oChart.dataProvider = data; + oChart.validateData(); + } - /** - * render - * @param chartData - */ - render = function (chartData) { + function render(chartData) { var options = { "type": "serial", "theme": "light", @@ -131,13 +125,9 @@ scope.$emit( "activeTraceChartDirective.cursorChanged." + scope.namespace, event); }); }); - }; + } - /** - * show cursor at - * @param category - */ - showCursorAt = function (category) { + function showCursorAt(category) { if (category) { if (angular.isNumber(category)) { category = oChart.dataProvider[category].time; @@ -146,22 +136,23 @@ } else { oChart.chartCursor.hideCursor(); } - }; + } - /** - * resize - */ - resize = function () { + function resize() { if (oChart) { oChart.validateNow(); oChart.validateSize(); } - }; + } scope.$on( "activeTraceChartDirective.initAndRenderWithData." + scope.namespace, function (event, data, w, h) { - setIdAutomatically(); - setWidthHeight(w, h); - render( data ); + if ( hasId() ) { + renderUpdate( data ); + } else { + setIdAutomatically(); + setWidthHeight(w, h); + render(data); + } }); scope.$on( "activeTraceChartDirective.showCursorAt." + scope.namespace, function (event, category) { diff --git a/web/src/main/webapp/features/agentInfo/agent-info.directive.js b/web/src/main/webapp/features/agentInfo/agent-info.directive.js index d6eb3c9f5fd8..370271fa1a4e 100644 --- a/web/src/main/webapp/features/agentInfo/agent-info.directive.js +++ b/web/src/main/webapp/features/agentInfo/agent-info.directive.js @@ -75,10 +75,8 @@ } oProgressBarService.setLoading(80); showCharts(result); - $timeout(function () { - oProgressBarService.setLoading(100); - oProgressBarService.stopLoading(); - }, 700); + oProgressBarService.setLoading(100); + oProgressBarService.stopLoading(); callback(); }); } diff --git a/web/src/main/webapp/features/cpuLoadChart/cpu-load-chart.directive.js b/web/src/main/webapp/features/cpuLoadChart/cpu-load-chart.directive.js index b1909619304f..12ecf7cb3fe2 100644 --- a/web/src/main/webapp/features/cpuLoadChart/cpu-load-chart.directive.js +++ b/web/src/main/webapp/features/cpuLoadChart/cpu-load-chart.directive.js @@ -19,34 +19,28 @@ link: function postLink(scope, element, attrs) { // define variables - var sId, oChart; + var sId = "", oChart; - // define variables of methods - var setIdAutomatically, setWidthHeight, render, showCursorAt, resize; - - /** - * set id automatically - */ - setIdAutomatically = function () { + function setIdAutomatically() { sId = 'multipleValueAxesId-' + scope.namespace; element.attr('id', sId); - }; + } + + function hasId() { + return sId === "" ? false : true; + } - /** - * set width height - * @param w - * @param h - */ - setWidthHeight = function (w, h) { + function setWidthHeight(w, h) { if (w) element.css('width', w); if (h) element.css('height', h); - }; + } + + function renderUpdate(data) { + oChart.dataProvider = data; + oChart.validateData(); + } - /** - * render - * @param chartData - */ - render = function (chartData) { + function render(chartData) { var options = { "type": "serial", "theme": "light", @@ -129,13 +123,9 @@ scope.$emit('cpuLoadChartDirective.cursorChanged.' + scope.namespace, event); }); }); - }; + } - /** - * show cursor at - * @param category - */ - showCursorAt = function (category) { + function showCursorAt(category) { if (category) { if (angular.isNumber(category)) { category = oChart.dataProvider[category].time; @@ -144,37 +134,29 @@ } else { oChart.chartCursor.hideCursor(); } - }; + } - /** - * resize - */ - resize = function () { + function resize() { if (oChart) { oChart.validateNow(); oChart.validateSize(); } - }; + } - /** - * scope event on cpuLoadChartDirective.initAndRenderWithData.namespace - */ scope.$on('cpuLoadChartDirective.initAndRenderWithData.' + scope.namespace, function (event, data, w, h) { - setIdAutomatically(); - setWidthHeight(w, h); - render(data); + if ( hasId() ) { + renderUpdate( data ); + } else { + setIdAutomatically(); + setWidthHeight(w, h); + render(data); + } }); - /** - * scope event on cpuLoadChartDirective.showCursorAt.namespace - */ scope.$on('cpuLoadChartDirective.showCursorAt.' + scope.namespace, function (event, category) { showCursorAt(category); }); - /** - * scope event on cpuLoadChartDirective.resize.namespace - */ scope.$on('cpuLoadChartDirective.resize.' + scope.namespace, function (event) { resize(); }); diff --git a/web/src/main/webapp/features/jvmMemoryChart/jvm-memory-chart.directive.js b/web/src/main/webapp/features/jvmMemoryChart/jvm-memory-chart.directive.js index bdee21664e14..389ec38314c4 100644 --- a/web/src/main/webapp/features/jvmMemoryChart/jvm-memory-chart.directive.js +++ b/web/src/main/webapp/features/jvmMemoryChart/jvm-memory-chart.directive.js @@ -17,36 +17,29 @@ namespace: '@' // string value }, link: function postLink(scope, element, attrs) { + console.log( "------init" ); - // define variables - var sId, oChart; + var sId = "", oChart; - // define variables of methods - var setIdAutomatically, setWidthHeight, render, showCursorAt, resize; - - /** - * set id automatically - */ - setIdAutomatically = function () { + function setIdAutomatically() { sId = 'multipleValueAxesId-' + scope.namespace; element.attr('id', sId); - }; + } + function hasId() { + return sId === "" ? false : true; + } - /** - * set width height - * @param w - * @param h - */ - setWidthHeight = function (w, h) { + function setWidthHeight(w, h) { if (w) element.css('width', w); if (h) element.css('height', h); - }; + } + + function renderUpdate(data) { + oChart.dataProvider = data; + oChart.validateData(); + } - /** - * render - * @param chartData - */ - render = function (chartData) { + function render(chartData) { var options = { "type": "serial", "theme": "light", @@ -145,13 +138,9 @@ scope.$emit('jvmMemoryChartDirective.cursorChanged.' + scope.namespace, event); }); }); - }; + } - /** - * show cursor at - * @param category - */ - showCursorAt = function (category) { + function showCursorAt(category) { if (category) { if (angular.isNumber(category)) { category = oChart.dataProvider[category].time; @@ -160,37 +149,26 @@ } else { oChart.chartCursor.hideCursor(); } - }; + } - /** - * resize - */ - resize = function () { + function resize() { if (oChart) { oChart.validateNow(); oChart.validateSize(); } - }; - - /** - * scope event on jvmMemoryChartDirective.initAndRenderWithData.namespace - */ + } scope.$on('jvmMemoryChartDirective.initAndRenderWithData.' + scope.namespace, function (event, data, w, h) { - setIdAutomatically(); - setWidthHeight(w, h); - render(data); + if ( hasId() ) { + renderUpdate( data ); + } else { + setIdAutomatically(); + setWidthHeight(w, h); + render(data); + } }); - - /** - * scope event on jvmMemoryChartDirective.showCursorAt.namespace - */ scope.$on('jvmMemoryChartDirective.showCursorAt.' + scope.namespace, function (event, category) { showCursorAt(category); }); - - /** - * scope event on jvmMemoryChartDirective.resize.namespace - */ scope.$on('jvmMemoryChartDirective.resize.' + scope.namespace, function (event) { resize(); }); diff --git a/web/src/main/webapp/features/tpsChart/tps-chart.directive.js b/web/src/main/webapp/features/tpsChart/tps-chart.directive.js index 052966d2bf98..b9beb09e0974 100644 --- a/web/src/main/webapp/features/tpsChart/tps-chart.directive.js +++ b/web/src/main/webapp/features/tpsChart/tps-chart.directive.js @@ -19,34 +19,28 @@ link: function postLink(scope, element, attrs) { // define variables - var sId, oChart; + var sId = "", oChart; - // define variables of methods - var setIdAutomatically, setWidthHeight, render, showCursorAt, resize; - - /** - * set id automatically - */ - setIdAutomatically = function () { + function setIdAutomatically() { sId = 'multipleValueAxesId-' + scope.namespace; element.attr('id', sId); - }; + } + + function hasId() { + return sId === "" ? false : true; + } - /** - * set width height - * @param w - * @param h - */ - setWidthHeight = function (w, h) { + function setWidthHeight(w, h) { if (w) element.css('width', w); if (h) element.css('height', h); - }; + } + + function renderUpdate(data) { + oChart.dataProvider = data; + oChart.validateData(); + } - /** - * render - * @param chartData - */ - render = function (chartData) { + function render(chartData) { var options = { "type": "serial", "theme": "light", @@ -143,13 +137,9 @@ scope.$emit('tpsChartDirective.cursorChanged.' + scope.namespace, event); }); }); - }; + } - /** - * show cursor at - * @param category - */ - showCursorAt = function (category) { + function showCursorAt(category) { if (category) { if (angular.isNumber(category)) { category = oChart.dataProvider[category].time; @@ -158,37 +148,29 @@ } else { oChart.chartCursor.hideCursor(); } - }; + } - /** - * resize - */ - resize = function () { + function resize() { if (oChart) { oChart.validateNow(); oChart.validateSize(); } - }; + } - /** - * scope event on tpsChartDirective.initAndRenderWithData.namespace - */ scope.$on('tpsChartDirective.initAndRenderWithData.' + scope.namespace, function (event, data, w, h) { - setIdAutomatically(); - setWidthHeight(w, h); - render(data); + if ( hasId() ) { + renderUpdate( data ); + } else { + setIdAutomatically(); + setWidthHeight(w, h); + render(data); + } }); - /** - * scope event on tpsChartDirective.showCursorAt.namespace - */ scope.$on('tpsChartDirective.showCursorAt.' + scope.namespace, function (event, category) { showCursorAt(category); }); - /** - * scope event on tpsChartDirective.resize.namespace - */ scope.$on('tpsChartDirective.resize.' + scope.namespace, function (event) { resize(); });