mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-27 05:36:39 +10:00
update alarm ui
This commit is contained in:
@@ -96,6 +96,7 @@
|
||||
scope.onSortGroupMember = function() {
|
||||
if ( currentUserGroupId === "" ) return;
|
||||
|
||||
cancelPreviousWork();
|
||||
var oSortedGroupMemberList = [];
|
||||
var len = oGroupMemberList.length - 1;
|
||||
for( var j = 0, i = len ; i >= 0 ; j++, i-- ) {
|
||||
@@ -109,6 +110,9 @@
|
||||
scope.onCloseAlert = function() {
|
||||
alarmUtilService.closeAlert( $elAlert, $elLoading );
|
||||
};
|
||||
scope.canSort = function() {
|
||||
return currentUserGroupId === "" ? "0.5" : "1.0";
|
||||
}
|
||||
scope.$on("alarmGroupMember.configuration.load", function( event, userGroupID, willBeAddedUser ) {
|
||||
currentUserGroupId = userGroupID;
|
||||
cancelPreviousWork();
|
||||
@@ -129,12 +133,13 @@
|
||||
cancelPreviousWork();
|
||||
AddGroupMember.applyAction( alarmUtilService, oUser, currentUserGroupId, $elLoading, hasUser, function( oUser ) {
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_ADD_USER );
|
||||
scope.groupMemberList.push({
|
||||
oGroupMemberList.push({
|
||||
"name": oUser.name,
|
||||
"memberId": oUser.userId,
|
||||
"department": oUser.department,
|
||||
"userGroupId": currentUserGroupId
|
||||
});
|
||||
scope.groupMemberList = oGroupMemberList;
|
||||
alarmBroadcastService.sendCallbackAddedUser( true );
|
||||
alarmUtilService.setTotal( $elTotal, oGroupMemberList.length );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
@@ -161,11 +166,11 @@
|
||||
}
|
||||
scope.groupMemberList = oGroupMemberList;
|
||||
}
|
||||
scope.$on("alarmGroupMember.configuration.removeUser", function( event, userID ) {
|
||||
if ( hasUser( userID ) ) {
|
||||
scope.$on("alarmGroupMember.configuration.removeUser", function( event, userId ) {
|
||||
if ( hasUser( userId ) ) {
|
||||
cancelPreviousWork();
|
||||
// scope.$apply(function() {
|
||||
removeGroupMember( userID );
|
||||
removeGroupMember( userId );
|
||||
// });
|
||||
}
|
||||
});
|
||||
@@ -202,11 +207,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;
|
||||
|
||||
@@ -38,8 +38,9 @@
|
||||
return globalConfig.editUserInfo;
|
||||
};
|
||||
function cancelPreviousWork() {
|
||||
AddPinpointUser.cancelAction( hideEditArea );
|
||||
AddPinpointUser.cancelAction( aEditNode, hideEditArea );
|
||||
RemovePinpointUser.cancelAction( alarmUtilService, $workingNode );
|
||||
UpdatePinpointUser.cancelAction( alarmUtilService, aEditNode, $workingNode, hideEditArea );
|
||||
}
|
||||
function showAlert( oServerError ) {
|
||||
$elAlert.find( ".message" ).html( oServerError.errorMessage );
|
||||
@@ -79,7 +80,7 @@
|
||||
$.each( aEditNode, function( index, $el ) {
|
||||
alarmUtilService.show( $el );
|
||||
});
|
||||
aEditNode[0].focus();
|
||||
aEditNode[0].find("input").focus();
|
||||
}
|
||||
function showEditArea( oPinpointUser ) {
|
||||
var len = aEditNode.length - 1;
|
||||
@@ -122,14 +123,6 @@
|
||||
};
|
||||
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 );
|
||||
}
|
||||
@@ -152,7 +145,7 @@
|
||||
});
|
||||
};
|
||||
scope.onCancelAddPinpointUser = function() {
|
||||
AddPinpointUser.cancelAction( function() {
|
||||
AddPinpointUser.cancelAction( aEditNode, function() {
|
||||
hideEditArea();
|
||||
});
|
||||
};
|
||||
@@ -160,12 +153,12 @@
|
||||
applyAddPinpointUser();
|
||||
};
|
||||
function applyAddPinpointUser() {
|
||||
AddPinpointUser.applyAction( alarmUtilService, getNewPinpointUser(), $elLoading, function( oNewPinpointUser ) {
|
||||
AddPinpointUser.applyAction( alarmUtilService, getNewPinpointUser(), aEditNode, $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 );
|
||||
alarmUtilService.setTotal( $elTotal, getTotal() );
|
||||
}, showAlert );
|
||||
}
|
||||
// remove
|
||||
@@ -188,8 +181,10 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
scope.pinpointUserList = oPinpointUserList;
|
||||
alarmUtilService.setTotal( $elTotal, oPinpointUserList.length );
|
||||
scope.$apply(function() {
|
||||
scope.pinpointUserList = oPinpointUserList;
|
||||
});
|
||||
alarmUtilService.setTotal( $elTotal, getTotal() );
|
||||
alarmBroadcastService.sendUserRemoved( userId );
|
||||
}, showAlert );
|
||||
};
|
||||
@@ -202,10 +197,10 @@
|
||||
});
|
||||
};
|
||||
scope.onCancelUpdatePinpointUser = function() {
|
||||
UpdatePinpointUser.cancelAction( alarmUtilService, $workingNode, hideEditArea );
|
||||
UpdatePinpointUser.cancelAction( alarmUtilService, aEditNode, $workingNode, hideEditArea );
|
||||
};
|
||||
scope.onApplyUpdatePinpointUser = function() {
|
||||
UpdatePinpointUser.applyAction( alarmUtilService, getNewPinpointUser(), $workingNode, $elLoading, function( oPinpointUser ) {
|
||||
UpdatePinpointUser.applyAction( alarmUtilService, getNewPinpointUser(), aEditNode, $workingNode, $elLoading, function( oPinpointUser ) {
|
||||
|
||||
for( var i = 0 ; i < oPinpointUserList.length ; i++ ) {
|
||||
if ( oPinpointUserList[i].userId == oPinpointUser.userId ) {
|
||||
@@ -217,10 +212,27 @@
|
||||
}
|
||||
}
|
||||
scope.pinpointUserList = oPinpointUserList;
|
||||
hideEditArea();
|
||||
alarmBroadcastService.sendUserUpdated( oPinpointUser );
|
||||
}, showAlert );
|
||||
};
|
||||
|
||||
scope.onEditPinpointUserKeydown = function( $event ) {
|
||||
if ( $event.keyCode == 13 ) { // Enter
|
||||
if ( AddPinpointUser.isOn() ) {
|
||||
scope.onApplyAddPinpointUser();
|
||||
} else {
|
||||
scope.onApplyUpdatePinpointUser();
|
||||
}
|
||||
} else if ( $event.keyCode == 27 ) { // ESC
|
||||
if ( AddPinpointUser.isOn() ) {
|
||||
scope.onCancelAddPinpointUser();
|
||||
} else {
|
||||
scope.onCancelUpdatePinpointUser();
|
||||
}
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
scope.onSearchKeydown = function( $event ) {
|
||||
if ( $event.keyCode == 13 ) { // Enter
|
||||
scope.onSearch();
|
||||
@@ -232,14 +244,13 @@
|
||||
cancelPreviousWork();
|
||||
var query = $.trim( $elSearch.val() );
|
||||
|
||||
if ( query.length < 3 ) {
|
||||
if ( query.length < CONSTS.MIN_SEARCH_LENGTH ) {
|
||||
$elSearch.focus();
|
||||
return;
|
||||
}
|
||||
alarmUtilService.show( $elLoading );
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_FILTER_PINPOINT_USER );
|
||||
loadData({ "userName": query });
|
||||
// { "department" :query }
|
||||
loadData({ "searchKey": query });
|
||||
};
|
||||
scope.checkUser = function( $event ) {
|
||||
alarmUtilService.show( $elLoading );
|
||||
@@ -252,16 +263,7 @@
|
||||
}
|
||||
};
|
||||
scope.$on("alarmPinpointUser.configuration.groupUserRemoved", function( event, list, userId ) {
|
||||
oGroupMemberList = list;
|
||||
$.each( oPinpointUserList, function( index, oPinpointUser ) {
|
||||
oPinpointUser.has = false;
|
||||
for( var i = 0 ; i < oGroupMemberList.length ; i++ ) {
|
||||
if ( oPinpointUser.userId == oGroupMemberList[i].memberId ) {
|
||||
oPinpointUser.has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
resetList( list );
|
||||
scope.$apply(function() {
|
||||
scope.pinpointUserList = oPinpointUserList;
|
||||
});
|
||||
@@ -269,6 +271,12 @@
|
||||
});
|
||||
scope.$on("alarmPinpointUser.configuration.groupLoaded", function( event, list ) {
|
||||
$elWrapper.removeClass( "_disable-check" );
|
||||
console.log( list );
|
||||
resetList( list );
|
||||
scope.pinpointUserList = oPinpointUserList;
|
||||
alarmUtilService.setTotal( $elTotal, getTotal() );
|
||||
});
|
||||
function resetList( list ) {
|
||||
oGroupMemberList = list;
|
||||
$.each( oPinpointUserList, function( index, oPinpointUser ) {
|
||||
oPinpointUser.has = false;
|
||||
@@ -279,9 +287,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
scope.pinpointUserList = oPinpointUserList;
|
||||
alarmUtilService.setTotal( $elTotal, getTotal() );
|
||||
});
|
||||
}
|
||||
scope.$on("alarmPinpointUser.configuration.selectNone", function() {
|
||||
$elWrapper.addClass( "_disable-check" );
|
||||
$.each( oPinpointUserList, function( index, oPinpointUser ) {
|
||||
@@ -292,11 +298,6 @@
|
||||
alarmUtilService.setTotal( $elTotal, getTotal() );
|
||||
});
|
||||
scope.$on("alarmPinpointUser.configuration.addUserCallback", function( event, list ) {
|
||||
if ( list.length > oGroupMemberList.length ) {
|
||||
//success
|
||||
} else {
|
||||
//fail
|
||||
}
|
||||
oGroupMemberList = list;
|
||||
alarmUtilService.setTotal( $elTotal, getTotal() );
|
||||
|
||||
@@ -308,7 +309,7 @@
|
||||
scope.$on("alarmPinpointUser.configuration.load", function( event, department ) {
|
||||
cancelPreviousWork();
|
||||
if ( bIsLoaded === false ) {
|
||||
loadData( angular.isUndefined( department ) ? {} : { "department": department } );
|
||||
loadData( angular.isUndefined( department ) ? {} : { "searchKey": department } );
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -316,6 +317,7 @@
|
||||
}]);
|
||||
|
||||
var CONSTS = {
|
||||
MIN_SEARCH_LENGTH : 2,
|
||||
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",
|
||||
@@ -335,28 +337,33 @@
|
||||
this._bIng = true;
|
||||
cb();
|
||||
},
|
||||
cancelAction: function( cbCancel ) {
|
||||
cancelAction: function( aEditNode, cbCancel ) {
|
||||
if ( this._bIng === true ) {
|
||||
removeBlink(aEditNode );
|
||||
cbCancel();
|
||||
this._bIng = false;
|
||||
}
|
||||
},
|
||||
applyAction: function( alarmUtilService, oNewPinpointUser, $elLoading, cbSuccess, cbFail ) {
|
||||
applyAction: function( alarmUtilService, oNewPinpointUser, aEditNode, $elLoading, cbSuccess, cbFail ) {
|
||||
var self = this;
|
||||
alarmUtilService.show( $elLoading );
|
||||
if ( oNewPinpointUser.userId === "" || oNewPinpointUser.name === "" ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.INPUT_USERID_AND_NAME });
|
||||
return;
|
||||
}
|
||||
if ( oNewPinpointUser.phoneNumber === "" && oNewPinpointUser.email === "" ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.INPUT_PHONE_OR_EMAIL });
|
||||
return;
|
||||
}
|
||||
if ( oNewPinpointUser.phoneNumber !== "" && validatePhone( oNewPinpointUser.phoneNumber ) ) {
|
||||
if ( oNewPinpointUser.phoneNumber !== "" && validatePhone( oNewPinpointUser.phoneNumber ) === false ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.YOU_CAN_ONLY_INPUT_NUMBERS });
|
||||
return;
|
||||
}
|
||||
if ( oNewPinpointUser.email !== "" && validateEmail( oNewPinpointUser.email ) ) {
|
||||
if ( oNewPinpointUser.email !== "" && validateEmail( oNewPinpointUser.email ) === false ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.INVALID_EMAIL_FORMAT });
|
||||
return;
|
||||
}
|
||||
@@ -364,7 +371,7 @@
|
||||
alarmUtilService.sendCRUD( "createPinpointUser", oNewPinpointUser, function( oServerData ) {
|
||||
oNewPinpointUser.number = oServerData.number;
|
||||
cbSuccess( oNewPinpointUser );
|
||||
self.cancelAction( function() {} );
|
||||
self.cancelAction( aEditNode, function() {} );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
}, function( oServerError ) {
|
||||
cbFail( oServerError );
|
||||
@@ -395,7 +402,7 @@
|
||||
var userId = alarmUtilService.extractID( $node );
|
||||
alarmUtilService.sendCRUD( "removePinpointUser", { "userId": userId }, function( oServerData ) {
|
||||
cbSuccess( userId );
|
||||
self.cancel( alarmUtilService, $node );
|
||||
self.cancelAction( alarmUtilService, $node );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
}, function( oServerError ) {
|
||||
cbFail( oServerError );
|
||||
@@ -412,41 +419,65 @@
|
||||
alarmUtilService.hide( $node );
|
||||
cb( alarmUtilService.extractID( $node ) );
|
||||
},
|
||||
cancelAction: function( alarmUtilService, $node, cbCancel ) {
|
||||
cancelAction: function( alarmUtilService, aEditNode, $node, cbCancel ) {
|
||||
if ( this._bIng === true ) {
|
||||
cbCancel();
|
||||
removeBlink( aEditNode );
|
||||
alarmUtilService.show( $node );
|
||||
this._bIng = false;
|
||||
}
|
||||
},
|
||||
applyAction: function (alarmUtilService, oPinpointUser, $node, $elLoading, cbSuccess, cbFail) {
|
||||
applyAction: function (alarmUtilService, oPinpointUser, aEditNode, $node, $elLoading, cbSuccess, cbFail) {
|
||||
var self = this;
|
||||
alarmUtilService.show($elLoading);
|
||||
|
||||
if ( oPinpointUser.name === "" ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.INPUT_USERID_AND_NAME });
|
||||
return;
|
||||
}
|
||||
if ( oPinpointUser.phoneNumber === "" && oPinpointUser.email === "" ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.INPUT_PHONE_OR_EMAIL });
|
||||
return;
|
||||
}
|
||||
if ( oPinpointUser.phoneNumber !== "" && validatePhone( oPinpointUser.phoneNumber ) ) {
|
||||
if ( oPinpointUser.phoneNumber !== "" && validatePhone( oPinpointUser.phoneNumber ) === false ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.YOU_CAN_ONLY_INPUT_NUMBERS });
|
||||
return;
|
||||
}
|
||||
if ( oPinpointUser.email !== "" && validateEmail( oPinpointUser.email ) ) {
|
||||
if ( oPinpointUser.email !== "" && validateEmail( oPinpointUser.email ) === false ) {
|
||||
addBlink( aEditNode );
|
||||
cbFail({ errorMessage: CONSTS.INVALID_EMAIL_FORMAT });
|
||||
return;
|
||||
}
|
||||
|
||||
alarmUtilService.sendCRUD( "updatePinpointUser", oPinpointUser, function( oServerData ) {
|
||||
self.cancelAction( alarmUtilService, $node, function () {});
|
||||
self.cancelAction( alarmUtilService, aEditNode, $node, function () {});
|
||||
cbSuccess( oPinpointUser );
|
||||
alarmUtilService.hide($elLoading);
|
||||
}, function( oServerError ) {
|
||||
cbFail( oServerError );
|
||||
} );
|
||||
}
|
||||
};
|
||||
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 addBlink( a ) {
|
||||
$.each( a, function( index, $el ) {
|
||||
$el.addClass("blink-blink");
|
||||
});
|
||||
}
|
||||
function removeBlink( a ) {
|
||||
$.each( a, function( index, $el ) {
|
||||
$el.removeClass("blink-blink");
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
@@ -17,6 +17,7 @@
|
||||
scope: true,
|
||||
link: function (scope, element) {
|
||||
var $element = $(element);
|
||||
var $elGuide = $element.find(".some-guide");
|
||||
var $elWrapper = $element.find(".wrapper");
|
||||
var $elTotal = $element.find(".total");
|
||||
var $elLoading = $element.find(".some-loading");
|
||||
@@ -32,16 +33,13 @@
|
||||
scope.ruleSets = [];
|
||||
|
||||
function cancelPreviousWork() {
|
||||
AddAlarm.cancelAction( hideEditArea );
|
||||
AddAlarm.cancelAction( aEditNodes, hideEditArea );
|
||||
RemoveAlarm.cancelAction( alarmUtilService, $workingNode, hideEditArea );
|
||||
UpdateAlarm.cancelAction( alarmUtilService, $workingNode, aEditNodes );
|
||||
UpdateAlarm.cancelAction( alarmUtilService, $workingNode, aEditNodes, hideEditArea );
|
||||
}
|
||||
function isSameNode( $current ) {
|
||||
return alarmUtilService.extractID( $workingNode ) === alarmUtilService.extractID( $current );
|
||||
}
|
||||
function reset() {
|
||||
cancelPreviousWork();
|
||||
}
|
||||
function showAlert( oServerError ) {
|
||||
$elAlert.find( ".message" ).html( oServerError.errorMessage );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
@@ -151,17 +149,23 @@
|
||||
aEditNodes[1].find("input").val( "" );
|
||||
}
|
||||
function getNewRule( ruleId ) {
|
||||
|
||||
var oApplicationData = aEditNodes[0].find("select[name=application]").select2("data");
|
||||
var ruleData = aEditNodes[0].find("select[name=rule]").select2("data");
|
||||
var aApplication = oApplicationData === null || oApplicationData === undefined ? [ "", "" ] : oApplicationData.id.split("@");
|
||||
ruleData = ruleData === null || ruleData === undefined ? "" : ruleData.id;
|
||||
|
||||
var application = aEditNodes[0].find("select[name=application]").select2("val").split("@");
|
||||
var type = aEditNodes[0].find("select[name=type]").val();
|
||||
var notificationType = aEditNodes[0].find("select[name=type]").val();
|
||||
|
||||
var oRule = {
|
||||
"applicationId": application[0],
|
||||
"serviceType": application[1],
|
||||
"applicationId": aApplication[0],
|
||||
"serviceType": aApplication[1],
|
||||
"userGroupId": currentUserGroupId,
|
||||
"checkerName": aEditNodes[0].find("select[name=rule]").select2( "val" ),
|
||||
"checkerName": ruleData,
|
||||
"threshold": aEditNodes[0].find("input[name=threshold]").val(),
|
||||
"smsSend": ( type === "all" || type === "sms" ? true : false ),
|
||||
"emailSend": ( type === "all" || type === "email" ? true : false ),
|
||||
"smsSend": ( notificationType === "all" || notificationType === "sms" ? true : false ),
|
||||
"emailSend": ( notificationType === "all" || notificationType === "email" ? true : false ),
|
||||
"notes": aEditNodes[1].find("input").val()
|
||||
};
|
||||
if ( angular.isUndefined( ruleId ) === false ) {
|
||||
@@ -179,10 +183,12 @@
|
||||
}
|
||||
|
||||
scope.$on("alarmRule.configuration.selectNone", function( event ) {
|
||||
reset();
|
||||
cancelPreviousWork();
|
||||
currentUserGroupId = "";
|
||||
oRuleList = [];
|
||||
scope.ruleList = [];
|
||||
alarmUtilService.show( $elGuide );
|
||||
alarmUtilService.setTotal( $elTotal, oRuleList.length );
|
||||
});
|
||||
scope.onAddAlarm = function() {
|
||||
if ( currentUserGroupId === "" || AddAlarm.isOn() ) {
|
||||
@@ -194,7 +200,7 @@
|
||||
});
|
||||
};
|
||||
scope.onApplyAddAlarm = function() {
|
||||
AddAlarm.applyAction( alarmUtilService, getNewRule(), $elLoading, function( application, rule ) {
|
||||
AddAlarm.applyAction( alarmUtilService, getNewRule(), aEditNodes, $elLoading, function( application, rule ) {
|
||||
return alarmUtilService.hasDuplicateItem( oRuleList, function( oRule ) {
|
||||
return oRule.applicationId === application && oRule.checkerName === rule;
|
||||
});
|
||||
@@ -207,7 +213,7 @@
|
||||
}, showAlert );
|
||||
};
|
||||
scope.onCancelAddAlarm = function() {
|
||||
AddAlarm.cancelAction( hideEditArea );
|
||||
AddAlarm.cancelAction( aEditNodes, hideEditArea );
|
||||
};
|
||||
scope.onRemoveAlarm = function( $event ) {
|
||||
var $node = alarmUtilService.getNode( $event, "tr" );
|
||||
@@ -241,10 +247,10 @@
|
||||
});
|
||||
};
|
||||
scope.onCancelUpdateAlarm = function() {
|
||||
UpdateAlarm.cancelAction( alarmUtilService, $workingNode, hideEditArea );
|
||||
UpdateAlarm.cancelAction( alarmUtilService, $workingNode, aEditNodes, hideEditArea );
|
||||
};
|
||||
scope.onApplyUpdateAlarm = function() {
|
||||
UpdateAlarm.applyAction( alarmUtilService, getNewRule( alarmUtilService.extractID( $workingNode ) ), $workingNode, $elLoading, function( ruleId, application, rule ) {
|
||||
UpdateAlarm.applyAction( alarmUtilService, getNewRule( alarmUtilService.extractID( $workingNode ) ), aEditNodes, $workingNode, $elLoading, function( ruleId, application, rule ) {
|
||||
return alarmUtilService.hasDuplicateItem( oRuleList, function( oRule ) {
|
||||
return ( oRule.applicationId === application && oRule.checkerName === rule ) && oRule.ruleId != ruleId;
|
||||
});
|
||||
@@ -270,7 +276,8 @@
|
||||
});
|
||||
scope.$on("alarmRule.configuration.load", function( event, userGroupID ) {
|
||||
currentUserGroupId = userGroupID;
|
||||
reset();
|
||||
cancelPreviousWork();
|
||||
alarmUtilService.hide( $elGuide );
|
||||
loadData( true );
|
||||
loadRuleSet();
|
||||
});
|
||||
@@ -312,27 +319,36 @@
|
||||
this._bIng = true;
|
||||
cb();
|
||||
},
|
||||
cancelAction: function( cbCancel ) {
|
||||
cancelAction: function( aEditNodes, cbCancel ) {
|
||||
if ( this._bIng === true ) {
|
||||
$.each( aEditNodes, function( index, $el ) {
|
||||
$el.removeClass("blink-blink");
|
||||
});
|
||||
cbCancel();
|
||||
this._bIng = false;
|
||||
}
|
||||
},
|
||||
applyAction: function( alarmUtilService, oNewRule, $elLoading, cbHasAlarm, cbSuccess, cbFail ) {
|
||||
applyAction: function( alarmUtilService, oNewRule, aEditNodes, $elLoading, cbHasAlarm, cbSuccess, cbFail ) {
|
||||
var self = this;
|
||||
alarmUtilService.show( $elLoading );
|
||||
if ( oNewRule.applicationId === "" || oNewRule.checkerName === "" ) {
|
||||
$.each( aEditNodes, function( index, $el ) {
|
||||
$el.addClass("blink-blink");
|
||||
});
|
||||
cbFail({ errorMessage: CONSTS.SELECT_APP_OR_RULE });
|
||||
return;
|
||||
}
|
||||
if ( cbHasAlarm( oNewRule.applicationId, oNewRule.checkerName ) ) {
|
||||
$.each( aEditNodes, function( index, $el ) {
|
||||
$el.addClass("blink-blink");
|
||||
});
|
||||
cbFail({ errorMessage: CONSTS.EXIST_A_SAME });
|
||||
return;
|
||||
}
|
||||
alarmUtilService.sendCRUD( "createRule", oNewRule, function( oServerData ) {
|
||||
oNewRule.ruleId = oServerData.ruleId;
|
||||
cbSuccess( oNewRule );
|
||||
self.cancelAction( function() {} );
|
||||
self.cancelAction( aEditNodes, function() {} );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
}, function( oServerError ) {
|
||||
cbFail( oServerError );
|
||||
@@ -375,17 +391,23 @@
|
||||
alarmUtilService.hide( $node );
|
||||
cb( alarmUtilService.extractID( $node ) );
|
||||
},
|
||||
cancelAction: function( alarmUtilService, $node, cbCancel ) {
|
||||
cancelAction: function( alarmUtilService, $node, aEditNodes, cbCancel ) {
|
||||
if ( this._bIng === true ) {
|
||||
cbCancel();
|
||||
$.each( aEditNodes, function( index, $el ) {
|
||||
$el.removeClass("blink-blink");
|
||||
});
|
||||
alarmUtilService.show( $node );
|
||||
this._bIng = false;
|
||||
}
|
||||
},
|
||||
applyAction: function( alarmUtilService, oUpdateRule, $node, $elLoading, cbHasAlarm, cbSuccess, cbFail ) {
|
||||
applyAction: function( alarmUtilService, oUpdateRule, aEditNodes, $node, $elLoading, cbHasAlarm, cbSuccess, cbFail ) {
|
||||
var self = this;
|
||||
alarmUtilService.show($elLoading);
|
||||
if ( cbHasAlarm( oUpdateRule.ruleId, oUpdateRule.applicationId, oUpdateRule.checkerName ) ) {
|
||||
$.each( aEditNodes, function( index, $el ) {
|
||||
$el.addClass("blink-blink");
|
||||
});
|
||||
cbFail({errorMessage: CONSTS.EXIST_A_SAME});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,13 +84,17 @@
|
||||
alarmUtilService.show( $elLoading );
|
||||
cancelPreviousWork();
|
||||
var query = $.trim( $elSearchInput.val() );
|
||||
if ( query.length < CONSTS.MIN_GROUPNAME_LENGTH ) {
|
||||
$elSearchInput.val("");
|
||||
alarmUtilService.hide( $elLoading );
|
||||
return;
|
||||
if ( query === "" ) {
|
||||
loadData();
|
||||
} else {
|
||||
if ( query.length < CONSTS.MIN_GROUPNAME_LENGTH ) {
|
||||
$elSearchInput.val("");
|
||||
alarmUtilService.hide( $elLoading );
|
||||
return;
|
||||
}
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_FILTER_USER_GROUP );
|
||||
loadData( { "userGroupId": query } );
|
||||
}
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_FILTER_USER_GROUP );
|
||||
loadData( { "userGroupId": query } );
|
||||
};
|
||||
|
||||
// add process
|
||||
@@ -212,11 +216,11 @@
|
||||
]);
|
||||
var CONSTS = {
|
||||
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",
|
||||
EXIST_A_SAME: "Exist a same group name",
|
||||
ENTER_AT_LEAST: "Enter at least 3 letters to search",
|
||||
DIV_EDIT: "div._edit",
|
||||
DIV_NORMAL: "div._normal",
|
||||
DIV_REMOVE: "div._remove"
|
||||
};
|
||||
|
||||
@@ -311,7 +315,7 @@
|
||||
var groupNumber = alarmUtilService.extractID( $node );
|
||||
var groupName = $node.find("input").val();
|
||||
|
||||
if ( groupName === "" || groupName.length < CONST.MIN_GROUPNAME_LENGTH ) {
|
||||
if ( groupName.length < CONSTS.MIN_GROUPNAME_LENGTH ) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$node.addClass("blink-blink");
|
||||
$node.find("input").attr("placeholder", CONSTS.ENTER_AT_LEAST).val("").focus();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="some-list" style="width:300px;height:459px">
|
||||
<div class="some-list-header" style="background-color:#9A9A9A;color:#FFF;">
|
||||
<span class="title">Group Member <span class="total"></span></span>
|
||||
<span class="glyphicon glyphicon-sort right" style="cursor:pointer" ng-click="onSortGroupMember()"></span>
|
||||
<span class="glyphicon glyphicon-sort right" style="cursor:pointer;opacity:{{canSort()}}" ng-click="onSortGroupMember()"></span>
|
||||
</div>
|
||||
<div class="some-list-content" style="color:#9A9A9A;">
|
||||
<div class="wrapper"><ul>
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
<div class="some-list-content" style="color:#9A9A9A;">
|
||||
<div class="wrapper _disable-check" style="height:375px;"><ul>
|
||||
<li class="new-group hide-me">
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="User Id" ng-keydown="onAdd($event)"/>
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="User Id" ng-keydown="onEditPinpointUserKeydown($event)"/>
|
||||
</li>
|
||||
<li class="new-group hide-me">
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Name" ng-keydown="onAdd($event)"/>
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Name" ng-keydown="onEditPinpointUserKeydown($event)"/>
|
||||
</li>
|
||||
<li class="new-group hide-me">
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Department" ng-keydown="onAdd($event)"/>
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Department" ng-keydown="onEditPinpointUserKeydown($event)"/>
|
||||
</li>
|
||||
<li class="new-group hide-me">
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Phone" ng-keydown="onAdd($event)"/>
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Phone" ng-keydown="onEditPinpointUserKeydown($event)"/>
|
||||
</li>
|
||||
<li class="new-group hide-me">
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Email" ng-keydown="onAdd($event)"/>
|
||||
<input type="text" class="form-control" style="height:25px" placeholder="Email" ng-keydown="onEditPinpointUserKeydown($event)"/>
|
||||
<div style="float:right" class="_add hide-me">
|
||||
<span class="glyphicon glyphicon-remove remove" aria-hidden="true" ng-click="onCancelAddPinpointUser()"></span>
|
||||
<span class="glyphicon glyphicon-ok edit" aria-hidden="true" ng-click="onApplyAddPinpointUser()"></span>
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="some-guide" style="padding-top:25%;">
|
||||
Select a 'User Group'<br>to enable here
|
||||
</div>
|
||||
<div class="some-loading hide-me">
|
||||
<div class="timer-loader" style="margin-top:30%"></div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</li>
|
||||
<li ng-repeat="userGroup in userGroupList" id="{{prefix + userGroup.number}}">
|
||||
<span class="contents">{{userGroup.id}}</span>
|
||||
<input type="text" style="height:22px" ng-keydown="onUpdateuserGroupKeydown($event)"/>
|
||||
<input type="text" style="height:22px" ng-keydown="onUpdateUserGroupKeydown($event)"/>
|
||||
<div style="float:right" class="_normal">
|
||||
<span class="glyphicon glyphicon-remove remove" aria-hidden="true" ng-click="onRemoveUserGroup($event)"></span>
|
||||
<span class="glyphicon glyphicon-pencil edit" aria-hidden="true" ng-click="onUpdateUserGroup($event)"></span>
|
||||
|
||||
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -466,12 +466,17 @@
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
.blink-blink {
|
||||
background-color: rgba( 255, 0, 0, 0.4 ) !important;
|
||||
/*
|
||||
animation: back-blink 1s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-iteration-count: 2;
|
||||
*/
|
||||
}
|
||||
/*
|
||||
@keyframes back-blink {
|
||||
0% {background-color: #F3FBFF;}
|
||||
50% {background-color: #F00;}
|
||||
100% {background-color: #FF0 }
|
||||
0% {background-color: rgba( 255, 0, 0, 0.2 )}
|
||||
50% {background-color: rgba( 255, 0, 0, 0.5 ) }
|
||||
100% {background-color: rgba( 255, 0, 0, 0.2 ) }
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user