Skip to content

Commit

Permalink
[#3667] bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
denzelsN committed Jan 2, 2018
1 parent 2fd9d04 commit bb6dd7f
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 196 deletions.
117 changes: 57 additions & 60 deletions web/src/main/webapp/common/services/alarm-util.service.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,67 @@
(function($) {
'use strict';

/**
* (en) Alarm 설정의 공통된 리스트 구현 코드를 공유함.
* @ko Alarm 설정의 공통된 리스트 구현 코드를 공유함.
* @group Service
* @name AlarmUtilService
* @class
*/

pinpointApp.constant('AlarmUtilServiceConfig', {
"hideClass": "hide-me"
});

pinpointApp.service( "AlarmUtilService", [ "AlarmUtilServiceConfig", "$timeout", "AlarmAjaxService", "SystemConfigurationService", function ( $config, $timeout, $ajaxService, SystemConfigService ) {
var self = this;
this.show = function( $el ) {
$el.removeClass( $config.hideClass );
};
this.hide = function() {
for( var i = 0 ; i < arguments.length ; i++ ) {
arguments[i].addClass( $config.hideClass );
}
};
this.sendCRUD = function( funcName, data, successCallback, failCallback ) {
if ( ( angular.isUndefined( data ) || data === "" ) ) {
data = {
"userId" : ( SystemConfigService.get("userId") || "" )
};
}
pinpointApp.service( "AlarmUtilService", [ "AlarmUtilServiceConfig", "$timeout", "AlarmAjaxService", "SystemConfigurationService",
function ( $config, $timeout, $ajaxService, SystemConfigService ) {
var self = this;
this.show = function( $el ) {
$el.removeClass( $config.hideClass );
};
this.hide = function() {
for( var i = 0 ; i < arguments.length ; i++ ) {
arguments[i].addClass( $config.hideClass );
}
};
this.sendCRUD = function( funcName, data, successCallback, failCallback ) {
if ( ( angular.isUndefined( data ) || data === "" ) ) {
SystemConfigService.getConfig().then(function(config) {
data = {
"userId" : ( config["userId"] || "" )
};
});
}

$timeout(function() {
$ajaxService[funcName](data, function (resultData) {
if (resultData.errorCode || resultData.status) {
failCallback(resultData);
} else {
successCallback(resultData);
}
$timeout(function() {
$ajaxService[funcName](data, function (resultData) {
if (resultData.errorCode || resultData.status) {
failCallback(resultData);
} else {
successCallback(resultData);
}
});
});
});
};
this.setTotal = function( $elTotal, n ) {
$elTotal.html( "(" + n + ")");
};
this.hasDuplicateItem = function( list, func ) {
var len = list.length;
var has = false;
for( var i = 0 ; i < len ; i++ ) {
if ( func( list[i] ) ) {
has = true;
break;
};
this.setTotal = function( $elTotal, n ) {
$elTotal.html( "(" + n + ")");
};
this.hasDuplicateItem = function( list, func ) {
var len = list.length;
var has = false;
for( var i = 0 ; i < len ; i++ ) {
if ( func( list[i] ) ) {
has = true;
break;
}
}
}
return has;
};
this.closeAlert = function( $elAlert, $elLoading ) {
$elAlert.animate({
height: 50,
}, 100, function() {
self.hide( $elAlert, $elLoading );
});
};
this.extractID = function( $el ) {
return $el.prop("id").split("_")[1];
};
this.getNode = function( $event, tagName ) {
return $( $event.toElement || $event.target ).parents( tagName );
};
}]);
return has;
};
this.closeAlert = function( $elAlert, $elLoading ) {
$elAlert.animate({
height: 50
}, 100, function() {
self.hide( $elAlert, $elLoading );
});
};
this.extractID = function( $el ) {
return $el.prop("id").split("_")[1];
};
this.getNode = function( $event, tagName ) {
return $( $event.toElement || $event.target ).parents( tagName );
};
}
]);
})(jQuery);
17 changes: 11 additions & 6 deletions web/src/main/webapp/common/services/analytics.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@

this.send = function( category, name, label, count, options ) {
if ( typeof ga !== "undefined" ) {
if (SystemConfigService.get("sendUsage") !== true) return;
if (arguments.length == 1) {
ga("send", "pageview", arguments[0]);
} else {
ga("send", "event", category, name, label, count, options);
}
SystemConfigService.getConfig().then(function(config) {
console.log( "analytics - sendUsage : ", config["sendUsage"] );
if ( config["sendUsage"] !== true ) {
return;
}
if (arguments.length == 1) {
ga("send", "pageview", arguments[0]);
} else {
ga("send", "event", category, name, label, count, options);
}
});
}
};
this.sendMain = function( name, label, count, options ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
});

pinpointApp.service( "SystemConfigurationService", [ "SystemConfigurationServiceConfig", "$http", function( cfg, $http ) {
var oConfig = {};
this.getConfig = function() {
return $http.get( cfg.URL ).then(function(result) {
if ( result.data.showApplicationStat !== true ) {
result.data.showApplicationStat = false;
}
return oConfig = result.data;
return result.data;
});
};
this.get = function( type ) {
return oConfig[type];
};
}]);
})( jQuery );
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
ID: "AGENT_INFO_DRTV_"
});

