From de1a27751fda28d1b8cd8b2e7645e79af0d7f293 Mon Sep 17 00:00:00 2001 From: denz Date: Tue, 26 Apr 2016 17:00:44 +0900 Subject: [PATCH] update alarm ui and fix bug --- .../common/services/alarm-util.service.js | 77 +-- .../alarm/alarm-group-member.directive.js | 18 +- .../alarm/alarm-pinpoint-user.directive.js | 533 +++++++++++------- .../alarm/alarm-rule.directive.js | 25 +- .../alarm/alarm-user-group.directive.js | 48 +- .../alarm/alarmPinpointUser.html | 66 ++- .../configuration/alarm/alarmRule.html | 10 +- .../configuration/alarm/alarmUserGroup.html | 8 +- .../configuration/configuration.controller.js | 2 +- web/src/main/webapp/lib/css/pinpoint.css | 71 +-- web/src/main/webapp/lib/js/pinpoint.min.js | 10 +- .../main/webapp/lib/js/pinpoint.min.js.map | 2 +- web/src/main/webapp/styles/configuration.css | 71 +-- 13 files changed, 518 insertions(+), 423 deletions(-) diff --git a/web/src/main/webapp/common/services/alarm-util.service.js b/web/src/main/webapp/common/services/alarm-util.service.js index 78711186a..27378cf70 100644 --- a/web/src/main/webapp/common/services/alarm-util.service.js +++ b/web/src/main/webapp/common/services/alarm-util.service.js @@ -9,8 +9,7 @@ * @class */ pinpointApp.constant('AlarmUtilServiceConfig', { - "hideClass": "hide-me", - "hasNotEditClass": "has-not-edit" + "hideClass": "hide-me" }); pinpointApp.service( "AlarmUtilService", [ "AlarmUtilServiceConfig", "AlarmAjaxService", "globalConfig", function ( $config, $ajaxService, globalConfig ) { @@ -23,15 +22,6 @@ arguments[i].addClass( $config.hideClass ); } }; - // this.showLoading = function( $elLoading, isEdit ) { - // $elLoading[ isEdit ? "removeClass" : "addClass" ]( $config.hasNotEditClass ); - // $elLoading.removeClass( $config.hideClass ); - // }; - this.showAlert = function( $elAlert, message ) { - $elAlert.find(".message").html( message ).end().removeClass( $config.hideClass ).animate({ - height: 300 - }, 500, function() {}); - }; this.sendCRUD = function( funcName, data, successCallback, failCallback ) { if ( ( angular.isUndefined( data ) || data === "" ) ) { data = { @@ -46,66 +36,6 @@ successCallback( resultData ); } }); - /* - switch( funcName ) { - case "getGroupMemberListInGroup": - successCallback([{ - memberId: 1, - department: "Paas", - name: "정민우" - },{ - memberId: 2, - department: "Paas", - name: "정현길" - }]); - break; - case "removeMemberInGroup": - successCallback(); - break; - case "getUserGroupList": - successCallback([{ - number: 1, - id: "pinpoint-monitor-group" - }, { - number: 2, - id: "pinpoint-dev-group" - }]); - break; - case "getPinpointUserList": - successCallback([{ - userId: 1, - department: "PaaS", - name: "김성관" - },{ - userId: 2, - department: "PaaS", - name: "문성호" - },{ - userId: 3, - department: "PaaS", - name: "송효종" - },{ - userId: 4, - department: "PaaS", - name: "정민우" - }]); - break; - case "createUserGroup": - successCallback({ - id: data.id, - number: parseInt( Math.random() * 10000 ) - }); - break; - case "updateUserGroup": - successCallback(); - break; - case "removeUserGroup": - successCallback(); - break; - default: - break; - } - */ }; this.setTotal = function( $elTotal, n ) { $elTotal.html( "(" + n + ")"); @@ -113,7 +43,7 @@ this.hasDuplicateItem = function( list, func ) { var len = list.length; var has = false; - for( var i = 0 ; i < list.length ; i++ ) { + for( var i = 0 ; i < len ; i++ ) { if ( func( list[i] ) ) { has = true; break; @@ -131,5 +61,8 @@ this.extractID = function( $el ) { return $el.prop("id").split("_")[1]; }; + this.getNode = function( $event, tagName ) { + return $( $event.toElement || $event.target ).parents( tagName ); + }; }]); })(jQuery); \ No newline at end of file diff --git a/web/src/main/webapp/features/configuration/alarm/alarm-group-member.directive.js b/web/src/main/webapp/features/configuration/alarm/alarm-group-member.directive.js index 5be015fe5..5743a4f07 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarm-group-member.directive.js +++ b/web/src/main/webapp/features/configuration/alarm/alarm-group-member.directive.js @@ -31,9 +31,6 @@ function cancelPreviousWork() { RemoveGroupMember.cancelAction( alarmUtilService, $workingNode ); } - function getNode( $event ) { - return $( $event.toElement || $event.target ).parents("li"); - } function showAlert( oServerError ) { $elAlert.find( ".message" ).html( oServerError.errorMessage ); alarmUtilService.hide( $elLoading ); @@ -42,6 +39,7 @@ function initData() { oGroupMemberList = []; scope.groupMemberList = []; + alarmUtilService.setTotal( $elTotal, oGroupMemberList.length ); } function hasUser( userID ) { return $( "#" + scope.prefix + userID ).length > 0; @@ -66,10 +64,10 @@ // remove process scope.onRemoveGroupMember = function( $event ) { - if ( $workingNode !== null && isSameNode( getNode( $event ) ) === false ) { + if ( $workingNode !== null && isSameNode( alarmUtilService.getNode( $event, "li" ) ) === false ) { cancelPreviousWork(); } - $workingNode = getNode( $event ); + $workingNode = alarmUtilService.getNode( $event, "li" ); RemoveGroupMember.onAction( alarmUtilService, $workingNode ); }; scope.onApplyRemoveGroupMember = function() { @@ -96,7 +94,15 @@ // sort scope.onSortGroupMember = function() { - console.log( "sort group member "); + if ( currentUserGroupId === "" ) return; + + var oSortedGroupMemberList = []; + var len = oGroupMemberList.length - 1; + for( var j = 0, i = len ; i >= 0 ; j++, i-- ) { + oSortedGroupMemberList[j] = oGroupMemberList[i]; + } + oGroupMemberList = oSortedGroupMemberList; + scope.groupMemberList = oGroupMemberList; }; // other diff --git a/web/src/main/webapp/features/configuration/alarm/alarm-pinpoint-user.directive.js b/web/src/main/webapp/features/configuration/alarm/alarm-pinpoint-user.directive.js index 00d656e1e..d30e55754 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarm-pinpoint-user.directive.js +++ b/web/src/main/webapp/features/configuration/alarm/alarm-pinpoint-user.directive.js @@ -23,14 +23,22 @@ var $elTotal = $element.find(".total"); var $elLoading = $element.find(".some-loading"); var $elAlert = $element.find(".some-alert"); + var $elSearch = $element.find(".some-list-search input"); + var $workingNode = null; + var aEditNode = $element.find(".new-group").toArray().map(function( el ) { + return $(el); + }); + var bIsLoaded = false; - var bIsCreate = true; // update - var bIsRemoving = false; var oPinpointUserList = []; var oGroupMemberList = []; scope.pinpointUserList = []; - scope.isAllowedCreate = globalConfig.editUserInfo; + scope.bIsAllowedCreate = globalConfig.editUserInfo; + function cancelPreviousWork() { + AddPinpointUser.cancelAction( hideEditArea ); + RemovePinpointUser.cancelAction( alarmUtilService, $workingNode ); + } function showAlert( oServerError ) { $elAlert.find( ".message" ).html( oServerError.errorMessage ); alarmUtilService.hide( $elLoading ); @@ -47,9 +55,6 @@ alarmUtilService.hide( $elLoading ); }, showAlert ); } - function getNode( $event ) { - return $( $event.toElement || $event.target ).parents("li"); - } function getTotal() { return oGroupMemberList.length + "/" + oPinpointUserList.length; } @@ -60,206 +65,183 @@ } } } + function showAddArea() { + var $ul = $elWrapper.find("ul"); + var len = aEditNode.length - 1; + for( var i = len ; i >= 0 ; i-- ) { + $ul.prepend( aEditNode[i] ); + } + aEditNode[0].find("input").attr("disabled", ""); + alarmUtilService.hide( aEditNode[len].find( CONSTS.DIV_EDIT ) ); + alarmUtilService.show( aEditNode[len].find( CONSTS.DIV_ADD ) ); + $.each( aEditNode, function( index, $el ) { + alarmUtilService.show( $el ); + }); + aEditNode[0].focus(); + } + function showEditArea( oPinpointUser ) { + var len = aEditNode.length - 1; + for( var i = len ; i >= 0 ; i-- ) { + $workingNode.after( aEditNode[i] ); + } + aEditNode[0].find("input").val( oPinpointUser.userId ); + aEditNode[1].find("input").val( oPinpointUser.name ); + aEditNode[2].find("input").val( oPinpointUser.department ); + aEditNode[3].find("input").val( oPinpointUser.phoneNumber ); + aEditNode[4].find("input").val( oPinpointUser.email ); + aEditNode[0].find("input").attr("disabled", "disabled"); - /* - var $elUL = $element.find(".some-list-content ul"); - $elUL.on("click", function( $event ) { - var $target = $( $event.toElement || $event.target ); - var tagName = $target.get(0).tagName.toLowerCase(); - var $li = $target.parents("li"); + alarmUtilService.hide( aEditNode[len].find( CONSTS.DIV_ADD ) ); + alarmUtilService.show( aEditNode[len].find( CONSTS.DIV_EDIT ) ); + $.each( aEditNode, function( index, $el ) { + alarmUtilService.show( $el ); + }); + aEditNode[0].find("input").focus(); + } + function hideEditArea() { + $.each( aEditNode, function( index, $el ) { + alarmUtilService.hide( $el ); + $el.find("input").val(""); + }); + } + function getNewPinpointUser() { + var userId = $.trim( aEditNode[0].find("input").val() ); + var userName = $.trim( aEditNode[1].find("input").val() ); + var userDepartment = $.trim( aEditNode[2].find("input").val() ); + var userPhone = $.trim( aEditNode[3].find("input").val() ); + var userEmail = $.trim( aEditNode[4].find("input").val() ); - if ( tagName == "button" ) { - if ( $target.hasClass("confirm-cancel") ) { - removeCancel( $li ); - } else if ( $target.hasClass("confirm-cancel") ) { - removeConfirm( $li ); - } else if ( $target.hasClass("move") ) { - moveUser( $li ); - } else if ( $target.hasClass("edit-user") ) { - scope.onUpdate( $event ); - } - } else if ( tagName == "span" ) { - if ( $target.hasClass("remove") ) { - if ( isRemoving === true ) return; - isRemoving = true; - $li.addClass("remove").find("span.remove").hide().end().find("button.move").addClass("disabled").end().append($removeTemplate); - } else if ( $target.hasClass("contents") ) { - } else if( $target.hasClass("glyphicon-edit") ) { - scope.onUpdate( $event ); - } else if ( $target.hasClass("glyphicon-remove") ) { - removeCancel( $li ); - } else if ( $target.hasClass("glyphicon-ok") ) { - removeConfirm( $li ); - } else if ( $target.hasClass("glyphicon-chevron-left") ) { - moveUser( $li ); - } - } - }); + var oPinpointUser = { + "userId": userId, + "name": userName, + "department": userDepartment, + "phoneNumber": userPhone, + "email": userEmail + }; + return oPinpointUser; + } + function validateEmail( email ) { + var reg = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; + return reg.test(email); + } + function validatePhone( phone ) { + var reg = /^\d+$/; + return reg.test(phone); + } + function isSameNode( $current ) { + return alarmUtilService.extractID( $workingNode ) === alarmUtilService.extractID( $current ); + } + function searchPinpointUser( userId ) { + for( var i = 0 ; i < oPinpointUserList.length ; i++ ) { + if ( oPinpointUserList[i].userId === userId ) { + return oPinpointUserList[i]; + } + } + return null; + } + // add + scope.onAddPinpointUser = function() { + if ( AddPinpointUser.isOn() ) { + return; + } + cancelPreviousWork(); + AddPinpointUser.onAction( function() { + showAddArea(); + }); + }; + scope.onCancelAddPinpointUser = function() { + AddPinpointUser.cancelAction( function() { + hideEditArea(); + }); + }; + scope.onApplyAddPinpointUser = function() { + applyAddPinpointUser(); + }; + function applyAddPinpointUser() { + AddPinpointUser.applyAction( alarmUtilService, getNewPinpointUser(), $elLoading, function( oNewPinpointUser ) { + analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_CREATE_PINPOINT_USER ); + oPinpointUserList.push( oNewPinpointUser ); + scope.pinpointUserList = oPinpointUserList; + hideEditArea(); + alarmUtilService.setTotal( $elTotal, oPinpointUserList.length ); + }, showAlert ); + } + // remove + scope.onRemovePinpointUser = function( $event ) { + var $node = alarmUtilService.getNode( $event, "li" ); + if ( $workingNode !== null && isSameNode( $node ) === false ) { + cancelPreviousWork( $node ); + } + $workingNode = $node; + RemovePinpointUser.onAction( alarmUtilService, $workingNode ); + }; + scope.onCancelRemovePinpointUser = function() { + RemovePinpointUser.cancelAction( alarmUtilService, $workingNode ); + }; + scope.onApplyRemovePinpointUser = function() { + RemovePinpointUser.applyAction( alarmUtilService, $workingNode, $elLoading, function( userId ) { + for( var i = 0 ; i < oPinpointUserList.length ; i++ ) { + if ( oPinpointUserList[i].userId == userId ) { + oPinpointUserList.splice(i, 1); + break; + } + } + scope.pinpointUserList = oPinpointUserList; + alarmUtilService.setTotal( $elTotal, oPinpointUserList.length ); + alarmBroadcastService.sendUserRemoved( userId ); + }, showAlert ); + }; + // update + scope.onUpdatePinpointUser = function( $event ) { + cancelPreviousWork(); + $workingNode = alarmUtilService.getNode( $event, "li" ); + UpdatePinpointUser.onAction( alarmUtilService, $workingNode, function( userId ) { + showEditArea( searchPinpointUser( userId ) ); + }); + }; + scope.onCancelUpdatePinpointUser = function() { + UpdatePinpointUser.cancelAction( alarmUtilService, $workingNode, hideEditArea ); + }; + scope.onApplyUpdatePinpointUser = function() { + UpdatePinpointUser.applyAction( alarmUtilService, getNewPinpointUser(), $workingNode, $elLoading, function( oPinpointUser ) { - function reset() { - scope.onCancelEdit(); - alarmUtilService.unsetFilterBackground( $elWrapper ); - $elSearchInput.val(""); - } - function moveUser( $el ) { - alarmUtilService.showLoading( $elLoading, false ); - alarmBroadcastService.sendUserAdd( searchUser( alarmUtilService.extractID( $el ) ) ); - } - function removeConfirm( $el ) { - alarmUtilService.showLoading( $elLoading, false ); - removeUser( alarmUtilService.extractID( $el ) ); - } - function removeCancel( $el ) { - $el - .find("span.right").remove().end() - .find("span.remove").show().end() - .find("button.move").removeClass("disabled").end() - .removeClass("remove"); - isRemoving = false; - } - function createUser( userId, userName, userDepartment, userPhone, userEmail ) { - var oNewUser = { - "userId": userId, - "name": userName, - "department": userDepartment, - "phoneNumber": userPhone, - "email": userEmail - }; - alarmUtilService.sendCRUD( "createPinpointUser", oNewUser, function( resultData ) { - alarmUtilService.hide( $elLoading, $elEdit ); - $elSearchType.val( "userName" ); - $elSearchInput.val( userName ); - scope.onSearch(); - }, function(errorData) {}, $elAlert ); - } - function updateUser( userId, userName, userDepartment, userPhone, userEmail ) { - var oUpdateUser = { - "userId": userId, - "name": userName, - "department": userDepartment, - "phoneNumber": userPhone, - "email": userEmail - }; - alarmUtilService.sendCRUD( "updatePinpointUser", oUpdateUser, function( resultData ) { - for( var i = 0 ; i < pinpointUserList.length ; i++ ) { - if ( pinpointUserList[i].userId == userId ) { - pinpointUserList[i].name = userName; - pinpointUserList[i].department = userDepartment; - pinpointUserList[i].phoneNumber = userPhone; - pinpointUserList[i].email = userEmail; - } - } - alarmUtilService.hide( $elLoading, $elEdit ); - alarmBroadcastService.sendUserUpdated( oUpdateUser ); - }, function( errorData ) {}, $elAlert ); - } - function removeUser( userId ) { - alarmUtilService.sendCRUD( "removePinpointUser", { "userId": userId }, function( resultData ) { - scope.$apply(function() { - for( var i = 0 ; i < pinpointUserList.length ; i++ ) { - if ( pinpointUserList[i].userId == userId ) { - pinpointUserList.splice(i, 1); - break; - } - } - }); - alarmUtilService.setTotal( $elTotal, pinpointUserList.length ); - alarmUtilService.hide( $elLoading ); - isRemoving = false; - alarmBroadcastService.sendUserRemoved( userId ); - }, function( errorData ) {}, $elAlert ); - } - function validateEmail( email ) { - var reg = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i; - return reg.test(email); - } - function validatePhone( phone ) { - var reg = /^\d+$/; - return reg.test(phone); - } + for( var i = 0 ; i < oPinpointUserList.length ; i++ ) { + if ( oPinpointUserList[i].userId == oPinpointUser.userId ) { + oPinpointUserList[i].name = oPinpointUser.name; + oPinpointUserList[i].department = oPinpointUser.department; + oPinpointUserList[i].phoneNumber = oPinpointUser.phone; + oPinpointUserList[i].email = oPinpointUser.email; + break; + } + } + scope.pinpointUserList = oPinpointUserList; + alarmBroadcastService.sendUserUpdated( oPinpointUser ); + }, showAlert ); + }; + scope.onSearchKeydown = function( $event ) { + if ( $event.keyCode == 13 ) { // Enter + scope.onSearch(); + } else if ( $event.keyCode == 27 ) { // ESC + $event.stopPropagation(); + } + }; + scope.onSearch = function() { + cancelPreviousWork(); + var query = $.trim( $elSearch.val() ); - scope.onCreate = function() { - if ( isRemoving === true ) return; - - isCreate = true; - $elEditGuide.html( "Create new pinpoint user" ); - $elEditInputUserID.prop("disabled", ""); - $elEditInputUserID.val(""); - $elEditInputName.val(""); - $elEditInputDepartment.val(""); - $elEditInputPhone.val(""); - $elEditInputEmail.val(""); - alarmUtilService.show( $elEdit ); - $elEditInputUserID.focus(); - }; - scope.onUpdate = function($event) { - if ( isRemoving === true ) return; - - isCreate = false; - var $el = $( $event.toElement || $event.target ).parents("li"); - var oUser = searchUser( alarmUtilService.extractID( $el ) ); - - $elEditGuide.html( "Update pinpoint user data." ); - $elEditInputUserID.prop("disabled", "disabled"); - $elEditInputUserID.val( oUser.userId ); - $elEditInputName.val( oUser.name ); - $elEditInputDepartment.val( oUser.department ); - $elEditInputPhone.val( oUser.phoneNumber ); - $elEditInputEmail.val( oUser.email ); - alarmUtilService.show( $elEdit ); - $elEditInputName.focus().select(); - }; - scope.onInputEdit = function($event) { - if ( $event.keyCode == 13 ) { // Enter - scope.onApplyEdit(); - } else if ( $event.keyCode == 27 ) { // ESC - scope.onCancelEdit(); - $event.stopPropagation(); - } - }; - scope.onCancelEdit = function() { - alarmUtilService.hide( $elEdit ); - }; - scope.onApplyEdit = function() { - var userId = $.trim( $elEditInputUserID.val() ); - var userName = $.trim( $elEditInputName.val() ); - var userDepartment = $.trim( $elEditInputDepartment.val() ); - var userPhone = $.trim( $elEditInputPhone.val() ); - var userEmail = $.trim( $elEditInputEmail.val() ); - - if ( userId === "" || userName === "" ) { - alarmUtilService.showLoading( $elLoading, true ); - alarmUtilService.showAlert( $elAlert, "You must input user id and user name."); - return; - } - alarmUtilService.showLoading( $elLoading, true ); - if ( alarmUtilService.hasDuplicateItem( pinpointUserList, function( pinpointUser ) { - return pinpointUser.userId == userId; - }) && isCreate === true) { - alarmUtilService.showAlert( $elAlert, "Exist a same user id in the lists." ); - return; - } - if ( validatePhone( userPhone ) === false ) { - alarmUtilService.showAlert( $elAlert, "You can only input numbers." ); - return; - } - if ( validateEmail( userEmail ) === false ) { - alarmUtilService.showAlert( $elAlert, "Invalid email format." ); - return; - } - if ( isCreate ) { - analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_CREATE_PINPOINT_USER ); - createUser( userId, userName, userDepartment, userPhone, userEmail ); - } else { - updateUser( userId, userName, userDepartment, userPhone, userEmail ); - } - }; - - */ + if ( query.length < 3 ) { + $elSearch.focus(); + return; + } + alarmUtilService.show( $elLoading ); + analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_FILTER_PINPOINT_USER ); + loadData({ "userName": query }); + // { "department" :query } + }; scope.checkUser = function( $event ) { alarmUtilService.show( $elLoading ); - var $node = getNode( $event ); + var $node = alarmUtilService.getNode( $event, "li" ); var userId = alarmUtilService.extractID( $node ); if ( $node.find("input").get(0).checked ) { alarmBroadcastService.sendUserAdd( getUser( userId ) ); @@ -281,6 +263,7 @@ scope.$apply(function() { scope.pinpointUserList = oPinpointUserList; }); + alarmUtilService.setTotal( $elTotal, getTotal() ); }); scope.$on("alarmPinpointUser.configuration.groupLoaded", function( event, list ) { $elWrapper.removeClass( "_disable-check" ); @@ -295,6 +278,7 @@ } }); scope.pinpointUserList = oPinpointUserList; + alarmUtilService.setTotal( $elTotal, getTotal() ); }); scope.$on("alarmPinpointUser.configuration.selectNone", function() { $elWrapper.addClass( "_disable-check" ); @@ -303,22 +287,165 @@ }); oGroupMemberList = []; scope.pinpointUserList = oPinpointUserList; + alarmUtilService.setTotal( $elTotal, getTotal() ); }); - scope.$on("alarmPinpointUser.configuration.addUserCallback", function( event, bSuccess ) { - if ( bSuccess === false ) { - + scope.$on("alarmPinpointUser.configuration.addUserCallback", function( event, list ) { + if ( list.length > oGroupMemberList.length ) { + //success + } else { + //fail } + oGroupMemberList = list; + alarmUtilService.setTotal( $elTotal, getTotal() ); + alarmUtilService.hide( $elLoading ); }); scope.onCloseAlert = function() { alarmUtilService.closeAlert( $elAlert, $elLoading ); }; scope.$on("alarmPinpointUser.configuration.load", function( event, department ) { + cancelPreviousWork(); if ( bIsLoaded === false ) { - loadData( angular.isUndefined( department ) ? {} : { "department": department } ); + loadData( { "department": "OxygenTF" } ); + // loadData( angular.isUndefined( department ) ? {} : { "department": department } ); } }); } }; }]); + + var CONSTS = { + INPUT_USERID_AND_NAME: "Input user id and name", + INPUT_PHONE_OR_EMAIL: "Input phone number or email", + YOU_CAN_ONLY_INPUT_NUMBERS: "You can only input numbers", + INVALID_EMAIL_FORMAT: "Invalid email format.", + DIV_NORMAL: "div._normal", + DIV_REMOVE: "div._remove", + DIV_ADD: "div._add", + DIV_EDIT: "div._edit" + }; + + var AddPinpointUser = { + _bIng: false, + isOn: function() { + return this._bIng; + }, + onAction: function( cb ) { + this._bIng = true; + cb(); + }, + cancelAction: function( cbCancel ) { + if ( this._bIng === true ) { + cbCancel(); + this._bIng = false; + } + }, + applyAction: function( alarmUtilService, oNewPinpointUser, $elLoading, cbSuccess, cbFail ) { + var self = this; + alarmUtilService.show( $elLoading ); + if ( oNewPinpointUser.userId === "" || oNewPinpointUser.name === "" ) { + cbFail({ errorMessage: CONSTS.INPUT_USERID_AND_NAME }); + return; + } + if ( oNewPinpointUser.phoneNumber === "" && oNewPinpointUser.email === "" ) { + cbFail({ errorMessage: CONSTS.INPUT_PHONE_OR_EMAIL }); + return; + } + if ( oNewPinpointUser.phoneNumber !== "" && validatePhone( oNewPinpointUser.phoneNumber ) ) { + cbFail({ errorMessage: CONSTS.YOU_CAN_ONLY_INPUT_NUMBERS }); + return; + } + if ( oNewPinpointUser.email !== "" && validateEmail( oNewPinpointUser.email ) ) { + cbFail({ errorMessage: CONSTS.INVALID_EMAIL_FORMAT }); + return; + } + + alarmUtilService.sendCRUD( "createPinpointUser", oNewPinpointUser, function( oServerData ) { + oNewPinpointUser.number = oServerData.number; + cbSuccess( oNewPinpointUser ); + self.cancelAction( function() {} ); + alarmUtilService.hide( $elLoading ); + }, function( oServerError ) { + cbFail( oServerError ); + }); + } + }; + var RemovePinpointUser = { + _bIng: false, + isOn: function () { + return this._bIng; + }, + onAction: function ( alarmUtilService, $node ) { + this._bIng = true; + $node.addClass("remove"); + alarmUtilService.hide( $node.find( CONSTS.DIV_NORMAL ) ); + alarmUtilService.show( $node.find( CONSTS.DIV_REMOVE ) ); + }, + cancelAction: function ( alarmUtilService, $node ) { + if ( this._bIng === true ) { + $node.removeClass("remove"); + alarmUtilService.hide($node.find( CONSTS.DIV_REMOVE )); + alarmUtilService.show($node.find( CONSTS.DIV_NORMAL )); + this._bIng = false; + } + }, + applyAction: function (alarmUtilService, $node, $elLoading, cbSuccess, cbFail) { + var self = this; + var userId = alarmUtilService.extractID( $node ); + alarmUtilService.sendCRUD( "removePinpointUser", { "userId": userId }, function( oServerData ) { + cbSuccess( userId ); + self.cancel( alarmUtilService, $node ); + alarmUtilService.hide( $elLoading ); + }, function( oServerError ) { + cbFail( oServerError ); + }); + } + }; + var UpdatePinpointUser = { + _bIng: false, + isOn: function () { + return this._bIng; + }, + onAction: function ( alarmUtilService, $node, cb ) { + this._bIng = true; + alarmUtilService.hide( $node ); + cb( alarmUtilService.extractID( $node ) ); + }, + cancelAction: function( alarmUtilService, $node, cbCancel ) { + if ( this._bIng === true ) { + cbCancel(); + alarmUtilService.show( $node ); + this._bIng = false; + } + }, + applyAction: function (alarmUtilService, oPinpointUser, $node, $elLoading, cbSuccess, cbFail) { + var self = this; + alarmUtilService.show($elLoading); + + if ( oPinpointUser.name === "" ) { + cbFail({ errorMessage: CONSTS.INPUT_USERID_AND_NAME }); + return; + } + if ( oPinpointUser.phoneNumber === "" && oPinpointUser.email === "" ) { + cbFail({ errorMessage: CONSTS.INPUT_PHONE_OR_EMAIL }); + return; + } + if ( oPinpointUser.phoneNumber !== "" && validatePhone( oPinpointUser.phoneNumber ) ) { + cbFail({ errorMessage: CONSTS.YOU_CAN_ONLY_INPUT_NUMBERS }); + return; + } + if ( oPinpointUser.email !== "" && validateEmail( oPinpointUser.email ) ) { + cbFail({ errorMessage: CONSTS.INVALID_EMAIL_FORMAT }); + return; + } + + alarmUtilService.sendCRUD( "updatePinpointUser", oPinpointUser, function( oServerData ) { + self.cancelAction( alarmUtilService, $node, function () {}); + cbSuccess( oPinpointUser ); + alarmUtilService.hide($elLoading); + }, function( oServerError ) { + cbFail( oServerError ); + } ); + } + } })(jQuery); \ No newline at end of file diff --git a/web/src/main/webapp/features/configuration/alarm/alarm-rule.directive.js b/web/src/main/webapp/features/configuration/alarm/alarm-rule.directive.js index 9a76fd17e..b372c01dc 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarm-rule.directive.js +++ b/web/src/main/webapp/features/configuration/alarm/alarm-rule.directive.js @@ -32,8 +32,8 @@ scope.ruleSets = []; function cancelPreviousWork() { - AddAlarm.cancelAction( alarmUtilService, aEditNodes ); - RemoveAlarm.cancelAction( alarmUtilService, $workingNode ); + AddAlarm.cancelAction( hideEditArea ); + RemoveAlarm.cancelAction( alarmUtilService, $workingNode, hideEditArea ); UpdateAlarm.cancelAction( alarmUtilService, $workingNode, aEditNodes ); } function isSameNode( $current ) { @@ -109,6 +109,7 @@ }).on("change", function (e) {}); } function showAddArea() { + $elWrapper.find("tbody").prepend( aEditNodes[1] ).prepend( aEditNodes[0] ); alarmUtilService.hide( aEditNodes[0].find( CONSTS.DIV_EDIT ) ); alarmUtilService.show( aEditNodes[0].find( CONSTS.DIV_ADD ) ); $.each( aEditNodes, function( index, $el ) { @@ -168,9 +169,6 @@ } return oRule; } - function getNode( $event ) { - return $( $event.toElement || $event.target ).parents("tr"); - } function searchRule( ruleId ) { for( var i = 0 ; i < oRuleList.length ; i++ ) { if ( oRuleList[i].ruleId == ruleId ) { @@ -192,9 +190,8 @@ } cancelPreviousWork(); AddAlarm.onAction( function() { - $elWrapper.find("tbody").prepend( aEditNodes[1] ).prepend( aEditNodes[0] ); showAddArea(); - } ); + }); }; scope.onApplyAddAlarm = function() { AddAlarm.applyAction( alarmUtilService, getNewRule(), $elLoading, function( application, rule ) { @@ -210,12 +207,10 @@ }, showAlert ); }; scope.onCancelAddAlarm = function() { - AddAlarm.cancelAction( function() { - hideEditArea(); - }); + AddAlarm.cancelAction( hideEditArea ); }; scope.onRemoveAlarm = function( $event ) { - var $node = getNode( $event ); + var $node = alarmUtilService.getNode( $event, "tr" ); if ( $workingNode !== null && isSameNode( $node ) === false ) { cancelPreviousWork( $node ); } @@ -239,16 +234,14 @@ }; scope.onUpdateAlarm = function( $event ) { cancelPreviousWork(); - $workingNode = getNode( $event ); + $workingNode = alarmUtilService.getNode( $event, "tr" ); UpdateAlarm.onAction( alarmUtilService, $workingNode, function( ruleId ) { $workingNode.after( aEditNodes[1] ).after( aEditNodes[0] ); showEditArea( searchRule( ruleId ) ); }); }; scope.onCancelUpdateAlarm = function() { - UpdateAlarm.cancelAction( alarmUtilService, $workingNode, function() { - hideEditArea(); - }); + UpdateAlarm.cancelAction( alarmUtilService, $workingNode, hideEditArea ); }; scope.onApplyUpdateAlarm = function() { UpdateAlarm.applyAction( alarmUtilService, getNewRule( alarmUtilService.extractID( $workingNode ) ), $workingNode, $elLoading, function( ruleId, application, rule ) { @@ -350,11 +343,13 @@ _bIng: false, onAction: function( alarmUtilService, $node ) { this._bIng = true; + $node.addClass("remove"); alarmUtilService.hide( $node.find( CONSTS.DIV_NORMAL ) ); alarmUtilService.show( $node.find( CONSTS.DIV_REMOVE ) ); }, cancelAction: function( alarmUtilService, $node ) { if ( this._bIng === true ) { + $node.removeClass("remove"); alarmUtilService.hide($node.find( CONSTS.DIV_REMOVE )); alarmUtilService.show($node.find( CONSTS.DIV_NORMAL )); this._bIng = false; diff --git a/web/src/main/webapp/features/configuration/alarm/alarm-user-group.directive.js b/web/src/main/webapp/features/configuration/alarm/alarm-user-group.directive.js index 56498046d..7a41fbf3e 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarm-user-group.directive.js +++ b/web/src/main/webapp/features/configuration/alarm/alarm-user-group.directive.js @@ -43,11 +43,14 @@ function loadData( sParam ) { alarmUtilService.show( $elLoading ); alarmUtilService.sendCRUD( "getUserGroupList", sParam, function( aServerData ) { - bIsLoaded = true; oUserGroupList = scope.userGroupList = aServerData; alarmUtilService.setTotal( $elTotal, oUserGroupList.length ); + alarmBroadcastService.sendSelectionEmpty(); + if ( bIsLoaded === false ) { + alarmBroadcastService.sendLoadPinpointUser(); + } + bIsLoaded = true; alarmUtilService.hide( $elLoading ); - alarmBroadcastService.sendLoadPinpointUser(); }, showAlert ); } function selectGroup( $el ) { @@ -71,15 +74,12 @@ UpdateUserGroup.cancelAction( alarmUtilService, $workingNode ); RemoveUserGroup.cancelAction( alarmUtilService, $workingNode ); } - function getNode( $event ) { - return $( $event.toElement || $event.target ).parents("li"); - } function showAlert( oServerError ) { $elAlert.find( ".message" ).html( oServerError.errorMessage ); alarmUtilService.hide( $elLoading ); alarmUtilService.show( $elAlert ); } - + // search scope.onSearch = function() { alarmUtilService.show( $elLoading ); cancelPreviousWork(); @@ -90,7 +90,7 @@ return; } analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_FILTER_USER_GROUP ); - loadData( query ); + loadData( { "userGroupId": query } ); }; // add process @@ -120,7 +120,7 @@ // remove process scope.onRemoveUserGroup = function( $event ) { - var $node = getNode( $event ); + var $node = alarmUtilService.getNode( $event, "li" ); if ( $workingNode !== null && isSameNode( $node ) === false ) { cancelPreviousWork( $node ); } @@ -148,7 +148,7 @@ // update process scope.onUpdateUserGroup = function( $event ) { cancelPreviousWork(); - $workingNode = getNode( $event ); + $workingNode = alarmUtilService.getNode( $event, "li" ); UpdateUserGroup.onAction( alarmUtilService, $workingNode ); }; scope.onCancelUpdateUserGroup = function() { @@ -158,9 +158,9 @@ applyUpdateUserGroup(); }; function applyUpdateUserGroup() { - UpdateUserGroup.applyAction( alarmUtilService, $workingNode, $elLoading, function( groupName ) { + UpdateUserGroup.applyAction( alarmUtilService, $workingNode, $elLoading, function( groupNumber, groupName ) { return alarmUtilService.hasDuplicateItem( oUserGroupList, function( userGroup ) { - return userGroup.id == groupName; + return ( ( userGroup.number != groupNumber ) && userGroup.id == groupName ) || ( userGroup.number == groupNumber && userGroup.id == groupName ); }); }, function( groupNumber, groupName ) { analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_CREATE_USER_GROUP ); @@ -174,6 +174,14 @@ } // key down + scope.onSearchKeydown = function( $event ) { + if ( $event.keyCode == 13 ) { // Enter + scope.onSearch(); + } else if ( $event.keyCode == 27 ) { // ESC + $elSearchInput.val(""); + $event.stopPropagation(); + } + }; scope.onAddUserGroupKeydown = function( $event ) { if ( $event.keyCode == 13 ) { // Enter applyAddUserGroup(); @@ -203,8 +211,8 @@ } ]); var CONSTS = { - MIN_GROUPNAME_LENGTH : 4, - ENTER_AT_LEAST: "Enter at least 4 letters to search", + MIN_GROUPNAME_LENGTH : 3, + ENTER_AT_LEAST: "Enter at least 3 letters to search", EXIST_A_SAME: "Exist a same group name", NEW_GROUP: "New Group", DIV_NORMAL: "div._normal", @@ -226,7 +234,7 @@ if ( this._bIng === true ) { this._bIng = false; alarmUtilService.hide( $newNode ); - $newNode.find( "input" ).attr( "placeholder", CONSTS.NEW_GROUP ).val( "" ); + $newNode.removeClass( "blink-blink" ).find( "input" ).attr( "placeholder", CONSTS.NEW_GROUP ).val( "" ); } }, applyAction: function( alarmUtilService, $newNode, $elLoading, cbSuccess, cbFail ) { @@ -234,7 +242,7 @@ var groupId = $newNode.find("input").val(); if ( groupId.length < CONSTS.MIN_GROUPNAME_LENGTH ) { alarmUtilService.hide( $elLoading ); - $newNode.find( "input" ).attr( "placeholder", CONSTS.ENTER_AT_LEAST ).val( "" ).focus(); + $newNode.addClass( "blink-blink" ).find( "input" ).attr( "placeholder", CONSTS.ENTER_AT_LEAST ).val( "" ).focus(); return; } alarmUtilService.sendCRUD( "createUserGroup", { "id": groupId }, function( oServerData ) { @@ -251,11 +259,13 @@ _bIng: false, onAction: function( alarmUtilService, $node ) { this._bIng = true; + $node.addClass("remove"); alarmUtilService.hide( $node.find( CONSTS.DIV_NORMAL ) ); alarmUtilService.show( $node.find( CONSTS.DIV_REMOVE ) ); }, cancelAction: function( alarmUtilService, $node ) { if ( this._bIng === true ) { + $node.removeClass("remove"); alarmUtilService.hide($node.find( CONSTS.DIV_REMOVE )); alarmUtilService.show($node.find( CONSTS.DIV_NORMAL )); this._bIng = false; @@ -278,6 +288,7 @@ _bIng: false, onAction: function( alarmUtilService, $node ) { this._bIng = true; + $node.addClass("edit"); alarmUtilService.hide( $node.find( CONSTS.DIV_NORMAL ) ); alarmUtilService.show( $node.find( CONSTS.DIV_EDIT ) ); alarmUtilService.hide( $node.find(".contents") ); @@ -286,6 +297,7 @@ }, cancelAction: function( alarmUtilService, $node ) { if ( this._bIng === true ) { + $node.removeClass("edit blink-blink"); $node.find("input").hide(); alarmUtilService.hide($node.find( CONSTS.DIV_EDIT )); alarmUtilService.show($node.find(".contents")); @@ -299,13 +311,15 @@ var groupNumber = alarmUtilService.extractID( $node ); var groupName = $node.find("input").val(); - if ( groupName === "" ) { + if ( groupName === "" || groupName.length < CONST.MIN_GROUPNAME_LENGTH ) { alarmUtilService.hide( $elLoading ); + $node.addClass("blink-blink"); $node.find("input").attr("placeholder", CONSTS.ENTER_AT_LEAST).val("").focus(); return; } - if ( cbHasDuplicate( groupName ) ) { + if ( cbHasDuplicate( groupNumber, groupName ) ) { alarmUtilService.hide( $elLoading ); + $node.addClass("blink-blink"); $node.find("input").attr("placeholder", CONSTS.EXIST_A_SAME).val("").focus(); return; } diff --git a/web/src/main/webapp/features/configuration/alarm/alarmPinpointUser.html b/web/src/main/webapp/features/configuration/alarm/alarmPinpointUser.html index fd7ac0f9f..975afd0e2 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarmPinpointUser.html +++ b/web/src/main/webapp/features/configuration/alarm/alarmPinpointUser.html @@ -1,37 +1,63 @@
Pinpoint User - - +Add + + Add +
+
-
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
      + + +
      +
      + + +
      +
    • - {{"("+pinpointUser.department + ")" + pinpointUser.name}} + {{"("+pinpointUser.department + ")" + pinpointUser.name}} +
      + + +
      +
      + + +
-
+
-
+
X
-
diff --git a/web/src/main/webapp/features/configuration/alarm/alarmRule.html b/web/src/main/webapp/features/configuration/alarm/alarmRule.html index 489d0d54e..d956bc0a9 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarmRule.html +++ b/web/src/main/webapp/features/configuration/alarm/alarmRule.html @@ -1,15 +1,7 @@
Alarm Rules -
- - - - -
- + Add + + Add
diff --git a/web/src/main/webapp/features/configuration/alarm/alarmUserGroup.html b/web/src/main/webapp/features/configuration/alarm/alarmUserGroup.html index 5968e64c4..b766f62b1 100644 --- a/web/src/main/webapp/features/configuration/alarm/alarmUserGroup.html +++ b/web/src/main/webapp/features/configuration/alarm/alarmUserGroup.html @@ -5,7 +5,7 @@
',chartDirective:Handlebars.compile('')},css:{borderWidth:2,height:180,navbarHeight:70,titleHeight:30},sumChart:{width:260,height:120},otherChart:{width:120,height:60},"const":{MIN_Y:10}}),pinpointApp.controller("RealtimeChartCtrl",["RealtimeChartCtrlConfig","$scope","$element","$rootScope","$compile","$timeout","$window","globalConfig","$location","RealtimeWebsocketService","AnalyticsService","TooltipService",function(b,c,d,e,f,g,h,i,j,k,l,m){function n(){O=d.find("div.agent-sum-chart"),P=d.find("div.agent-sum-chart div:first-child span:first-child"),Q=d.find("div.agent-sum-chart div:first-child span:last-child"),R=d.find("div.agent-chart-list"),S=d.find(".connection-message"),T=d.find(".handle .glyphicon"),U=d.find(".glyphicon-pushpin"),S.hide(),P.html(""),Q.html("0")}function o(){q("sum")===!1&&(O.append(f(b.template.chartDirective({width:b.sumChart.width,height:b.sumChart.height,namespace:"sum",chartColor:"sumChartColor",xAxisCount:W,showExtraInfo:"true",timeoutMaxCount:V}))(c)),_.sum=-1)}function p(){angular.isDefined(_.sum)?(_={},_.sum=-1):_={}}function q(a){return angular.isDefined(_[a])}function r(d){var e=a(b.template.agentChart).append(f(b.template.chartDirective({width:b.otherChart.width,height:b.otherChart.height,namespace:$.length,chartColor:"agentChartColor",xAxisCount:W,showExtraInfo:"false",timeoutMaxCount:V}))(c));R.append(e),x(d,$.length),$.push(e)}function s(){var a=k.open({onopen:function(a){E()},onmessage:function(a){t(a)},onclose:function(a){c.$apply(function(){I()})},ondelay:function(){k.close()},retry:function(){c.retryConnection()}});a&&o()}function t(a){switch(S.hide(),a[b.keys.TYPE]){case b.values.PING:k.send(ga);break;case b.values.RESPONSE:var c=a[b.keys.RESULT];if(c[b.keys.APPLICATION_NAME]!==Z)return;var d=c[b.keys.ACTIVE_THREAD_COUNTS],e=B(d);C(e),u(d,e,c[b.keys.TIME_STAMP])}}function u(a,d,e){var f=Math.max(D(),b["const"].MIN_Y),g=0,h=!0;for(var i in a)w(i,g),a[i][b.keys.CODE]===X?(h=!1,c.$broadcast("realtimeChartDirective.onData."+_[i],a[i][b.keys.STATUS],e,f,h)):c.$broadcast("realtimeChartDirective.onError."+_[i],a[i],e,f),z(g),g++;c.$broadcast("realtimeChartDirective.onData.sum",d,e,f,h),Q.html(g)}function v(a){return ha[b.keys.PARAMETERS][b.keys.APPLICATION_NAME]=a,JSON.stringify(ha)}function w(a,b){q(a)===!1&&(y(b)?x(a,b):r(a)),A(b,a)}function x(a,b){_[a]=b}function y(a){return $.length>a}function z(a){$[a].show()}function A(a,b){$[a].find("div").html(b)}function B(a){var c=[0,0,0,0];for(var d in a)a[d][b.keys.CODE]===X&&jQuery.each(a[d][b.keys.STATUS],function(a,b){c[a]+=b});return c}function C(a){aa.push(a.reduce(function(a,b){return a+b})),aa.length>W&&aa.shift()}function D(){return d3.max(aa,function(a){return a})}function E(){k.send(v(Z))}function F(){k.isOpened()===!1?s():E(),ea=!0}function G(){ea=!1,k.stopReceive(v(""))}function H(){e.$broadcast("realtimeChartDirective.clear.sum"),a.each($,function(a,b){e.$broadcast("realtimeChartDirective.clear."+a),b.hide()})}function I(){S.css("background-color","rgba(200, 200, 200, 0.9)"),S.find("h4").css("color","red").html("Closed connection.

Select node again."),S.find("button").show(),S.show()}function J(){S.css("background-color","rgba(138, 171, 136, 0.5)"),S.find("h4").css("color","blue").html("Waiting Connection..."),S.find("button").hide(),S.show()}function K(){d.animate({bottom:-fa,left:0},500,function(){T.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up")})}function L(){d.animate({bottom:0,left:0},500,function(){T.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down")})}function M(){d.innerWidth(d.parent().width()-b.css.borderWidth+"px")}function N(){U.css("color",ba?"red":"")}d=a(d);var O,P,Q,R,S,T,U,V=10,W=10,X=0,Y="",Z="",$=[],_={},aa=[0],ba=!0,ca=!1,da=!1,ea=!0,fa=b.css.height,ga=function(){var a={};return a[b.keys.TYPE]=b.values.PONG,JSON.stringify(a)}(),ha=function(){var a={};return a[b.keys.TYPE]=b.values.REQUEST,a[b.keys.COMMAND]=b.values.ACTIVE_THREAD_COUNT,a[b.keys.PARAMETERS]={},a}(),ia=null;m.init("realtime"),c.sumChartColor=["rgba(44, 160, 44, 1)","rgba(60, 129, 250, 1)","rgba(248, 199, 49, 1)","rgba(246, 145, 36, 1)"],c.agentChartColor=["rgba(44, 160, 44, .8)","rgba(60, 129, 250, .8)","rgba(248, 199, 49, .8)","rgba(246, 145, 36, .8)"],c.requestLabelNames=["1s","3s","5s","Slow"],c.bInitialized=!1,a(document).on("visibilitychange",function(){switch(document.visibilityState){case"hidden":ia=g(function(){k.close(),ia=null},6e4);break;case"visible":null!==ia?g.cancel(ia):c.retryConnection(),ia=null}}),n(),c.$on("realtimeChartController.close",function(){K();var a=ea;c.closePopup(),ea=a,N()}),c.$on("realtimeChartController.initialize",function(a,b,d,e){if((ba!==!0||Y!==e)&&/^\/main/.test(j.path())!==!1&&(ca=angular.isUndefined(b)?!1:b,d=angular.isUndefined(d)?"":d,Y=e,n(),P.html(Z=d),i.useRealTime!==!1&&ea!==!1)){if(ca===!1)return void K();p(),M(),c.bInitialized=!0,L(),c.closePopup(),P.html(Z=d),J(),F(),N()}}),c.retryConnection=function(){J(),F()},c.pin=function(){ba=!ba,l.send(l.CONST.MAIN,ba?l.CONST.CLK_REALTIME_CHART_PIN_ON:l.CONST.CLK_REALTIME_CHART_PIN_OFF),N()},c.resizePopup=function(){l.send(l.CONST.MAIN,l.CONST.TG_REALTIME_CHART_RESIZE),da?(fa=b.css.height,d.css({height:b.css.height+"px",bottom:"0px"}),R.css("height","150px")):(fa=h.innerHeight-b.css.navbarHeight,d.css({height:fa+"px",bottom:"0px"}),R.css("height",fa-b.css.titleHeight+"px")),da=!da},c.closePopup=function(){G(),H(),S.hide(),P.html(Z=""),Q.html("0")},a(h).on("resize",function(){M()})}])}(jQuery),function(){"use strict";pinpointApp.controller("MainCtrl",["filterConfig","$scope","$timeout","$routeParams","locationService","NavbarVoService","$window","SidebarTitleVoService","filteredMapUtilService","$rootElement","AnalyticsService","PreferenceService",function(a,b,c,d,e,f,g,h,i,j,k,l){k.send(k.CONST.MAIN_PAGE);var m,n,o,p,q,r;b.hasScatter=!1,g.htoScatter={},n=!0,o=!1,b.sidebarLoading=!0,c(function(){m=new f,d.application&&m.setApplication(d.application),d.readablePeriod&&m.setReadablePeriod(d.readablePeriod),d.queryEndDateTime&&m.setQueryEndDateTime(d.queryEndDateTime),m.setCalleeRange(l.getCalleeByApp(d.application)),m.setCallerRange(l.getCallerByApp(d.application)),m.isRealtime()?b.$broadcast("navbarDirective.initialize.realtime.andReload",m):angular.isDefined(d.application)&&angular.isUndefined(d.readablePeriod)?b.$broadcast("navbarDirective.initialize.andReload",m):(g.$routeParams=d,m.autoCalculateByQueryEndDateTimeAndReadablePeriod(),b.$broadcast("navbarDirective.initialize",m),b.$broadcast("scatterDirective.initialize",m),b.$broadcast("serverMapDirective.initialize",m))},500),p=function(){return e.path().split("/")[1]||"main"},q=function(){var a="/"+p()+"/"+m.getApplication()+"/";m.isRealtime()?(a+=m.getPeriodType(),g.$routeParams={application:m.getApplication(),readablePeriod:m.getPeriodType()}):a+=m.getReadablePeriod()+"/"+m.getQueryEndDateTime(),e.path()!==a&&("/main"===e.path()?e.path(a).replace():e.skipReload().path(a).replace(),g.$routeParams={application:m.getApplication(),readablePeriod:m.getReadablePeriod().toString(),queryEndDateTime:m.getQueryEndDateTime().toString()},b.$$phase||b.$apply())},r=function(a,b){var c=i.getFilteredMapUrlWithFilterVo(m,a,b);g.open(c,"")},b.getMainContainerClass=function(){return o?"no-data":""},b.getInfoDetailsClass=function(){var a=[];return b.hasScatter&&a.push("has-scatter"),b.hasFilter&&a.push("has-filter"),a.join(" ")},b.$on("serverMapDirective.hasData",function(a){o=!1,b.sidebarLoading=!1}),b.$on("serverMapDirective.hasNoData",function(a){o=!0,b.sidebarLoading=!1}),b.$on("navbarDirective.changed",function(a,c){o=!1,m=c,q(m),g.htoScatter={},b.hasScatter=!1,b.sidebarLoading=!0,m.isRealtime()&&b.$broadcast("realtimeChartController.close"),b.$broadcast("sidebarTitleDirective.empty.forMain"),b.$broadcast("nodeInfoDetailsDirective.hide"),b.$broadcast("linkInfoDetailsDirective.hide"),b.$broadcast("scatterDirective.initialize",m),b.$broadcast("serverMapDirective.initialize",m),b.$broadcast("sidebarTitleDirective.empty.forMain")}),b.$on("serverMapDirective.passingTransactionResponseToScatterChart",function(a,c){b.$broadcast("scatterDirective.initializeWithNode",c)}),b.$on("serverMapDirective.nodeClicked",function(a,c,d,e,f,g){n=!0;var i=new h;i.setImageType(e.serviceType),e.isWas===!0?(b.hasScatter=!0,i.setTitle(e.applicationName),b.$broadcast("scatterDirective.initializeWithNode",e)):e.unknownNodeGroup?(i.setTitle(e.serviceType.replace("_"," ")),b.hasScatter=!1):(i.setTitle(e.applicationName),b.hasScatter=!1),b.hasFilter=!1,b.$broadcast("sidebarTitleDirective.initialize.forMain",i,e),b.$broadcast("nodeInfoDetailsDirective.initialize",c,d,e,f,m,null,g),b.$broadcast("linkInfoDetailsDirective.hide")}),b.$on("serverMapDirective.linkClicked",function(a,c,d,e,f){n=!1;var g=new h;e.unknownLinkGroup?g.setImageType(e.sourceInfo.serviceType).setTitle("Unknown Group from "+e.sourceInfo.applicationName):g.setImageType(e.sourceInfo.serviceType).setTitle(e.sourceInfo.applicationName).setImageType2(e.targetInfo.serviceType).setTitle2(e.targetInfo.applicationName),b.hasScatter=!1;var j=i.findFilterInNavbarVo(e.sourceInfo.applicationName,e.sourceInfo.serviceType,e.targetInfo.applicationName,e.targetInfo.serviceType,m);j?(b.hasFilter=!0,b.$broadcast("filterInformationDirective.initialize.forMain",j.oServerMapFilterVoService)):b.hasFilter=!1,b.$broadcast("sidebarTitleDirective.initialize.forMain",g),b.$broadcast("nodeInfoDetailsDirective.hide"),b.$broadcast("linkInfoDetailsDirective.initialize",c,d,e,f,m)}),b.$on("serverMapDirective.openFilteredMap",function(a,b,c){r(b,c)}),b.$on("linkInfoDetailsDirective.openFilteredMap",function(a,b,c){r(b,c)}),b.$on("linkInfoDetailsDirective.openFilterWizard",function(a,c,d){b.$broadcast("serverMapDirective.openFilterWizard",c,d)}),b.$on("linkInfoDetailsDirective.ResponseSummary.barClicked",function(a,b){r(b)}),b.$on("linkInfoDetailsDirective.showDetailInformationClicked",function(a,c,d){b.hasScatter=!1; -var e=new h;e.setImageType(d.sourceInfo.serviceType).setTitle(d.sourceInfo.applicationName).setImageType2(d.targetInfo.serviceType).setTitle2(d.targetInfo.applicationName),b.$broadcast("sidebarTitleDirective.initialize.forMain",e),b.$broadcast("nodeInfoDetailsDirective.hide")}),b.$on("nodeInfoDetailDirective.showDetailInformationClicked",function(a,c,d){b.hasScatter=!1;var e=new h;e.setImageType(d.serviceType),d.unknownNodeGroup?(e.setTitle(d.serviceType.replace("_"," ")),b.hasScatter=!1):(e.setTitle(d.applicationName),b.hasScatter=!1),b.$broadcast("sidebarTitleDirective.initialize.forMain",e),b.$broadcast("linkInfoDetailsDirective.hide")}),b.loadingOption={hideTip:"init"},b.$watch("loadingOption.hideTip",function(a){if("init"!=a&&g.localStorage){var b=new Date;b.setDate(b.getDate()+30),g.localStorage.setItem("__HIDE_LOADING_TIP",a?b.valueOf():"-")}})}])}(),function(){"use strict";pinpointApp.controller("InspectorCtrl",["$scope","$timeout","$routeParams","locationService","NavbarVoService","AnalyticsService",function(a,b,c,d,e,f){f.send(f.CONST.INSPECTOR_PAGE);var g,h,i,j,k,l;b(function(){g=new e,c.application&&g.setApplication(c.application),c.readablePeriod&&g.setReadablePeriod(c.readablePeriod),c.queryEndDateTime&&g.setQueryEndDateTime(c.queryEndDateTime),c.agentId&&g.setAgentId(c.agentId),g.autoCalculateByQueryEndDateTimeAndReadablePeriod(),a.$emit("navbarDirective.initializeWithStaticApplication",g),a.$emit("agentListDirective.initialize",g)},500),a.$on("navbarDirective.changed",function(a,b){g=b,j()}),a.$on("agentListDirective.agentChanged",function(b,c){h=c,g.setAgentId(c.agentId),l()&&j(),h&&a.$emit("agentInfoDirective.initialize",g,h)}),i=function(){var a=d.path().split("/");return a[1]||"inspector"},j=function(){var b=k();l()&&("/inspector"===d.path()||d.skipReload().path(b).replace(),a.$emit("navbarDirective.initializeWithStaticApplication",g),a.$emit("agentListDirective.initialize",g))},k=function(){var a="/"+i()+"/"+g.getApplication()+"/"+g.getReadablePeriod()+"/"+g.getQueryEndDateTime();return g.getAgentId()&&(a+="/"+g.getAgentId()),a},l=function(){var a=k();return d.path()!==a}}])}(),function(){"use strict";pinpointApp.constant("TransactionListConfig",{applicationUrl:"/transactionmetadata.pinpoint",MAX_FETCH_BLOCK_SIZE:100}),pinpointApp.controller("TransactionListCtrl",["TransactionListConfig","$scope","$location","$routeParams","$rootScope","$timeout","$window","$http","webStorage","TimeSliderVoService","TransactionDaoService","AnalyticsService","helpContentService",function(a,b,c,d,e,f,g,h,i,j,k,l,m){l.send(l.CONST.TRANSACTION_LIST_PAGE);var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H;f(function(){n=1,o=0,b.transactionDetailUrl="index.html#/transactionDetail",b.sidebarLoading=!0;var a=E(),c=F(),e=!angular.isUndefined(d.transactionInfo);if(e){var h=d.transactionInfo.lastIndexOf("-"),i=d.transactionInfo.lastIndexOf("-",h-1);s=[d.transactionInfo.substring(0,i),d.transactionInfo.substring(i+1,h),d.transactionInfo.substring(h+1)]}a&&c?(p=A(g.name),B(p.applicationName)?(q=C(p),G(e)):H(m.transactionList.openError.noData.replace(/\{\{application\}\}/,p.applicationName))):e===!1?H(m.transactionList.openError.noParent):(p=D(),q=[[s[1],s[2],s[0]]],G(e)),f(function(){$("#main-container").layout({north__minSize:20,north__size:(window.innerHeight-40)/2,center__maskContents:!0})},100)},100),H=function(a){alert(a),g.location.replace(g.location.href.replace("transactionList","main"))},G=function(a){r=new j,r.setTotal(q.length),t(a)},E=function(){return angular.isDefined(g.opener)},F=function(){if(angular.isUndefined(g.opener)||null===g.opener)return!1;var a=g.opener.$routeParams;if(angular.isDefined(d)&&angular.isDefined(a))if("realtime"===a.readablePeriod){if(angular.equals(d.application,a.application))return!0}else if(angular.equals(d.application,a.application)&&angular.equals(d.readablePeriod,a.readablePeriod)&&angular.equals(d.queryEndDateTime,a.queryEndDateTime))return!0;return!1},A=function(a){var b=a.split("|");return 4===b.length?{applicationName:b[0],type:b[1],min:b[2],max:b[3]}:{applicationName:b[0],nXFrom:b[1],nXTo:b[2],nYFrom:b[3],nYTo:b[4]}},D=function(){return{applicationName:d.application.split("@")[0],nXFrom:parseInt(s[1])-1e3,nXTo:parseInt(s[1])+1e3,nYFrom:0,nYTo:0}},B=function(a){return angular.isDefined(g.opener.htoScatter[a])},C=function(a){var b=g.opener.htoScatter[a.applicationName];return a.type?b.getDataByRange(a.type,a.min,a.max):b.getDataByXY(a.nXFrom,a.nXTo,a.nYFrom,a.nYTo)},w=function(a){b.$emit("transactionTableDirective.appendTransactionList",a.metadata)},x=function(){if(!q)return g.alert("Query failed - Query parameter cache deleted.\n\nPossibly due to scatter chart being refreshed."),!1;for(var b=[],c=o,d=0;c0&&b.push("&"),b=b.concat(["I",d,"=",q[c][0]]),b=b.concat(["&T",d,"=",q[c][1]]),b=b.concat(["&R",d,"=",q[c][2]]),o++;return n++,b},u=function(){y(x(),function(c){return 0===c.metadata.length?(b.$emit("timeSliderDirective.disableMore"),b.$emit("timeSliderDirective.changeMoreToDone"),!1):(c.metadata.length','
','
',"",'','','',"","
","
","
"].join("")});m.renderFunc(function(a,b,d){var e=o(d);a[b==this._selectedRow?"addClass":"removeClass"]("timeline-bar-selected").find("div.clickable-bar").css({width:p(d)+"px",backgroundColor:n(d[c.key.applicationName]),marginLeft:e+"px"}).find("span.nameType").html(d[c.key.applicationName]+"/"+d[c.key.apiType]+"("+(d[c.key.end]-d[c.key.begin])+"ms)"),e>=68?a.find("span.before").show().end().find("span.after").hide().end().find("span.before .startTime").html(q(d)):a.find("span.before").hide().end().find("span.after").show().end().find("span.after .startTime").html(q(d))}),g=function(){var a=[];return angular.forEach(c.timeline.callStack,function(b){b[c.key.isMethod]&&!b[c.key.excludeFromTimeline]&&""!==b[c.key.service]&&a.push(b)}),a},f=function(b){c.timeline=b,c.key=b.callStackIndex,c.barRatio=1e3/(b.callStack[0][c.key.end]-b.callStack[0][c.key.begin]),c.newCallStacks=g(),m.source(c.newCallStacks).viewAreaHeight(a(d).parentsUntil("div.wrapper").height()-70).selectedRow(-1,angular.noop).reset(),c.maxHeight=m.contentsAreaHeight(),i=0,c.$digest()};var n=function(a){var b=l.indexOf(a);return-1==b&&(l.push(a),b=l.length-1),k[b>=k.length?0:b]},o=function(a){return(a[c.key.begin]-c.timeline.callStackStart)*c.barRatio+.9},p=function(a){return(a[c.key.end]-a[c.key.begin])*c.barRatio+.9},q=function(a){return a[c.key.begin]-c.timeline.callStackStart};a(d).on("click",".clickable-bar",function(){b.send(b.CONST.CALLSTACK,b.CONST.CLK_CALL),c.$emit("transactionDetail.selectDistributedCallFlowRow",c.newCallStacks[parseInt(a(this).parent().attr("data-index"))][6])}),a(d).on("mouseenter",".timeline-bar-frame",function(b){a(this).parent().css({"box-shadow":"6px 6px 2px -2px rgba(0,0,0,0.75)","font-weight":"bold"})}),a(d).on("mouseleave",".timeline-bar-frame",function(b){a(this).parent().css({"box-shadow":"none","font-weight":"normal"})}),c.$on("timelineDirective.initialize",function(a,b){f(b)}),c.$on("timelineDirective.resize",function(b){m.resize(a(d).parentsUntil("div.wrapper").height()-70)}),c.$on("timelineDirective.searchCall",function(a,b,d){var e=h(i,-1,b);-1==e?0===i?c.$emit("transactionDetail.timelineSearchCallResult","No call took longer than {time}ms."):(e=h(0,i,b),-1==e?c.$emit("transactionDetail.timelineSearchCallResult","No call took longer than {time}ms."):j(e,"Loop")):j(e,"")}),h=function(a,b,d){return m.searchRow(a,b,function(a){return a[c.key.end]-a[c.key.begin]>=d})},j=function(a,b){m.selectedRow(a,function(a){this.$wrapper.find("div[data-index="+this._selectedRow+"]").removeClass("timeline-bar-selected"),this.$wrapper.find("div[data-index="+a+"]").addClass("timeline-bar-selected")}).moveByRow(a),i=a+1,c.$emit("transactionDetail.timelineSearchCallResult",b)}}}}])}(jQuery),function(){"use strict";pinpointApp.constant("agentChartGroupConfig",{POINTS_TIMESTAMP:0,POINTS_MIN:1,POINTS_MAX:2,POINTS_AVG:3}),pinpointApp.directive("agentChartGroupDirective",["agentChartGroupConfig","$timeout","AgentDaoService","AnalyticsService",function(a,b,c,d){return{restrict:"EA",replace:!0,templateUrl:"features/agentChartGroup/agentChartGroup.html?v="+G_BUILD_TIME,scope:{namespace:"@"},link:function(a,b,e){var f,g,h,i,j,k,l,m;a.showChartGroup=!1,h=function(e){f={Heap:!1,PermGen:!1,CpuLoad:!1},g=null,a.showChartGroup=!0,a.$digest(),c.getAgentStat(e,function(a,b){return a?void console.log("error",a):(f.Heap===!1&&i(b),void(g=b))}),b.tabs({activate:function(b,c){var e=c.newTab.text();return"Heap"==e?(d.send(d.CONST.MIXEDVIEW,d.CONST.CLK_HEAP),void(f.Heap===!1?i(g):a.$broadcast("jvmMemoryChartDirective.resize.forHeap_"+a.namespace))):"PermGen"==e?(d.send(d.CONST.MIXEDVIEW,d.CONST.CLK_PERM_GEN),void(f.PermGen===!1?j(g):a.$broadcast("jvmMemoryChartDirective.resize.forNonHeap_"+a.namespace))):"CpuLoad"==e?(d.send(d.CONST.MIXEDVIEW,d.CONST.CLK_CPU_LOAD),void(f.CpuLoad===!1?k(g):a.$broadcast("cpuLoadChartDirective.resize.forCpuLoad_"+a.namespace))):void 0}}),b.tabs("paging")},i=function(b){f.Heap=!0;var d={id:"heap",title:"Heap",span:"span12",line:[{id:"JVM_MEMORY_HEAP_USED",key:"Used",values:[],isFgc:!1},{id:"JVM_MEMORY_HEAP_MAX",key:"Max",values:[],isFgc:!1},{id:"fgc",key:"FGC",values:[],isFgc:!0}]};a.$broadcast("jvmMemoryChartDirective.initAndRenderWithData.forHeap_"+a.namespace,c.parseMemoryChartDataForAmcharts(d,b),"100%","100%")},j=function(b){f.PermGen=!0;var d={id:"nonheap",title:"PermGen",span:"span12",line:[{id:"JVM_MEMORY_NON_HEAP_USED",key:"Used",values:[],isFgc:!1},{id:"JVM_MEMORY_NON_HEAP_MAX",key:"Max",values:[],isFgc:!1},{id:"fgc",key:"FGC",values:[],isFgc:!0}]};a.$broadcast("jvmMemoryChartDirective.initAndRenderWithData.forNonHeap_"+a.namespace,c.parseMemoryChartDataForAmcharts(d,b),"100%","100%")},k=function(b){f.CpuLoad=!0;var d={id:"cpuLoad",title:"JVM/System Cpu Usage",span:"span12",isAvailable:!1};a.$broadcast("cpuLoadChartDirective.initAndRenderWithData.forCpuLoad_"+a.namespace,c.parseCpuLoadChartDataForAmcharts(d,b),"100%","100%")},l=function(b){f.Heap&&a.$broadcast("jvmMemoryChartDirective.showCursorAt.forHeap_"+a.namespace,b),f.PermGen&&a.$broadcast("jvmMemoryChartDirective.showCursorAt.forNonHeap_"+a.namespace,b),f.CpuLoad&&a.$broadcast("cpuLoadChartDirective.showCursorAt.forCpuLoad_"+a.namespace,b)},m=function(){f.Heap&&a.$broadcast("jvmMemoryChartDirective.resize.forHeap_"+a.namespace),f.PermGen&&a.$broadcast("jvmMemoryChartDirective.resize.forNonHeap_"+a.namespace),f.CpuLoad&&a.$broadcast("cpuLoadChartDirective.resize.forCpuLoad_"+a.namespace)},a.$on("agentChartGroupDirective.initialize."+a.namespace,function(a,b){h(b)}),a.$on("agentChartGroupDirective.showCursorAt."+a.namespace,function(a,b){l(b)}),a.$on("agentChartGroupDirective.resize."+a.namespace,function(a){m()})}}}])}(),function(){"use strict";pinpointApp.directive("sidebarTitleDirective",["$timeout","$rootScope","PreferenceService","AnalyticsService",function(a,b,c,d){return{restrict:"E",replace:!0,templateUrl:"features/sidebar/title/sidebarTitle.html?v="+G_BUILD_TIME,scope:{namespace:"@"},link:function(e,f,g){function h(a){if(e.currentAgent=c.getAgentAllStr(),"undefined"==typeof a)return void(e.agentList=[]);var b=[];if(a.serverList)for(var d in a.serverList){var f=a.serverList[d].instanceList;for(var g in f)b.push(g)}e.agentList=b}function i(b,c){e.isWas=angular.isDefined(c)&&angular.isDefined(c.isWas)?c.isWas:!1,e.stImage=b.getImage(),e.stImageShow=!!b.getImage(),e.stTitle=b.getTitle(),e.stImage2=b.getImage2(),e.stImage2Show=!!b.getImage2(),e.stTitle2=b.getTitle2(),a(function(){f.find('[data-toggle="tooltip"]').tooltip("destroy").tooltip()})}function j(){e.currentAgent=c.getAgentAllStr(),e.stImage=!1,e.stImageShow=!1,e.stTitle=!1,e.stImage2=!1,e.stTitle2=!1,e.stImage2Show=!1,e.isWas=!1,e.agentList=[]}e.agentList=[],a(function(){j()}),e.changeAgent=function(){d.send(d.CONST.INSPECTOR,d.CONST.CLK_CHANGE_AGENT_MAIN),b.$broadcast("changedCurrentAgent",e.currentAgent)},e.$on("sidebarTitleDirective.initialize."+e.namespace,function(a,b,c){i(b,c),h(c)}),e.$on("sidebarTitleDirective.empty."+e.namespace,function(a){j()})}}}])}(),function(){"use strict";pinpointApp.directive("filterInformationDirective",["$filter","$base64",function(a,b){return{restrict:"EA",replace:!0,templateUrl:"features/sidebar/filter/filterInformation.html?v="+G_BUILD_TIME,scope:{namespace:"@"},link:function(c,d,e){var f,g;f=function(d){if(g(),oServerMapFilterVo.getRequestUrlPattern()&&(c.urlPattern=b.decode(d.getRequestUrlPattern())),c.includeException=v.getIncludeException()?"Failed Only":"Success + Failed",angular.isNumber(d.getResponseFrom())&&oServerMapFilterVo.getResponseTo()){var e=[];e.push(a("number")(d.getResponseFrom())),e.push("ms"),e.push("~"),"max"===d.getResponseTo()?e.push("30,000+"):e.push(a("number")(d.getResponseTo())),e.push("ms"),c.responseTime=e.join(" ")}var f=d.getFromAgentName(),h=d.getToAgentName();f||h?c.agentFilterInfo=(f||"all")+" -> "+(h||"all"):c.agentFilterInfo=!1},g=function(){c.urlPattern="none",c.responseTime="none",c.includeException="none"},c.$on("filterInformationDirective.initialize."+c.namespace,function(a,b){f(b)})}}}])}(),function(){"use strict";pinpointApp.directive("distributedCallFlowDirective",["$filter","$timeout","CommonAjaxService",function(a,b,c){return{restrict:"E",replace:!0,templateUrl:"features/distributedCallFlow/distributedCallFlow.html?v=${buildTime}",scope:{namespace:"@"},link:function(d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;window.callStacks=[],o=function(a){var b=0,c=0,d="#";for(b=0,c=0;bb;d+=("00"+(c>>8*b++&255).toString(16)).slice(-2));return d},k=function(a,b,c,d,e){var f=[];c=c.replace(/&/g,"&").replace(//g,">");var g=h.getItemById(e.id);i=g.agent?g.agent:i;var j=o(i),k=h.getIdxById(e.id),l="dcf-popover";if(g.hasException?l+=" has-exception":g.isMethod||(l+=" not-method"),f.push('
'),f.push("
"),f.push(""),window.callStacks[k+1]&&window.callStacks[k+1].indent>window.callStacks[k].indent?e._collapsed?f.push("  "):f.push("  "):f.push("  "),g.hasException)f.push(' ');else if(g.isMethod){var m=parseInt(g.methodType);switch(m){case 100:f.push(' ');break;case 200:f.push(' ');break;case 900:f.push(' ')}}else"SQL"===g.method?f.push(' '):f.push(' ');return f.push(c),f.push("
"),f.join("")},l=function(a){var b=!0;if(angular.isDefined(a.parent)&&null!==a.parent)for(var c=window.callStacks[a.parent];c;)c._collapsed&&(b=!1),c=window.callStacks[c.parent];return b},q=function(a,b,c,d,e){var f=[];return f.push('
'),f.push(c),f.push("
"),f.join("")},r=function(a,b,c,d,e){if(c&&0!==c.length){var f=[];f.push('');var g=h.getItemById(e.id),i=g.logButtonName;return f.push(i),f.push(""),f.join("")}},n=function(b,c,d,e,f){return a("date")(d,"HH:mm:ss sss")},p=function(a,b,c,d,e){if(angular.isUndefined(c)||null===c||""===c||0===c)return"";var f;return f="#5bc0de",""},m=function(a,b){var c=[],d=100/(b[0][a.end]-b[0][a.begin]);return angular.forEach(b,function(b,e){c.push({id:"id_"+e,parent:b[a.parentId]?b[a.parentId]-1:null,indent:b[a.tab],method:b[a.title],argument:b[a.arguments],execTime:b[a.begin]>0?b[a.begin]:null,gapMs:b[a.gap],timeMs:b[a.elapsedTime],timePer:b[a.elapsedTime]?(b[a.end]-b[a.begin])*d+.9:null,"class":b[a.simpleClassName],methodType:b[a.methodType],apiType:b[a.apiType],agent:b[a.agent],applicationName:b[a.applicationName],hasException:b[a.hasException],isMethod:b[a.isMethod],logLink:b[a.logPageUrl],logButtonName:b[a.logButtonName],isFocused:b[a.isFocused],execMilli:b[a.executionMilliseconds],execPer:b[a.elapsedTime]&&b[a.executionMilliseconds]?parseInt(b[a.executionMilliseconds].replace(/,/gi,""))/parseInt(b[a.elapsedTime].replace(/,/gi,""))*100:0})}),c},j=function(a){window.callStacks=m(a.callStackIndex,a.callStack);var f={enableCellNavigation:!0,enableColumnReorder:!0,enableTextSelectionOnCells:!0,topPanelHeight:30,rowHeight:25};h=new Slick.Data.DataView({inlineFilters:!0}),h.beginUpdate(),h.setItems(window.callStacks),h.setFilter(l),h.getItemMetadata=function(a){var b=h.getItemByIdx(a),c={cssClasses:""};return b.hasException===!0&&(c.cssClasses+=" error-point"),b.isFocused===!0&&(c.cssClasses+=" entry-point"),null!==b.execTime&&(c.cssClasses+=" id_"+(a+1)),c},h.endUpdate();var i=[{id:"method",name:"Method",field:"method",width:400,formatter:k},{id:"argument",name:"Argument",field:"argument",width:300,formatter:q},{id:"exec-time",name:"Start Time",field:"execTime",width:90,formatter:n},{id:"gap-ms",name:"Gap(ms)",field:"gapMs",width:70,cssClass:"right-align"},{id:"time-ms",name:"Exec(ms)",field:"timeMs",width:70,cssClass:"right-align"},{id:"time-per",name:"Exec(%)",field:"timePer",width:100,formatter:p},{id:"exec-milli",name:"Self(ms)",field:"execMilli",width:75,cssClass:"right-align"},{id:"class",name:"Class",field:"class",width:120},{id:"api-type",name:"API",field:"apiType",width:90},{id:"agent",name:"Agent",field:"agent",width:130},{id:"application-name",name:"Application",field:"applicationName",width:150}];g=new Slick.Grid(e.get(0),h,i,f),g.setSelectionModel(new Slick.RowSelectionModel);var j=!0,o=!1;g.onClick.subscribe(function(a,d){var f;if($(a.target).hasClass("toggle")&&(f=h.getItem(d.row),f&&(f._collapsed?f._collapsed=!1:f._collapsed=!0,h.updateItem(f.id,f)),a.stopImmediatePropagation()),$(a.target).hasClass("sql")){f=h.getItem(d.row);var g=h.getItem(d.row+1),i="sql="+encodeURIComponent(f.argument);angular.isDefined(g)&&"SQL-BindValue"===g.method?(i+="&bind="+encodeURIComponent(g.argument),c.getSQLBind("/sqlBind.pinpoint",i,function(a){$("#customLogPopup").find("h4").html("SQL").end().find("div.modal-body").html('

Binded SQL

'+a+'
'+a.replace(/\t\t/g,"")+'

Original SQL

'+f.argument+'
'+f.argument.replace(/\t\t/g,"")+'

SQL Bind Value

'+g.argument+'
'+g.argument+"
").end().modal("show"),prettyPrint()})):($("#customLogPopup").find("h4").html("SQL").end().find("div.modal-body").html('

Original SQL

'+f.argument+'
'+f.argument.replace(/\t\t/g,"")+"
").end().modal("show"),prettyPrint())}o||(o=b(function(){j&&e.find(".dcf-popover").popover("hide"),j=!0,o=!1},300))}),g.onDblClick.subscribe(function(a,b){j=!1,$(a.target).popover("toggle")}),g.onCellChange.subscribe(function(a,b){h.updateItem(b.item.id,b.item)}),g.onActiveCellChanged.subscribe(function(a,b){d.$emit("distributedCallFlowDirective.rowSelected."+d.namespace,b.grid.getDataItem(b.row))}),s=function(a){var b=h.getItem(a+1);return!(!b||a!==b.parent)},g.onKeyDown.subscribe(function(a,b){var c=h.getItem(b.row);if(37==a.which)if(s(b.row))c._collapsed=!0,h.updateItem(c.id,c);else{var d=h.getItem(b.row-1);d&&g.setActiveCell(b.row-1,0)}else if(39==a.which){if(c._collapsed)c._collapsed=!1;else{var e=h.getItem(b.row+1);e&&g.setActiveCell(b.row+1,0)}h.updateItem(c.id,c)}}),h.onRowCountChanged.subscribe(function(a,b){g.updateRowCount(),g.render()}),h.onRowsChanged.subscribe(function(a,b){g.invalidateRows(b.rows),g.render()})},$("#customLogPopup").on("click","button",function(){var a=document.createRange();a.selectNode($(this).parent().next().get(0)),window.getSelection().addRange(a);try{document.execCommand("copy")}catch(b){console.log("unable to copy :",b)}window.getSelection().removeAllRanges()}),d.$on("distributedCallFlowDirective.initialize."+d.namespace,function(a,b){j(b)}),d.$on("distributedCallFlowDirective.resize."+d.namespace,function(a){g&&g.resizeCanvas()}),d.$on("distributedCallFlowDirective.selectRow."+d.namespace,function(a,b){var c=b-1;g.setSelectedRows([c]),g.setActiveCell(c,0),g.scrollRowToTop(c)}),d.$on("distributedCallFlowDirective.searchCall."+d.namespace,function(a,b,c){var e=t(b,c);-1==e?c>0?(u(t(b,0)),d.$emit("transactionDetail.calltreeSearchCallResult","Loop")):d.$emit("transactionDetail.calltreeSearchCallResult","No call took longer than {time}ms."):(u(e),d.$emit("transactionDetail.calltreeSearchCallResult",""))}),t=function(a,b){for(var c=0,d=-1,e=0;e=a){if(c==b){d=e;break}c++}return d},u=function(a){g.setSelectedRows([a]),g.setActiveCell(a,0),g.scrollRowIntoView(a,!0)}}}}])}(),function(){"use strict";pinpointApp.constant("responseTimeChartDirectiveConfig",{myColors:["#2ca02c","#3c81fa","#f8c731","#f69124","#f53034"]}),pinpointApp.directive("responseTimeChartDirective",["responseTimeChartDirectiveConfig","$timeout","AnalyticsService","PreferenceService",function(a,b,c,d){var e=d.getResponseTypeColor();return{template:"
",replace:!0,restrict:"EA",scope:{namespace:"@"},link:function(a,f,g){var h,i,j,k,l,m,n,o;j=function(){h="responseTimeId-"+a.namespace,f.attr("id",h)},k=function(a,b){f.css("width",a||"100%"),f.css("height",b||"150px")},l=function(d,e,f){b(function(){var b={type:"serial",theme:"none",dataProvider:d,startDuration:0,valueAxes:[{gridAlpha:.1,usePrefixes:!0}],graphs:[{balloonText:e?"[[category]] filtering":"",colorField:"color",labelText:"[[value]]",fillAlphas:.3,alphaField:"alpha",lineAlpha:.8,lineColor:"#787779",type:"column",valueField:"count"}],categoryField:"responseTime",categoryAxis:{gridAlpha:0}};f&&(b.chartCursor={fullWidth:!0,categoryBalloonAlpha:.7,cursorColor:"#000000",cursorAlpha:0,zoomable:!1}),i=AmCharts.makeChart(h,b),i.addListener("clickGraphItem",function(b){"Error"==b.item.category&&(c.send(c.CONST.MAIN,c.CONST.CLK_RESPONSE_GRAPH),a.$emit("responseTimeChartDirective.showErrorTransacitonList",b.item.category)),e&&a.$emit("responseTimeChartDirective.itemClicked."+a.namespace,b.item.serialDataItem.dataContext)}),e&&(i.addListener("clickGraphItem",m),i.addListener("rollOverGraphItem",function(a){a.event.target.style.cursor="pointer"}))})},m=function(b){a.$emit("responseTimeChartDirective.itemClicked."+a.namespace,b.item.serialDataItem.dataContext)},n=function(a){i.dataProvider=a,b(function(){i.validateData()})},o=function(a){angular.isUndefined(a)&&(a=d.getResponseTypeFormat());var b=[],c=[.2,.3,.4,.6,.6],f=0;for(var g in a)b.push({responseTime:g,count:a[g],color:e[f],alpha:c[f++]});return b},a.$on("responseTimeChartDirective.initAndRenderWithData."+a.namespace,function(a,b,c,d,e,f){j(),k(c,d),l(o(b),e,f)}),a.$on("responseTimeChartDirective.updateData."+a.namespace,function(a,b){n(o(b))})}}}])}(),function(){"use strict";pinpointApp.constant("loadChartDirectiveConfig",{}),pinpointApp.directive("loadChartDirective",["loadChartDirectiveConfig","$timeout","AnalyticsService","PreferenceService",function(a,b,c,d){var e=d.getResponseTypeColor();return{template:'
',replace:!0,restrict:"EA",scope:{namespace:"@"},link:function(a,d,f){var g,h,i,j,k,l,m,n,o,p;j=function(){g="loadId-"+a.namespace,d.attr("id",g)},k=function(a,b){a&&d.css("width",a),b&&d.css("height",b)},l=function(a,d){b(function(){var b={type:"serial",theme:"light",legend:{autoMargins:!1,align:"right",borderAlpha:0,equalWidths:!0,horizontalGap:0,verticalGap:0,markerSize:10,useGraphSettings:!1,valueWidth:0,spacing:0,markerType:"circle",position:"top"},dataProvider:a,valueAxes:[{stackType:"regular",axisAlpha:1,usePrefixes:!0,gridAlpha:.1}],categoryField:"time",categoryAxis:{startOnAxis:!0,gridPosition:"start",labelFunction:function(a,b,c){var d=a.indexOf("-"),e=a.indexOf(" ");return a.substring(d+1,e)+"\n"+a.substring(e+1)}},balloon:{fillAlpha:1,borderThickness:1},graphs:[{balloonText:"[[title]] : [[value]]",fillAlphas:.2,fillColors:e[0],lineAlpha:.8,lineColor:"#787779",title:h[0],type:"step",legendColor:e[0],valueField:h[0]},{balloonText:"[[title]] : [[value]]",fillAlphas:.3,fillColors:e[1],lineAlpha:.8,lineColor:"#787779",title:h[1],type:"step",legendColor:e[1],valueField:h[1]},{balloonText:"[[title]] : [[value]]",fillAlphas:.4,fillColors:e[2],lineAlpha:.8,lineColor:"#787779",title:h[2],type:"step",legendColor:e[2],valueField:h[2]},{balloonText:"[[title]] : [[value]]",fillAlphas:.6,fillColors:e[3],lineAlpha:.8,lineColor:"#787779",title:h[3],type:"step",legendColor:e[3],valueField:h[3]},{balloonText:"[[title]] : [[value]]",fillAlphas:.6,fillColors:e[4],lineAlpha:.8,lineColor:"#787779",title:h[4],type:"step",legendColor:e[4],valueField:h[4]}]};d&&(b.chartCursor={cursorPosition:"mouse",categoryBalloonAlpha:.7,categoryBalloonDateFormat:"H:NN"}),i=AmCharts.makeChart(g,b),i.addListener("clickGraph",function(a){c.send(c.CONST.MAIN,c.CONST.CLK_LOAD_GRAPH)})})},o=function(a,c){b(function(){var b={type:"serial",pathToImages:"./components/amcharts/images/",theme:"light",dataProvider:a,valueAxes:[{stackType:"regular",axisAlpha:0,gridAlpha:0,labelsEnabled:!1}],categoryField:"time",categoryAxis:{startOnAxis:!0,gridPosition:"start",labelFunction:function(a,b,c){return moment(a).format("HH:mm")}},chartScrollbar:{graph:"AmGraph-1"},graphs:[{id:"AmGraph-1",fillAlphas:.2,fillColors:e[0],lineAlpha:.8,lineColor:"#787779",type:"step",valueField:h[0]},{id:"AmGraph-2",fillAlphas:.3,fillColors:e[1],lineAlpha:.8,lineColor:"#787779",type:"step",valueField:h[1]},{id:"AmGraph-3",fillAlphas:.4,fillColors:e[2],lineAlpha:.8,lineColor:"#787779",type:"step",valueField:h[2]},{id:"AmGraph-4",fillAlphas:.6,fillColors:e[3],lineAlpha:.8,lineColor:"#787779",type:"step",valueField:h[3]},{id:"AmGraph-5",fillAlphas:.6,fillColors:e[4],lineAlpha:.8,lineColor:"#787779",type:"step",valueField:h[4]}]};c&&(b.chartCursor={avoidBalloonOverlapping:!1}),i=AmCharts.makeChart(g,b),i.addListener("changed",function(a){})})},p=function(){d.append("

No Data

")},n=function(a){angular.isUndefined(i)?0!==a.length&&l(a,!0):(i.dataProvider=a,b(function(){i.validateData()}))},m=function(a){function b(a){for(var b in c)if(moment(a).format("YYYY-MM-DD HH:mm")===c[b].time)return b;return-1}if(angular.isUndefined(a))return[];h=[];for(var c=[],d=0;d-1)c[i][e.key]=g[1];else{var j={time:moment(g[0]).format("YYYY-MM-DD HH:mm")};j[e.key]=g[1],c.push(j)}}}return c},a.$on("loadChartDirective.initAndRenderWithData."+a.namespace,function(a,b,c,d,e){j(),k(c,d);var f=m(b);0===f.length?p():l(f,e)}),a.$on("loadChartDirective.updateData."+a.namespace,function(a,b){n(m(b))}),a.$on("loadChartDirective.initAndSimpleRenderWithData."+a.namespace,function(a,b,c,d,e){j(),k(c,d);var f=m(b);0===f.length?p():o(f,e)})}}}])}(),function(){"use strict";angular.module("pinpointApp").directive("jvmMemoryChartDirective",["$timeout",function(a){return{template:"
",replace:!0,restrict:"E",scope:{namespace:"@"},link:function(b,c,d){var e,f,g,h,i,j,k;g=function(){e="multipleValueAxesId-"+b.namespace,c.attr("id",e)},h=function(a,b){a&&c.css("width",a),b&&c.css("height",b)},i=function(c){var d={type:"serial",theme:"light",autoMargins:!1,marginTop:10,marginLeft:70,marginRight:70,marginBottom:30,legend:{useGraphSettings:!0,autoMargins:!1,align:"right",position:"top",valueWidth:70},usePrefixes:!0,dataProvider:c,valueAxes:[{id:"v1",gridAlpha:0,axisAlpha:1,position:"right",title:"Full GC (ms)",minimum:0},{id:"v2",gridAlpha:0,axisAlpha:1,position:"left",title:"Memory (bytes)",minimum:0}],graphs:[{valueAxis:"v2",balloonText:"[[value]]B",legendValueText:"[[value]]B",lineColor:"rgb(174, 199, 232)",title:"Max",valueField:"Max",fillAlphas:0,connect:!1},{valueAxis:"v2",balloonText:"[[value]]B",legendValueText:"[[value]]B",lineColor:"rgb(31, 119, 180)",fillColor:"rgb(31, 119, 180)",title:"Used",valueField:"Used",fillAlphas:.4,connect:!1},{valueAxis:"v1",balloonFunction:function(a,b){var c=a.serialDataItem.dataContext,d=c.FGCTime+"ms",e=c.FGCCount;return e>1&&(d+=" ("+e+")"),d},legendValueText:"[[value]]ms",lineColor:"#FF6600",title:"FGC",valueField:"FGCTime",type:"column",fillAlphas:.3,connect:!1}],chartCursor:{categoryBalloonAlpha:.7,fullWidth:!0,cursorAlpha:.1},categoryField:"time",categoryAxis:{axisColor:"#DADADA",startOnAxis:!0,gridPosition:"start",labelFunction:function(a,b,c){return a.substring(a.indexOf(" ")+1)}}};a(function(){f=AmCharts.makeChart(e,d),f.chartCursor.addListener("changed",function(a){b.$emit("jvmMemoryChartDirective.cursorChanged."+b.namespace,a)})})},j=function(a){a?(angular.isNumber(a)&&(a=f.dataProvider[a].time),f.chartCursor.showCursorAt(a)):f.chartCursor.hideCursor()},k=function(){f&&(f.validateNow(),f.validateSize())},b.$on("jvmMemoryChartDirective.initAndRenderWithData."+b.namespace,function(a,b,c,d){g(),h(c,d),i(b)}),b.$on("jvmMemoryChartDirective.showCursorAt."+b.namespace,function(a,b){j(b)}),b.$on("jvmMemoryChartDirective.resize."+b.namespace,function(a){k()})}}}])}(),function(){"use strict";angular.module("pinpointApp").directive("cpuLoadChartDirective",["$timeout",function(a){return{template:"
",replace:!0,restrict:"E",scope:{namespace:"@"},link:function(b,c,d){var e,f,g,h,i,j,k;g=function(){e="multipleValueAxesId-"+b.namespace,c.attr("id",e)},h=function(a,b){a&&c.css("width",a),b&&c.css("height",b)},i=function(c){var d={type:"serial",theme:"light",autoMargins:!1,marginTop:10,marginLeft:70,marginRight:70,marginBottom:30,legend:{useGraphSettings:!0,autoMargins:!0,align:"right",position:"top",valueWidth:70},usePrefixes:!0,dataProvider:c,valueAxes:[{id:"v1",gridAlpha:0,axisAlpha:1,position:"left",title:"Cpu Usage (%)",maximum:100,minimum:0}],graphs:[{valueAxis:"v1",balloonText:"[[value]]%",legendValueText:"[[value]]%",lineColor:"rgb(31, 119, 180)",fillColor:"rgb(31, 119, 180)",title:"JVM",valueField:"jvmCpuLoad",fillAlphas:.4,connect:!1},{valueAxis:"v1",balloonText:"[[value]]%",legendValueText:"[[value]]%",lineColor:"rgb(174, 199, 232)",fillColor:"rgb(174, 199, 232)",title:"System",valueField:"systemCpuLoad",fillAlphas:.4,connect:!1},{valueAxis:"v1",showBalloon:!1,lineColor:"#FF6600",title:"Max",valueField:"maxCpuLoad",fillAlphas:0,visibleInLegend:!1}],chartCursor:{categoryBalloonAlpha:.7,fullWidth:!0,cursorAlpha:.1},categoryField:"time",categoryAxis:{axisColor:"#DADADA",startOnAxis:!0,gridPosition:"start",labelFunction:function(a,b,c){return moment(a).format("HH:mm:ss")}}};a(function(){f=AmCharts.makeChart(e,d),f.chartCursor.addListener("changed",function(a){b.$emit("cpuLoadChartDirective.cursorChanged."+b.namespace,a)})})},j=function(a){a?(angular.isNumber(a)&&(a=f.dataProvider[a].time),f.chartCursor.showCursorAt(a)):f.chartCursor.hideCursor()},k=function(){f&&(f.validateNow(),f.validateSize())},b.$on("cpuLoadChartDirective.initAndRenderWithData."+b.namespace,function(a,b,c,d){g(),h(c,d),i(b)}),b.$on("cpuLoadChartDirective.showCursorAt."+b.namespace,function(a,b){j(b)}),b.$on("cpuLoadChartDirective.resize."+b.namespace,function(a){k()})}}}])}(),function(){"use strict";angular.module("pinpointApp").directive("tpsChartDirective",["$timeout",function(a){return{template:"
",replace:!0,restrict:"E",scope:{namespace:"@"},link:function(b,c,d){var e,f,g,h,i,j,k;g=function(){e="multipleValueAxesId-"+b.namespace,c.attr("id",e)},h=function(a,b){a&&c.css("width",a),b&&c.css("height",b)},i=function(c){var d={type:"serial",theme:"light",autoMargins:!1,marginTop:10,marginLeft:70,marginRight:70,marginBottom:30,legend:{useGraphSettings:!0,autoMargins:!0,align:"right",position:"top",valueWidth:70},usePrefixes:!0,dataProvider:c,valueAxes:[{stackType:"regular",gridAlpha:0,axisAlpha:1,position:"left",title:"TPS",minimum:0}],graphs:[{balloonText:"Sampled Continuation : [[value]]",legendValueText:"[[value]]",lineColor:"rgb(214, 141, 8)",fillColor:"rgb(214, 141, 8)",title:"S.C",valueField:"sampledContinuationTps",fillAlphas:.4,connect:!0},{balloonText:"Sampled New : [[value]]",legendValueText:"[[value]]",lineColor:"rgb(252, 178, 65)",fillColor:"rgb(252, 178, 65)",title:"S.N",valueField:"sampledNewTps",fillAlphas:.4,connect:!0},{balloonText:"Unsampled Continuation : [[value]]",legendValueText:"[[value]]",lineColor:"rgb(90, 103, 166)",fillColor:"rgb(90, 103, 166)",title:"U.C",valueField:"unsampledContinuationTps",fillAlphas:.4,connect:!0},{balloonText:"Unsampled New : [[value]]",legendValueText:"[[value]]",lineColor:"rgb(160, 153, 255)",fillColor:"rgb(160, 153, 255)",title:"U.N",valueField:"unsampledNewTps",fillAlphas:.4,connect:!0},{balloonText:"Total : [[value]]",legendValueText:"[[value]]",lineColor:"rgba(31, 119, 180, 0)",fillColor:"rgba(31, 119, 180, 0)",valueField:"totalTps",fillAlphas:.4,connect:!0}],chartCursor:{categoryBalloonAlpha:.7,fullWidth:!0,cursorAlpha:.1},categoryField:"time",categoryAxis:{axisColor:"#DADADA",startOnAxis:!0,gridPosition:"start",labelFunction:function(a,b,c){return moment(a).format("HH:mm:ss")}}};a(function(){f=AmCharts.makeChart(e,d),f.chartCursor.addListener("changed",function(a){b.$emit("tpsChartDirective.cursorChanged."+b.namespace,a)})})},j=function(a){a?(angular.isNumber(a)&&(a=f.dataProvider[a].time),f.chartCursor.showCursorAt(a)):f.chartCursor.hideCursor()},k=function(){f&&(f.validateNow(),f.validateSize())},b.$on("tpsChartDirective.initAndRenderWithData."+b.namespace,function(a,b,c,d){g(),h(c,d),i(b)}),b.$on("tpsChartDirective.showCursorAt."+b.namespace,function(a,b){j(b)}),b.$on("tpsChartDirective.resize."+b.namespace,function(a){k()})}}}])}(),function(){"use strict";pinpointApp.directive("loadingDirective",["$timeout","$templateCache","$compile",function(a,b,c){return{restrict:"A",scope:{showLoading:"=loadingDirective",loadingMessage:"@"},link:function(a,d,e){a.loadingMessage||(a.loadingMessage="Please Wait...");var f=b.get(e.loadingDirective);"static"===d.css("position")&&d.css("position","relative"),d.append(c(f)(a))}}}])}(),function(a){"use strict";pinpointApp.constant("ConfigurationConfig",{menu:{GENERAL:"general",ALARM:"alarm",HELP:"help"}}),pinpointApp.controller("ConfigurationCtrl",["$scope","$element","ConfigurationConfig","AnalyticsService",function(b,c,d,e){b.selectMember=!0,b.currentTab=d.menu.GENERAL; +for(var f in d.menu)!function(a){var c="is"+a.substring(0,1).toUpperCase()+a.substring(1).toLowerCase();b[c]=function(){return b.currentTab==d.menu[a]}}(f);a(c).on("hidden.bs.modal",function(a){b.currentTab=d.menu.GENERAL,b.$broadcast("configuration.alarm.initClose"),b.$broadcast("configuration.general.initClose")}),b.setCurrentTab=function(a){if(b.currentTab!=a)switch(b.currentTab=a,a){case d.menu.GENERAL:e.send(e.CONST.MAIN,e.CONST.CLK_GENERAL),b.$broadcast("general.configuration.show");break;case d.menu.ALARM:e.send(e.CONST.MAIN,e.CONST.CLK_ALARM),b.$broadcast("alarmUserGroup.configuration.show");break;case d.menu.HELP:e.send(e.CONST.MAIN,e.CONST.CLK_HELP)}},b.getMemberButtonStyle=function(){return b.selectMember?"btn-primary":"btn-default"},b.getAlarmButtonStyle=function(){return b.selectMember?"btn-default":"btn-primary"},b.showMember=function(){b.selectMember=!0},b.showAlarm=function(){b.selectMember=!1},b.$on("configuration.show",function(){e.send(e.CONST.MAIN,e.CONST.CLK_CONFIGURATION),c.modal("show")})}])}(jQuery),function(a){"use strict";pinpointApp.controller("HelpCtrl",["$scope","$element",function(a,b){a.enHelpList=[{title:"Quick start guide",link:"https://github.com/naver/pinpoint/blob/master/quickstart/README.md"},{title:"Technical Overview of Pinpoint",link:"https://github.com/naver/pinpoint/wiki/Technical-Overview-Of-Pinpoint"},{title:"Using Pinpont with Docker",link:"http://yous.be/2015/05/05/using-pinpoint-with-docker/"},{title:"Notes on Jetty Plugin for Pinpoint ",link:"https://github.com/cijung/Docs/blob/master/JettyPluginNotes.md"},{title:"About Alarm",link:"https://github.com/naver/pinpoint/blob/master/doc/alarm.md#alarm"}],a.koHelpList=[{title:"Pinpoint 개발자가 작성한 Pinpoint 기술문서",link:"http://helloworld.naver.com/helloworld/1194202"},{title:"소개 및 설치 가이드",link:"http://dev2.prompt.co.kr/33"},{title:"Pinpoint 사용 경험",link:"http://www.barney.pe.kr/blog/category/development/page/2/"},{title:"설치 가이드 동영상 강좌 1",link:"https://www.youtube.com/watch?v=hrvKaEaDEGs"},{title:"설치 가이드 동영상 강좌 2",link:"https://www.youtube.com/watch?v=fliKPGHGXK4"},{title:"AWS Ubuntu 14.04 설치 가이드 ",link:"http://lky1001.tistory.com/132"},{title:"Alarm 가이드",link:"https://github.com/naver/pinpoint/blob/master/doc/alarm.md#alarm-1"}]}])}(jQuery),function(a){"use strict";pinpointApp.constant("GeneralConfig",{menu:{GENERAL:"general",ALRAM:"alram"}}),pinpointApp.controller("GeneralCtrl",["GeneralConfig","$scope","$rootScope","$element","$document","PreferenceService","AnalyticsService","helpContentService",function(a,b,c,d,e,f,g,h){function i(a){g.send(g.CONST.MAIN,g.CONST.CLK_GENERAL_SET_FAVORITE),f.addFavorite(a),b.$apply(function(){b.savedFavoriteList=f.getFavoriteList(),c.$broadcast("navbarDirective.changedFavorite")})}function j(a){if(!a.id)return a.text;var b=a.text.split("@");if(b.length>1){var c=e.get(0).createElement("img");return c.src="/images/icons/"+b[1]+".png",c.style.height="25px",c.style.paddingRight="3px",c.outerHTML+b[0]}return a.text}function k(){var a=!1;l.select2({placeholder:"Select an application.",searchInputPlaceholder:"Input your application name.",allowClear:!1,formatResult:j,formatSelection:j,escapeMarkup:function(a){return a}}).on("select2-selecting",function(b){a=!0}).on("select2-close",function(b){a===!0&&setTimeout(function(){i(l.select2("val"))},0),a=!1}),m.on("hide.bs.dropdown",function(a){n===!1&&(a.preventDefault(),n=!1)}),m.on("click",function(){n=!1})}d.find("div.general-warning").html(h.configuration.general.warning),d.find("div.favorite-empty").html(h.configuration.general.empty),b.$on("general.configuration.show",function(){}),b.depthList=f.getDepthList(),b.periodTypes=f.getPeriodTypes(),b.caller=f.getCaller(),b.callee=f.getCallee(),b.period=f.getPeriod(),b.savedFavoriteList=f.getFavoriteList();var l=d.find(".applicationList"),m=d.find(".inout-bound"),n=!1;b.changeCaller=function(a){b.caller=a,g.send(g.CONST.MAIN,g.CONST.CLK_GENERAL_SET_DEPTH,b.caller),f.setCaller(b.caller)},b.changeCallee=function(a){b.callee=a,g.send(g.CONST.MAIN,g.CONST.CLK_GENERAL_SET_DEPTH,b.callee),f.setCallee(b.callee)},b.changePeriod=function(){g.send(g.CONST.MAIN,g.CONST.CLK_GENERAL_SET_PERIOD,b.period),f.setPeriod(b.period)},b.removeFavorite=function(a){g.send(g.CONST.MAIN,g.CONST.CLK_GENERAL_SET_FAVORITE),f.removeFavorite(a),b.savedFavoriteList=f.getFavoriteList(),c.$broadcast("navbarDirective.changedFavorite")},b.closeInOut=function(){n=!0,m.trigger("click.bs.dropdown")},b.$on("configuration.general.applications.set",function(a,c){b.applications=c,k()}),b.$on("configuration.general.initClose",function(){b.closeInOut()})}])}(jQuery),function(a){"use strict";pinpointApp.directive("alarmUserGroupDirective",["$rootScope","$timeout","helpContentService","AlarmUtilService","AlarmBroadcastService","AnalyticsService",function(f,g,h,i,j,k){return{restrict:"EA",replace:!0,templateUrl:"features/configuration/alarm/alarmUserGroup.html?v="+G_BUILD_TIME,scope:!0,link:function(f,g){function h(a){i.show(z),i.sendCRUD("getUserGroupList",a,function(a){v=f.userGroupList=a,i.setTotal(x,v.length),j.sendSelectionEmpty(),u===!1&&j.sendLoadPinpointUser(),u=!0,i.hide(z)},p)}function l(a){a.find(b.DIV_NORMAL).hasClass("hide-me")||(o(),m(i.extractID(a)),j.sendReloadWithUserGroupID(a.find(".contents").html()))}function m(b){a("#"+f.prefix+s).removeClass("selected"),a("#"+f.prefix+b).addClass("selected"),s=b}function n(a){return i.extractID(t)===i.extractID(a)}function o(){c.cancelAction(i,A),e.cancelAction(i,t),d.cancelAction(i,t)}function p(a){y.find(".message").html(a.errorMessage),i.hide(z),i.show(y)}function q(){c.applyAction(i,A,z,function(a,b){v.push({id:b,number:a.number}),f.userGroupList=v,i.setTotal(x,v.length)},p)}function r(){e.applyAction(i,t,z,function(a,b){return i.hasDuplicateItem(v,function(c){return c.number!=a&&c.id==b||c.number==a&&c.id==b})},function(a,b){k.send(k.CONST.MAIN,k.CONST.CLK_ALARM_CREATE_USER_GROUP);for(var c=0;c0}function n(a){i.show(u),i.sendCRUD("getGroupMemberListInGroup",{userGroupId:w},function(a){y=a,e.groupMemberList=y,i.setTotal(t,y.length),i.hide(u),j.sendGroupMemberLoaded(y)},h)}function o(a){return i.extractID(x)===i.extractID(a)}function p(a){for(var b=0;b=0;c++,d--)a[c]=y[d];y=a,e.groupMemberList=y}},e.onCloseAlert=function(){i.closeAlert(v,u)},e.$on("alarmGroupMember.configuration.load",function(a,b,c){w=b,g(),l(),i.hide(s),n(c)}),e.$on("alarmGroupMember.configuration.selectNone",function(){w="",l(),i.show(s)}),e.$on("alarmGroupMember.configuration.addUser",function(a,d){return""===w?void j.sendCallbackAddedUser(!1):(g(),void c.applyAction(i,d,w,u,m,function(a){k.send(k.CONST.MAIN,k.CONST.CLK_ALARM_ADD_USER),e.groupMemberList.push({name:a.name,memberId:a.userId,department:a.department,userGroupId:w}),j.sendCallbackAddedUser(!0),i.setTotal(t,y.length),i.hide(u)},function(){h({message:b.EXIST_A_SAME}),j.sendCallbackAddedUser(!0)}))}),e.$on("alarmGroupMember.configuration.updateUser",function(a,b){m(b.userId)&&(g(),q(b))}),e.$on("alarmGroupMember.configuration.removeUser",function(a,b){m(b)&&(g(),p(b))})}}}]);var b={EXIST_A_SAME:"Exist a same user in the lists.",DIV_NORMAL:"div._normal",DIV_EDIT:"div._edit",DIV_REMOVE:"div._remove"},c={applyAction:function(a,b,c,d,e,f,g){a.show(d),e(b.userId)===!0?g():a.sendCRUD("addMemberInGroup",{userGroupId:c,memberId:b.userId},function(c){f(b),a.hide(d)},function(a){g(a)})}},d={_bIng:!1,onAction:function(a,c){this._bIng=!0,a.hide(c.find(b.DIV_NORMAL)),a.show(c.find(b.DIV_REMOVE))},cancelAction:function(a,c){this._bIng===!0&&(a.hide(c.find(b.DIV_REMOVE)),a.show(c.find(b.DIV_NORMAL)),this._bIng=!1)},applyAction:function(a,b,c,d,e,f){a.show(d);var g=this,h=a.extractID(c);a.sendCRUD("removeMemberInGroup",{userGroupId:b,memberId:h},function(b){e(h),g.cancelAction(a,c),a.hide(d)},function(a){f(a)})}}}(jQuery),function(a){"use strict";pinpointApp.directive("alarmPinpointUserDirective",["$rootScope","$timeout","helpContentTemplate","helpContentService","AlarmUtilService","AlarmBroadcastService","AnalyticsService","globalConfig",function(f,g,h,i,j,k,l,m){return{restrict:"EA",replace:!0,templateUrl:"features/configuration/alarm/alarmPinpointUser.html?v="+G_BUILD_TIME,scope:!0,link:function(f,g){function h(){c.cancelAction(s),d.cancelAction(j,D)}function i(a){B.find(".message").html(a.errorMessage),j.hide(A),j.show(B)}function n(b){j.show(A),j.sendCRUD("getPinpointUserList",b||{},function(b){a.each(b,function(a,b){b.has=!1}),G=f.pinpointUserList=b,j.setTotal(z,o()),j.hide(A)},i)}function o(){return H.length+"/"+G.length}function p(a){for(var b=0;b=0;e--)c.prepend(E[e]);E[0].find("input").attr("disabled",""),j.hide(E[d].find(b.DIV_EDIT)),j.show(E[d].find(b.DIV_ADD)),a.each(E,function(a,b){j.show(b)}),E[0].focus()}function r(c){for(var d=E.length-1,e=d;e>=0;e--)D.after(E[e]);E[0].find("input").val(c.userId),E[1].find("input").val(c.name),E[2].find("input").val(c.department),E[3].find("input").val(c.phoneNumber),E[4].find("input").val(c.email),E[0].find("input").attr("disabled","disabled"),j.hide(E[d].find(b.DIV_ADD)),j.show(E[d].find(b.DIV_EDIT)),a.each(E,function(a,b){j.show(b)}),E[0].find("input").focus()}function s(){a.each(E,function(a,b){j.hide(b),b.find("input").val("")})}function t(){var b=a.trim(E[0].find("input").val()),c=a.trim(E[1].find("input").val()),d=a.trim(E[2].find("input").val()),e=a.trim(E[3].find("input").val()),f=a.trim(E[4].find("input").val()),g={userId:b,name:c,department:d,phoneNumber:e,email:f};return g}function u(a){return j.extractID(D)===j.extractID(a)}function v(a){for(var b=0;bH.length,H=b,j.setTotal(z,o()),j.hide(A)}),f.onCloseAlert=function(){j.closeAlert(B,A)},f.$on("alarmPinpointUser.configuration.load",function(a,b){h(),F===!1&&n({department:"OxygenTF"})})}}}]);var b={INPUT_USERID_AND_NAME:"Input user id and name",INPUT_PHONE_OR_EMAIL:"Input phone number or email",YOU_CAN_ONLY_INPUT_NUMBERS:"You can only input numbers",INVALID_EMAIL_FORMAT:"Invalid email format.",DIV_NORMAL:"div._normal",DIV_REMOVE:"div._remove",DIV_ADD:"div._add",DIV_EDIT:"div._edit"},c={_bIng:!1,isOn:function(){return this._bIng},onAction:function(a){this._bIng=!0,a()},cancelAction:function(a){this._bIng===!0&&(a(),this._bIng=!1)},applyAction:function(a,c,d,e,f){var g=this;return a.show(d),""===c.userId||""===c.name?void f({errorMessage:b.INPUT_USERID_AND_NAME}):""===c.phoneNumber&&""===c.email?void f({errorMessage:b.INPUT_PHONE_OR_EMAIL}):""!==c.phoneNumber&&validatePhone(c.phoneNumber)?void f({errorMessage:b.YOU_CAN_ONLY_INPUT_NUMBERS}):""!==c.email&&validateEmail(c.email)?void f({errorMessage:b.INVALID_EMAIL_FORMAT}):void a.sendCRUD("createPinpointUser",c,function(b){c.number=b.number,e(c),g.cancelAction(function(){}),a.hide(d)},function(a){f(a)})}},d={_bIng:!1,isOn:function(){return this._bIng},onAction:function(a,c){this._bIng=!0,c.addClass("remove"),a.hide(c.find(b.DIV_NORMAL)),a.show(c.find(b.DIV_REMOVE))},cancelAction:function(a,c){this._bIng===!0&&(c.removeClass("remove"),a.hide(c.find(b.DIV_REMOVE)),a.show(c.find(b.DIV_NORMAL)),this._bIng=!1)},applyAction:function(a,b,c,d,e){var f=this,g=a.extractID(b);a.sendCRUD("removePinpointUser",{userId:g},function(e){d(g),f.cancel(a,b),a.hide(c)},function(a){e(a)})}},e={_bIng:!1,isOn:function(){return this._bIng},onAction:function(a,b,c){this._bIng=!0,a.hide(b),c(a.extractID(b))},cancelAction:function(a,b,c){this._bIng===!0&&(c(),a.show(b),this._bIng=!1)},applyAction:function(a,c,d,e,f,g){var h=this;return a.show(e),""===c.name?void g({errorMessage:b.INPUT_USERID_AND_NAME}):""===c.phoneNumber&&""===c.email?void g({errorMessage:b.INPUT_PHONE_OR_EMAIL}):""!==c.phoneNumber&&validatePhone(c.phoneNumber)?void g({errorMessage:b.YOU_CAN_ONLY_INPUT_NUMBERS}):""!==c.email&&validateEmail(c.email)?void g({errorMessage:b.INVALID_EMAIL_FORMAT}):void a.sendCRUD("updatePinpointUser",c,function(b){h.cancelAction(a,d,function(){}),f(c),a.hide(e)},function(a){g(a)})}}}(jQuery),function(a){"use strict";pinpointApp.directive("alarmRuleDirective",["$rootScope","$document","$timeout","AlarmUtilService","AnalyticsService","TooltipService",function(f,g,h,i,j,k){return{restrict:"EA",replace:!0,templateUrl:"features/configuration/alarm/alarmRule.html?v="+G_BUILD_TIME,scope:!0,link:function(f,h){function k(){c.cancelAction(v),d.cancelAction(i,E,v),e.cancelAction(i,E,C)}function l(a){return i.extractID(E)===i.extractID(a)}function m(){k()}function n(a){D.find(".message").html(a.errorMessage),i.hide(B),i.show(D)}function o(){i.show(B),i.sendCRUD("getRuleList",{userGroupId:F},function(a){G=!0,H=a,f.ruleList=a,i.setTotal(A,H.length),i.hide(B)},n)}function p(){f.ruleSets.length>1||i.sendCRUD("getRuleSet",{},function(b){a.each(b,function(a,b){f.ruleSets.push({text:b})}),s()},n)}function q(a){if(!a.id)return a.text;var b=a.text.split("@");if(b.length>1){var c=g.get(0).createElement("img");return c.src="/images/icons/"+b[1]+".png",c.style.height="25px",c.style.paddingRight="3px",c.outerHTML+b[0]}return a.text}function r(){y.find("select[name=application]").select2({placeholder:"Select an application.",searchInputPlaceholder:"Input your application name.",allowClear:!1,formatResult:q,formatSelection:q,escapeMarkup:function(a){return a}}).on("change",function(a){})}function s(){y.find("select[name=rule]").select2({searchInputPlaceholder:"Input your rule name.",placeholder:"Select an rule.",allowClear:!1,formatResult:q,formatSelection:q,escapeMarkup:function(a){return a}}).on("change",function(a){})}function t(){z.find("tbody").prepend(C[1]).prepend(C[0]),i.hide(C[0].find(b.DIV_EDIT)),i.show(C[0].find(b.DIV_ADD)),a.each(C,function(a,b){i.show(b)})}function u(c){i.hide(C[0].find(b.DIV_ADD)),i.show(C[0].find(b.DIV_EDIT)),C[0].find("select[name=application]").select2("val",c.applicationId+"@"+c.serviceType),C[0].find("select[name=rule]").select2("val",c.checkerName),C[0].find("input[name=threshold]").val(c.threshold),C[0].find("select[name=type]").val(function(){return c.smsSend&&c.emailSend?"all":c.smsSend?"sms":c.emailSend?"email":""}()),C[1].find("input").val(c.notes),a.each(C,function(a,b){i.show(b)})}function v(){a.each(C,function(a,b){i.hide(b)}),C[0].find("select[name=application]").select2("val",""),C[0].find("select[name=rule]").select2("val",""),C[0].find("input[name=threshold]").val("1"),C[0].find("select[name=type]").val("all"),C[1].find("input").val("")}function w(a){var b=C[0].find("select[name=application]").select2("val").split("@"),c=C[0].find("select[name=type]").val(),d={applicationId:b[0],serviceType:b[1],userGroupId:F,checkerName:C[0].find("select[name=rule]").select2("val"),threshold:C[0].find("input[name=threshold]").val(),smsSend:"all"===c||"sms"===c,emailSend:"all"===c||"email"===c,notes:C[1].find("input").val()};return angular.isUndefined(a)===!1&&(d.ruleId=a),d}function x(a){for(var b=0;b
',chartDirective:Handlebars.compile('')},css:{borderWidth:2,height:180,navbarHeight:70,titleHeight:30},sumChart:{width:260,height:120},otherChart:{width:120,height:60},"const":{MIN_Y:10}}),pinpointApp.controller("RealtimeChartCtrl",["RealtimeChartCtrlConfig","$scope","$element","$rootScope","$compile","$timeout","$window","globalConfig","$location","RealtimeWebsocketService","AnalyticsService","TooltipService",function(b,c,d,e,f,g,h,i,j,k,l,m){function n(){O=d.find("div.agent-sum-chart"),P=d.find("div.agent-sum-chart div:first-child span:first-child"),Q=d.find("div.agent-sum-chart div:first-child span:last-child"),R=d.find("div.agent-chart-list"),S=d.find(".connection-message"),T=d.find(".handle .glyphicon"),U=d.find(".glyphicon-pushpin"),S.hide(),P.html(""),Q.html("0")}function o(){q("sum")===!1&&(O.append(f(b.template.chartDirective({width:b.sumChart.width,height:b.sumChart.height,namespace:"sum",chartColor:"sumChartColor",xAxisCount:W,showExtraInfo:"true",timeoutMaxCount:V}))(c)),_.sum=-1)}function p(){angular.isDefined(_.sum)?(_={},_.sum=-1):_={}}function q(a){return angular.isDefined(_[a])}function r(d){var e=a(b.template.agentChart).append(f(b.template.chartDirective({width:b.otherChart.width,height:b.otherChart.height,namespace:$.length,chartColor:"agentChartColor",xAxisCount:W,showExtraInfo:"false",timeoutMaxCount:V}))(c));R.append(e),x(d,$.length),$.push(e)}function s(){var a=k.open({onopen:function(a){E()},onmessage:function(a){t(a)},onclose:function(a){c.$apply(function(){I()})},ondelay:function(){k.close()},retry:function(){c.retryConnection()}});a&&o()}function t(a){switch(S.hide(),a[b.keys.TYPE]){case b.values.PING:k.send(ga);break;case b.values.RESPONSE:var c=a[b.keys.RESULT];if(c[b.keys.APPLICATION_NAME]!==Z)return;var d=c[b.keys.ACTIVE_THREAD_COUNTS],e=B(d);C(e),u(d,e,c[b.keys.TIME_STAMP])}}function u(a,d,e){var f=Math.max(D(),b["const"].MIN_Y),g=0,h=!0;for(var i in a)w(i,g),a[i][b.keys.CODE]===X?(h=!1,c.$broadcast("realtimeChartDirective.onData."+_[i],a[i][b.keys.STATUS],e,f,h)):c.$broadcast("realtimeChartDirective.onError."+_[i],a[i],e,f),z(g),g++;c.$broadcast("realtimeChartDirective.onData.sum",d,e,f,h),Q.html(g)}function v(a){return ha[b.keys.PARAMETERS][b.keys.APPLICATION_NAME]=a,JSON.stringify(ha)}function w(a,b){q(a)===!1&&(y(b)?x(a,b):r(a)),A(b,a)}function x(a,b){_[a]=b}function y(a){return $.length>a}function z(a){$[a].show()}function A(a,b){$[a].find("div").html(b)}function B(a){var c=[0,0,0,0];for(var d in a)a[d][b.keys.CODE]===X&&jQuery.each(a[d][b.keys.STATUS],function(a,b){c[a]+=b});return c}function C(a){aa.push(a.reduce(function(a,b){return a+b})),aa.length>W&&aa.shift()}function D(){return d3.max(aa,function(a){return a})}function E(){k.send(v(Z))}function F(){k.isOpened()===!1?s():E(),ea=!0}function G(){ea=!1,k.stopReceive(v(""))}function H(){e.$broadcast("realtimeChartDirective.clear.sum"),a.each($,function(a,b){e.$broadcast("realtimeChartDirective.clear."+a),b.hide()})}function I(){S.css("background-color","rgba(200, 200, 200, 0.9)"),S.find("h4").css("color","red").html("Closed connection.

Select node again."),S.find("button").show(),S.show()}function J(){S.css("background-color","rgba(138, 171, 136, 0.5)"),S.find("h4").css("color","blue").html("Waiting Connection..."),S.find("button").hide(),S.show()}function K(){d.animate({bottom:-fa,left:0},500,function(){T.removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up")})}function L(){d.animate({bottom:0,left:0},500,function(){T.removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down")})}function M(){d.innerWidth(d.parent().width()-b.css.borderWidth+"px")}function N(){U.css("color",ba?"red":"")}d=a(d);var O,P,Q,R,S,T,U,V=10,W=10,X=0,Y="",Z="",$=[],_={},aa=[0],ba=!0,ca=!1,da=!1,ea=!0,fa=b.css.height,ga=function(){var a={};return a[b.keys.TYPE]=b.values.PONG,JSON.stringify(a)}(),ha=function(){var a={};return a[b.keys.TYPE]=b.values.REQUEST,a[b.keys.COMMAND]=b.values.ACTIVE_THREAD_COUNT,a[b.keys.PARAMETERS]={},a}(),ia=null;m.init("realtime"),c.sumChartColor=["rgba(44, 160, 44, 1)","rgba(60, 129, 250, 1)","rgba(248, 199, 49, 1)","rgba(246, 145, 36, 1)"],c.agentChartColor=["rgba(44, 160, 44, .8)","rgba(60, 129, 250, .8)","rgba(248, 199, 49, .8)","rgba(246, 145, 36, .8)"],c.requestLabelNames=["1s","3s","5s","Slow"],c.bInitialized=!1,a(document).on("visibilitychange",function(){switch(document.visibilityState){case"hidden":ia=g(function(){k.close(),ia=null},6e4);break;case"visible":null!==ia?g.cancel(ia):c.retryConnection(),ia=null}}),n(),c.$on("realtimeChartController.close",function(){K();var a=ea;c.closePopup(),ea=a,N()}),c.$on("realtimeChartController.initialize",function(a,b,d,e){ +if((ba!==!0||Y!==e)&&/^\/main/.test(j.path())!==!1&&(ca=angular.isUndefined(b)?!1:b,d=angular.isUndefined(d)?"":d,Y=e,n(),P.html(Z=d),i.useRealTime!==!1&&ea!==!1)){if(ca===!1)return void K();p(),M(),c.bInitialized=!0,L(),c.closePopup(),P.html(Z=d),J(),F(),N()}}),c.retryConnection=function(){J(),F()},c.pin=function(){ba=!ba,l.send(l.CONST.MAIN,ba?l.CONST.CLK_REALTIME_CHART_PIN_ON:l.CONST.CLK_REALTIME_CHART_PIN_OFF),N()},c.resizePopup=function(){l.send(l.CONST.MAIN,l.CONST.TG_REALTIME_CHART_RESIZE),da?(fa=b.css.height,d.css({height:b.css.height+"px",bottom:"0px"}),R.css("height","150px")):(fa=h.innerHeight-b.css.navbarHeight,d.css({height:fa+"px",bottom:"0px"}),R.css("height",fa-b.css.titleHeight+"px")),da=!da},c.closePopup=function(){G(),H(),S.hide(),P.html(Z=""),Q.html("0")},a(h).on("resize",function(){M()})}])}(jQuery),function(){"use strict";pinpointApp.controller("MainCtrl",["filterConfig","$scope","$timeout","$routeParams","locationService","NavbarVoService","$window","SidebarTitleVoService","filteredMapUtilService","$rootElement","AnalyticsService","PreferenceService",function(a,b,c,d,e,f,g,h,i,j,k,l){k.send(k.CONST.MAIN_PAGE);var m,n,o,p,q,r;b.hasScatter=!1,g.htoScatter={},n=!0,o=!1,b.sidebarLoading=!0,c(function(){m=new f,d.application&&m.setApplication(d.application),d.readablePeriod&&m.setReadablePeriod(d.readablePeriod),d.queryEndDateTime&&m.setQueryEndDateTime(d.queryEndDateTime),m.setCalleeRange(l.getCalleeByApp(d.application)),m.setCallerRange(l.getCallerByApp(d.application)),m.isRealtime()?b.$broadcast("navbarDirective.initialize.realtime.andReload",m):angular.isDefined(d.application)&&angular.isUndefined(d.readablePeriod)?b.$broadcast("navbarDirective.initialize.andReload",m):(g.$routeParams=d,m.autoCalculateByQueryEndDateTimeAndReadablePeriod(),b.$broadcast("navbarDirective.initialize",m),b.$broadcast("scatterDirective.initialize",m),b.$broadcast("serverMapDirective.initialize",m))},500),p=function(){return e.path().split("/")[1]||"main"},q=function(){var a="/"+p()+"/"+m.getApplication()+"/";m.isRealtime()?(a+=m.getPeriodType(),g.$routeParams={application:m.getApplication(),readablePeriod:m.getPeriodType()}):a+=m.getReadablePeriod()+"/"+m.getQueryEndDateTime(),e.path()!==a&&("/main"===e.path()?e.path(a).replace():e.skipReload().path(a).replace(),g.$routeParams={application:m.getApplication(),readablePeriod:m.getReadablePeriod().toString(),queryEndDateTime:m.getQueryEndDateTime().toString()},b.$$phase||b.$apply())},r=function(a,b){var c=i.getFilteredMapUrlWithFilterVo(m,a,b);g.open(c,"")},b.getMainContainerClass=function(){return o?"no-data":""},b.getInfoDetailsClass=function(){var a=[];return b.hasScatter&&a.push("has-scatter"),b.hasFilter&&a.push("has-filter"),a.join(" ")},b.$on("serverMapDirective.hasData",function(a){o=!1,b.sidebarLoading=!1}),b.$on("serverMapDirective.hasNoData",function(a){o=!0,b.sidebarLoading=!1}),b.$on("navbarDirective.changed",function(a,c){o=!1,m=c,q(m),g.htoScatter={},b.hasScatter=!1,b.sidebarLoading=!0,m.isRealtime()&&b.$broadcast("realtimeChartController.close"),b.$broadcast("sidebarTitleDirective.empty.forMain"),b.$broadcast("nodeInfoDetailsDirective.hide"),b.$broadcast("linkInfoDetailsDirective.hide"),b.$broadcast("scatterDirective.initialize",m),b.$broadcast("serverMapDirective.initialize",m),b.$broadcast("sidebarTitleDirective.empty.forMain")}),b.$on("serverMapDirective.passingTransactionResponseToScatterChart",function(a,c){b.$broadcast("scatterDirective.initializeWithNode",c)}),b.$on("serverMapDirective.nodeClicked",function(a,c,d,e,f,g){n=!0;var i=new h;i.setImageType(e.serviceType),e.isWas===!0?(b.hasScatter=!0,i.setTitle(e.applicationName),b.$broadcast("scatterDirective.initializeWithNode",e)):e.unknownNodeGroup?(i.setTitle(e.serviceType.replace("_"," ")),b.hasScatter=!1):(i.setTitle(e.applicationName),b.hasScatter=!1),b.hasFilter=!1,b.$broadcast("sidebarTitleDirective.initialize.forMain",i,e),b.$broadcast("nodeInfoDetailsDirective.initialize",c,d,e,f,m,null,g),b.$broadcast("linkInfoDetailsDirective.hide")}),b.$on("serverMapDirective.linkClicked",function(a,c,d,e,f){n=!1;var g=new h;e.unknownLinkGroup?g.setImageType(e.sourceInfo.serviceType).setTitle("Unknown Group from "+e.sourceInfo.applicationName):g.setImageType(e.sourceInfo.serviceType).setTitle(e.sourceInfo.applicationName).setImageType2(e.targetInfo.serviceType).setTitle2(e.targetInfo.applicationName),b.hasScatter=!1;var j=i.findFilterInNavbarVo(e.sourceInfo.applicationName,e.sourceInfo.serviceType,e.targetInfo.applicationName,e.targetInfo.serviceType,m);j?(b.hasFilter=!0,b.$broadcast("filterInformationDirective.initialize.forMain",j.oServerMapFilterVoService)):b.hasFilter=!1,b.$broadcast("sidebarTitleDirective.initialize.forMain",g),b.$broadcast("nodeInfoDetailsDirective.hide"),b.$broadcast("linkInfoDetailsDirective.initialize",c,d,e,f,m)}),b.$on("serverMapDirective.openFilteredMap",function(a,b,c){r(b,c)}),b.$on("linkInfoDetailsDirective.openFilteredMap",function(a,b,c){r(b,c)}),b.$on("linkInfoDetailsDirective.openFilterWizard",function(a,c,d){b.$broadcast("serverMapDirective.openFilterWizard",c,d)}),b.$on("linkInfoDetailsDirective.ResponseSummary.barClicked",function(a,b){r(b)}),b.$on("linkInfoDetailsDirective.showDetailInformationClicked",function(a,c,d){b.hasScatter=!1;var e=new h;e.setImageType(d.sourceInfo.serviceType).setTitle(d.sourceInfo.applicationName).setImageType2(d.targetInfo.serviceType).setTitle2(d.targetInfo.applicationName),b.$broadcast("sidebarTitleDirective.initialize.forMain",e),b.$broadcast("nodeInfoDetailsDirective.hide")}),b.$on("nodeInfoDetailDirective.showDetailInformationClicked",function(a,c,d){b.hasScatter=!1;var e=new h;e.setImageType(d.serviceType),d.unknownNodeGroup?(e.setTitle(d.serviceType.replace("_"," ")),b.hasScatter=!1):(e.setTitle(d.applicationName),b.hasScatter=!1),b.$broadcast("sidebarTitleDirective.initialize.forMain",e),b.$broadcast("linkInfoDetailsDirective.hide")}),b.loadingOption={hideTip:"init"},b.$watch("loadingOption.hideTip",function(a){if("init"!=a&&g.localStorage){var b=new Date;b.setDate(b.getDate()+30),g.localStorage.setItem("__HIDE_LOADING_TIP",a?b.valueOf():"-")}})}])}(),function(){"use strict";pinpointApp.controller("InspectorCtrl",["$scope","$timeout","$routeParams","locationService","NavbarVoService","AnalyticsService",function(a,b,c,d,e,f){f.send(f.CONST.INSPECTOR_PAGE);var g,h,i,j,k,l;b(function(){g=new e,c.application&&g.setApplication(c.application),c.readablePeriod&&g.setReadablePeriod(c.readablePeriod),c.queryEndDateTime&&g.setQueryEndDateTime(c.queryEndDateTime),c.agentId&&g.setAgentId(c.agentId),g.autoCalculateByQueryEndDateTimeAndReadablePeriod(),a.$emit("navbarDirective.initializeWithStaticApplication",g),a.$emit("agentListDirective.initialize",g)},500),a.$on("navbarDirective.changed",function(a,b){g=b,j()}),a.$on("agentListDirective.agentChanged",function(b,c){h=c,g.setAgentId(c.agentId),l()&&j(),h&&a.$emit("agentInfoDirective.initialize",g,h)}),i=function(){var a=d.path().split("/");return a[1]||"inspector"},j=function(){var b=k();l()&&("/inspector"===d.path()||d.skipReload().path(b).replace(),a.$emit("navbarDirective.initializeWithStaticApplication",g),a.$emit("agentListDirective.initialize",g))},k=function(){var a="/"+i()+"/"+g.getApplication()+"/"+g.getReadablePeriod()+"/"+g.getQueryEndDateTime();return g.getAgentId()&&(a+="/"+g.getAgentId()),a},l=function(){var a=k();return d.path()!==a}}])}(),function(){"use strict";pinpointApp.constant("TransactionListConfig",{applicationUrl:"/transactionmetadata.pinpoint",MAX_FETCH_BLOCK_SIZE:100}),pinpointApp.controller("TransactionListCtrl",["TransactionListConfig","$scope","$location","$routeParams","$rootScope","$timeout","$window","$http","webStorage","TimeSliderVoService","TransactionDaoService","AnalyticsService","helpContentService",function(a,b,c,d,e,f,g,h,i,j,k,l,m){l.send(l.CONST.TRANSACTION_LIST_PAGE);var n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H;f(function(){n=1,o=0,b.transactionDetailUrl="index.html#/transactionDetail",b.sidebarLoading=!0;var a=E(),c=F(),e=!angular.isUndefined(d.transactionInfo);if(e){var h=d.transactionInfo.lastIndexOf("-"),i=d.transactionInfo.lastIndexOf("-",h-1);s=[d.transactionInfo.substring(0,i),d.transactionInfo.substring(i+1,h),d.transactionInfo.substring(h+1)]}a&&c?(p=A(g.name),B(p.applicationName)?(q=C(p),G(e)):H(m.transactionList.openError.noData.replace(/\{\{application\}\}/,p.applicationName))):e===!1?H(m.transactionList.openError.noParent):(p=D(),q=[[s[1],s[2],s[0]]],G(e)),f(function(){$("#main-container").layout({north__minSize:20,north__size:(window.innerHeight-40)/2,center__maskContents:!0})},100)},100),H=function(a){alert(a),g.location.replace(g.location.href.replace("transactionList","main"))},G=function(a){r=new j,r.setTotal(q.length),t(a)},E=function(){return angular.isDefined(g.opener)},F=function(){if(angular.isUndefined(g.opener)||null===g.opener)return!1;var a=g.opener.$routeParams;if(angular.isDefined(d)&&angular.isDefined(a))if("realtime"===a.readablePeriod){if(angular.equals(d.application,a.application))return!0}else if(angular.equals(d.application,a.application)&&angular.equals(d.readablePeriod,a.readablePeriod)&&angular.equals(d.queryEndDateTime,a.queryEndDateTime))return!0;return!1},A=function(a){var b=a.split("|");return 4===b.length?{applicationName:b[0],type:b[1],min:b[2],max:b[3]}:{applicationName:b[0],nXFrom:b[1],nXTo:b[2],nYFrom:b[3],nYTo:b[4]}},D=function(){return{applicationName:d.application.split("@")[0],nXFrom:parseInt(s[1])-1e3,nXTo:parseInt(s[1])+1e3,nYFrom:0,nYTo:0}},B=function(a){return angular.isDefined(g.opener.htoScatter[a])},C=function(a){var b=g.opener.htoScatter[a.applicationName];return a.type?b.getDataByRange(a.type,a.min,a.max):b.getDataByXY(a.nXFrom,a.nXTo,a.nYFrom,a.nYTo)},w=function(a){b.$emit("transactionTableDirective.appendTransactionList",a.metadata)},x=function(){if(!q)return g.alert("Query failed - Query parameter cache deleted.\n\nPossibly due to scatter chart being refreshed."),!1;for(var b=[],c=o,d=0;c0&&b.push("&"),b=b.concat(["I",d,"=",q[c][0]]),b=b.concat(["&T",d,"=",q[c][1]]),b=b.concat(["&R",d,"=",q[c][2]]),o++;return n++,b},u=function(){y(x(),function(c){return 0===c.metadata.length?(b.$emit("timeSliderDirective.disableMore"),b.$emit("timeSliderDirective.changeMoreToDone"),!1):(c.metadata.length