pinpointApp.directive( "agentInfoDirective", [ "agentInfoDirectiveConfig", "$sce", "$timeout", "SystemConfigurationService", "CommonUtilService", "UrlVoService", "AlertsService", "ProgressBarService", "AgentDaoService", "ResponseTimeChartDaoService", "ActiveThreadChartDaoService", "TPSChartDaoService", "CPULoadChartDaoService", "MemoryChartDaoService", "AgentAjaxService", "TooltipService", "AnalyticsService", "helpContentService",
function ( cfg, $sce, $timeout, SystemConfigService, CommonUtilService, UrlVoService, AlertsService, ProgressBarService, AgentDaoService, ResponseTimeChartDaoService, ActiveThreadChartDaoService, TPSChartDaoService, CPULoadChartDaoService, MemoryChartDaoService, AgentAjaxService, TooltipService, AnalyticsService, helpContentService ) {
pinpointApp.directive( "agentInfoDirective", [ "agentInfoDirectiveConfig", "$sce", "$timeout", "CommonUtilService", "UrlVoService", "AlertsService", "ProgressBarService", "AgentDaoService", "ResponseTimeChartDaoService", "ActiveThreadChartDaoService", "TPSChartDaoService", "CPULoadChartDaoService", "MemoryChartDaoService", "AgentAjaxService", "TooltipService", "AnalyticsService", "helpContentService",
function ( cfg, $sce, $timeout, CommonUtilService, UrlVoService, AlertsService, ProgressBarService, AgentDaoService, ResponseTimeChartDaoService, ActiveThreadChartDaoService, TPSChartDaoService, CPULoadChartDaoService, MemoryChartDaoService, AgentAjaxService, TooltipService, AnalyticsService, helpContentService ) {
return {
restrict: 'EA',
replace: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
}
}
});
pinpointApp.directive( "agentListDirective", [ "agentListDirectiveConfig", "SystemConfigurationService", "CommonUtilService", "UrlVoService", "AgentAjaxService", "PreferenceService", "TooltipService", "AnalyticsService",
function ( cfg, SystemConfigService, CommonUtilService, UrlVoService, AgentAjaxService, PreferenceService, TooltipService, AnalyticsService ) {
pinpointApp.directive( "agentListDirective", [ "agentListDirectiveConfig", "CommonUtilService", "UrlVoService", "AgentAjaxService", "PreferenceService", "TooltipService", "AnalyticsService",
function ( cfg, CommonUtilService, UrlVoService, AgentAjaxService, PreferenceService, TooltipService, AnalyticsService ) {
return {
restrict: 'EA',
replace: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
ID: "APPLICATION_STATISTIC_DRTV_"
});

pinpointApp.directive( "applicationStatisticDirective", [ "applicationStatisticDirectiveConfig", "$sce", "$http", "$timeout", "SystemConfigurationService", "CommonUtilService", "UrlVoService", "AlertsService", "ProgressBarService", "AgentDaoService", "AgentAjaxService", "TooltipService", "AnalyticsService", "helpContentService",
function ( cfg, $sce, $http, $timeout, SystemConfigService, CommonUtilService, UrlVoService, AlertsService, ProgressBarService, AgentDaoService, AgentAjaxService, TooltipService, AnalyticsService, helpContentService ) {
pinpointApp.directive( "applicationStatisticDirective", [ "applicationStatisticDirectiveConfig", "$sce", "$http", "$timeout", "CommonUtilService", "UrlVoService", "AlertsService", "ProgressBarService", "AgentDaoService", "AgentAjaxService", "TooltipService", "AnalyticsService", "helpContentService",
function ( cfg, $sce, $http, $timeout, CommonUtilService, UrlVoService, AlertsService, ProgressBarService, AgentDaoService, AgentAjaxService, TooltipService, AnalyticsService, helpContentService ) {
return {
restrict: 'EA',
replace: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
(function($) {
'use strict';
/**
* (en)alarmPinpointUserDirective
* @ko alarmPinpointUserDirective
* @group Directive
* @name alarmPinpointUserDirective
* @class
*/

pinpointApp.directive( "pinpointUserDirective", [ "helpContentTemplate", "helpContentService", "AlarmUtilService", "AnalyticsService", "SystemConfigurationService",
function ( helpContentTemplate, helpContentService, AlarmUtilService, AnalyticsService, SystemConfigService) {
Expand All @@ -18,6 +11,9 @@
link: function (scope, element) {

scope.prefix = "pinpointUser_";
SystemConfigService.getConfig().then(function(config) {
scope.canEditUserInfo = config["editUserInfo"];
});
var $element = $(element);
var $elWrapper = $element.find(".wrapper");
var $elTotal = $element.find(".total");
Expand All @@ -34,9 +30,6 @@
var oGroupMemberList = [];
scope.pinpointUserList = [];

scope.getCreateAllow = function() {
return SystemConfigService.get("editUserInfo");
};
function cancelPreviousWork() {
AddPinpointUser.cancelAction( aEditNode, hideEditArea );
RemovePinpointUser.cancelAction( AlarmUtilService, $workingNode );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
<li ng-repeat="pinpointUser in pinpointUserList" id="{{prefix + pinpointUser.userId}}">
<span class="contents" style="margin-left:6px">{{"("+pinpointUser.department + ")" + pinpointUser.name}}</span>
<input type="checkbox" ng-click="checkUser($event)" ng-model="pinpointUser.has"/>
<div style="float:right" class="_normal" ng-show="getCreateAllow()">
<div style="float:right" class="_normal" ng-show="canEditUserInfo">
<span class="glyphicon glyphicon-remove remove" aria-hidden="true" ng-click="onRemovePinpointUser($event)"></span>
<span class="glyphicon glyphicon-pencil edit" aria-hidden="true" ng-click="onUpdatePinpointUser($event)"></span>
</div>
<div style="float:right" class="_remove hide-me" ng-show="getCreateAllow()">
<div style="float:right" class="_remove hide-me" ng-show="canEditUserInfo">
<span class="glyphicon glyphicon-remove remove remove-confirm" aria-hidden="true" ng-click="onApplyRemovePinpointUser()"></span>
<span class="glyphicon glyphicon-arrow-left remove-cancel" aria-hidden="true" ng-click="onCancelRemovePinpointUser()"></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

scope.$on( "configuration.selectMenu", function( event, selectedName ) {
if ( myName === selectedName ) {
scope.$broadcast( "configuration.userGroup.show" );
scope.$broadcast( "pinpointUser.load", SystemConfigService.get("userDepartment") );
$element.show();
SystemConfigService.getConfig().then(function(config) {
scope.$broadcast( "configuration.userGroup.show" );
scope.$broadcast( "pinpointUser.load", config["userDepartment"] );
$element.show();
});
} else {
$element.hide();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,16 @@
applyAddUserGroup();
};
function applyAddUserGroup() {
AddUserGroup.applyAction( AlarmUtilService, $elNewGroup, $elLoading, SystemConfigService.get("userId"), function( oServerData, groupId ) {
oUserGroupList.push({
id: groupId,
number: oServerData.number
});
scope.userGroupList = oUserGroupList;
AlarmUtilService.setTotal( $elTotal, oUserGroupList.length );
}, showAlert );
SystemConfigService.getConfig().then(function(config) {
AddUserGroup.applyAction( AlarmUtilService, $elNewGroup, $elLoading, config["userId"], function( oServerData, groupId ) {
oUserGroupList.push({
id: groupId,
number: oServerData.number
});
scope.userGroupList = oUserGroupList;
AlarmUtilService.setTotal( $elTotal, oUserGroupList.length );
}, showAlert );
});
}

// remove process
Expand All @@ -131,18 +133,20 @@
RemoveUserGroup.cancelAction( AlarmUtilService, $workingNode );
};
scope.onApplyRemoveUserGroup = function() {
RemoveUserGroup.applyAction( AlarmUtilService, $workingNode, $elLoading, SystemConfigService.get("userId"), function( groupId ) {
for (var i = 0; i < oUserGroupList.length; i++) {
if ( oUserGroupList[i].id == groupId ) {
oUserGroupList.splice(i, 1);
break;
SystemConfigService.getConfig().then(function(config) {
RemoveUserGroup.applyAction( AlarmUtilService, $workingNode, $elLoading, config["userId"], function( groupId ) {
for (var i = 0; i < oUserGroupList.length; i++) {
if ( oUserGroupList[i].id == groupId ) {
oUserGroupList.splice(i, 1);
break;
}
}
}
scope.$apply(function () {
scope.userGroupList = oUserGroupList;
});
AlarmUtilService.setTotal($elTotal, oUserGroupList.length);
}, showAlert );
scope.$apply(function () {
scope.userGroupList = oUserGroupList;
});
AlarmUtilService.setTotal($elTotal, oUserGroupList.length);
}, showAlert );
});
};

// key down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
},
link: function postLink(scope, element, attrs) {
// initialize variables
var grid, dataView, lastAgent, startRow;
var grid, dataView, lastAgent, startRow, securityGuideUrl = "";

// initialize variables of methods
var initialize, treeFormatter, treeFilter, parseData, execTimeFormatter,
getColorByString, progressBarFormatter, argumentFormatter, linkFormatter, hasChildNode, searchRowByTime, searchRowByWord, selectRow;

SystemConfigService.getConfig().then(function(config) {
securityGuideUrl = config["securityGuideUrl"];
});

// bootstrap
window.callStacks = []; // Due to Slick.Data.DataView, must use window property to resolve scope-related problems.
Expand All @@ -39,7 +43,7 @@
if ( bIsAuthorized ) {
return removeTag( text );
} else {
return "<i style='color:#AAA;'>" + removeTag( text ) + "</i> <a href='" + SystemConfigService.get("securityGuideUrl") + "' target='_blank' style='color:#AAA;'><span class='glyphicon glyphicon-share'></span></a>";
return "<i style='color:#AAA;'>" + removeTag( text ) + "</i> <a href='" + securityGuideUrl + "' target='_blank' style='color:#AAA;'><span class='glyphicon glyphicon-share'></span></a>";
}
};
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
scope.isWas = false;
scope.isGroup = false;
scope.isAuthorized = true;
SystemConfigService.getConfig().then(function(config) {
scope.securyGuideUrl = config["securityGuideUrl"];
});
var currentAgentName = PreferenceService.getAgentAllStr();
var oChartYMax = {};
var bRequesting = false;
Expand Down Expand Up @@ -107,9 +110,6 @@
scope.isNotAuthorized = function() {
return scope.isAuthorized === false;
};
scope.getAuthGuideUrl = function() {
return SystemConfigService.get("securityGuideUrl");
};
scope.$on("nodeInfoDetailsDirective.initialize", function (event, target, oNavBarVoServiceArgu, bSendChartRequest) {
identifyTarget(target);
oNavBarVoService = oNavBarVoServiceArgu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h5><span class="glyphicon glyphicon-question-sign loadChartTooltip" style="curs
<div ng-show="isNotAuthorized()">
<div style="text-align:center;font-weight:bold;margin-top:50px;">
You don't have authorization.
<a ng-href="{{getAuthGuideUrl()}}" target="_blank" style="color:#AAA;"><span class='glyphicon glyphicon-share'></span></a>
<a ng-href="{{securyGuideUrl}}" target="_blank" style="color:#AAA;"><span class='glyphicon glyphicon-share'></span></a>
</div>
</div>
</div>
Loading

0 comments on commit bb6dd7f

Please sign in to comment.