mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-27 13:46:45 +10:00
update alarm user group UI
This commit is contained in:
@@ -9,14 +9,20 @@
|
||||
* @class
|
||||
*/
|
||||
|
||||
pinpointApp.service('AlarmBroadcastService', [ '$rootScope', function ($rootScope) {
|
||||
pinpointApp.service("AlarmBroadcastService", [ "$rootScope", "globalConfig", function ( $rootScope, globalConfig ) {
|
||||
var self = this;
|
||||
// from userGroup
|
||||
this.sendInit = function( userGroupID, willBeAddedUser ) {
|
||||
self.sendReloadWithUserGroupID( userGroupID, willBeAddedUser );
|
||||
this.sendInit = function( userGroupID ) {
|
||||
self.sendReloadWithUserGroupID( userGroupID, globalConfig.userId ? {
|
||||
userId: globalConfig.userId,
|
||||
name: globalConfig.userName,
|
||||
department: globalConfig.userDepartment
|
||||
} : {} );
|
||||
};
|
||||
this.sendLoadPinpointUser = function( userDepartment ) {
|
||||
$rootScope.$broadcast( "alarmPinpointUser.configuration.load", userDepartment );
|
||||
this.sendLoadPinpointUser = function() {
|
||||
if ( globalConfig.userId ) {
|
||||
$rootScope.$broadcast("alarmPinpointUser.configuration.load", globalConfig.userDepartment );
|
||||
}
|
||||
};
|
||||
// from userGroup
|
||||
this.sendReloadWithUserGroupID = function( userGroupID, willBeAddedUser ) {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* @class
|
||||
*/
|
||||
|
||||
pinpointApp.directive('alarmUserGroupDirective', [ '$rootScope', '$timeout', 'helpContentTemplate', 'helpContentService', 'AlarmUtilService', 'AlarmBroadcastService', 'AnalyticsService', 'globalConfig',
|
||||
function ($rootScope, $timeout, helpContentTemplate, helpContentService, alarmUtilService, alarmBroadcastService, analyticsService, globalConfig) {
|
||||
pinpointApp.directive("alarmUserGroupDirective", [ "$rootScope", "$timeout", "helpContentService", "AlarmUtilService", "AlarmBroadcastService", "AnalyticsService",
|
||||
function ($rootScope, $timeout, helpContentService, alarmUtilService, alarmBroadcastService, analyticsService ) {
|
||||
return {
|
||||
restrict: 'EA',
|
||||
replace: true,
|
||||
@@ -17,256 +17,249 @@
|
||||
scope: true,
|
||||
link: function (scope, element) {
|
||||
scope.prefix = "alarmUserGroup_";
|
||||
|
||||
var selectedGroupNumber = "";
|
||||
var isCreate = true; // update
|
||||
var isRemoving = false;
|
||||
var isLoadedUserGroupList = false;
|
||||
var CONSTS = {
|
||||
MIN_GROUPNAME_LENGTH : 4,
|
||||
ENTER_AT_LEAST: "Enter at least 4 letters to search",
|
||||
EXIST_A_SAME: "Exist a same group name"
|
||||
};
|
||||
var selectedGroupNumber = "";
|
||||
var $workingNode = null;
|
||||
var bIsCreating = false;
|
||||
var bIsRemoving = false;
|
||||
var bIsUpdating = false;
|
||||
var bIsLoaded = false;
|
||||
var userGroupList = scope.userGroupList = [];
|
||||
|
||||
function addSelectClass( newSelectedGroupNumber ) {
|
||||
if ( selectedGroupNumber !== "" ) {
|
||||
$( "#" + scope.prefix + selectedGroupNumber ).removeClass("selected");
|
||||
}
|
||||
$( "#" + scope.prefix + newSelectedGroupNumber ).addClass("selected");
|
||||
selectedGroupNumber = newSelectedGroupNumber;
|
||||
}
|
||||
|
||||
var $element = element;
|
||||
var $elWrapper = $element.find(".wrapper");
|
||||
var $element = element;
|
||||
var $elTotal = $element.find(".total");
|
||||
var $elAlert = $element.find(".some-alert");
|
||||
var $elLoading = $element.find(".some-loading");
|
||||
var $elAlert = $element.find(".some-alert");
|
||||
var $elSearchInput = $element.find("div.filter-input input");
|
||||
var $elSearchEmpty = $element.find("div.filter-input button.trash");
|
||||
var $elEdit = $element.find(".some-edit-content");
|
||||
var $elEditInput = $elEdit.find("input");
|
||||
var $elEditGuide = $elEdit.find(".title-message");
|
||||
var $removeTemplate = $([
|
||||
'<span class="right">',
|
||||
'<button class="btn btn-danger confirm-cancel"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>',
|
||||
'<button class="btn btn-danger confirm-remove" style="margin-left:2px;"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></button>',
|
||||
'</span>'
|
||||
].join(""));
|
||||
|
||||
var $elUL = $element.find(".some-list-content ul");
|
||||
$elUL.on("click", function($event) {
|
||||
var $elNewGroup = $element.find(".new-group");
|
||||
var $elSearchInput = $element.find(".some-list-search input");
|
||||
|
||||
$element.find(".some-list-content ul").on("click", function($event) {
|
||||
var $target = $( $event.toElement || $event.target );
|
||||
var tagName = $target.get(0).tagName.toLowerCase();
|
||||
var $li = $target.parents("li");
|
||||
|
||||
if ( tagName === "button" ) {
|
||||
if ( $target.hasClass("edit") ) {
|
||||
scope.onUpdate( $event );
|
||||
} else if ( $target.hasClass("confirm-remove") ) {
|
||||
removeConfirm( $li );
|
||||
} else if ( $target.hasClass("confirm-cancel") ) {
|
||||
revmoeCancel( $li );
|
||||
}
|
||||
} else if ( tagName === "span" ) {
|
||||
if ( $target.hasClass("remove") ) {
|
||||
if ( isRemoving === true ) return;
|
||||
isRemoving = true;
|
||||
$li.addClass("remove").find("span.remove").hide().end().append($removeTemplate);
|
||||
} else if ( $target.hasClass("contents") ) {
|
||||
selectGroup( $li );
|
||||
} 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( tagName === "li" ) {
|
||||
selectGroup( $target );
|
||||
}
|
||||
|
||||
if ( tagName === "span" && $target.hasClass("contents") ) {
|
||||
selectGroup( $target.parents("li") );
|
||||
} else if ( tagName === "li" ) {
|
||||
selectGroup( $target );
|
||||
}
|
||||
});
|
||||
function reset() {
|
||||
alarmUtilService.unsetFilterBackground( $elWrapper );
|
||||
$elSearchInput.val("");
|
||||
}
|
||||
|
||||
function removeConfirm( $el ) {
|
||||
alarmUtilService.showLoading( $elLoading, false );
|
||||
removeGroup( alarmUtilService.extractID( $el ), $el.find("span.contents").html() );
|
||||
}
|
||||
function removeCancel( $el ) {
|
||||
$el.find("span.right").remove().end().find("span.remove").show().end().removeClass("remove");
|
||||
isRemoving = false;
|
||||
}
|
||||
function loadData( sParam ) {
|
||||
alarmUtilService.sendCRUD( "getUserGroupList", sParam, function( aServerData ) {
|
||||
bIsLoaded = true;
|
||||
userGroupList = scope.userGroupList = aServerData;
|
||||
alarmUtilService.setTotal( $elTotal, userGroupList.length );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
alarmBroadcastService.sendLoadPinpointUser();
|
||||
}, function( oServerError ) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$elAlert.find(".message").html( oServerError.errorMessage );
|
||||
alarmUtilService.show( $elAlert );
|
||||
}, $elAlert );
|
||||
|
||||
}
|
||||
function selectGroup( $el ) {
|
||||
if ( isRemoving === true ) return;
|
||||
cancelPreviousWork();
|
||||
addSelectClass( alarmUtilService.extractID( $el ) );
|
||||
alarmBroadcastService.sendReloadWithUserGroupID( $el.find("span.contents").html() );
|
||||
alarmBroadcastService.sendReloadWithUserGroupID( $el.find(".contents").html() );
|
||||
}
|
||||
|
||||
function createGroup( name ) {
|
||||
alarmUtilService.sendCRUD( "createUserGroup", { "id": name }, function( resultData ) {
|
||||
// @TODO
|
||||
// 많이 쓰는 놈 기준 3개를 뽑아 내야 함.
|
||||
userGroupList.push({
|
||||
number: resultData.number,
|
||||
id: name
|
||||
});
|
||||
function addSelectClass( newSelectedGroupNumber ) {
|
||||
$( "#" + scope.prefix + selectedGroupNumber ).removeClass("selected");
|
||||
$( "#" + scope.prefix + newSelectedGroupNumber ).addClass("selected");
|
||||
selectedGroupNumber = newSelectedGroupNumber;
|
||||
}
|
||||
|
||||
if ( globalConfig.userId ) {
|
||||
alarmBroadcastService.sendInit( name, {
|
||||
userId: globalConfig.userId,
|
||||
name: globalConfig.userName,
|
||||
department: globalConfig.userDepartment
|
||||
});
|
||||
} else {
|
||||
alarmBroadcastService.sendInit( name );
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
addSelectClass( resultData.number );
|
||||
});
|
||||
alarmUtilService.setTotal( $elTotal, userGroupList.length );
|
||||
alarmUtilService.hide( $elLoading, $elEdit );
|
||||
}, function( errorData ) {}, $elAlert );
|
||||
}
|
||||
function updateGroup( number, name ) {
|
||||
alarmUtilService.sendCRUD( "updateUserGroup", { "number": number, "id": name }, function( resultData ) {
|
||||
// @TODO
|
||||
// 많이 쓰는 놈 기준 3개를 뽑아 내야 함.
|
||||
for( var i = 0 ; i < userGroupList.length ; i++ ) {
|
||||
if ( userGroupList[i].number == number ) {
|
||||
userGroupList[i].id = name;
|
||||
}
|
||||
}
|
||||
alarmUtilService.hide( $elLoading, $elEdit );
|
||||
}, function( errorData ) {}, $elAlert );
|
||||
}
|
||||
function removeGroup( number, name ) {
|
||||
alarmUtilService.sendCRUD( "removeUserGroup", { "id": name }, function( resultData ) {
|
||||
scope.$apply(function() {
|
||||
for( var i = 0 ; i < userGroupList.length ; i++ ) {
|
||||
if ( userGroupList[i].number == number ) {
|
||||
userGroupList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( userGroupList.length > 0 ) {
|
||||
$timeout(function() {
|
||||
addSelectClass( userGroupList[0].number );
|
||||
});
|
||||
alarmBroadcastService.sendReloadWithUserGroupID( userGroupList[0].id );
|
||||
} else {
|
||||
alarmBroadcastService.sendSelectionEmpty();
|
||||
}
|
||||
});
|
||||
alarmUtilService.setTotal( $elTotal, userGroupList.length );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
isRemoving = false;
|
||||
}, function( errorData ) {}, $elAlert );
|
||||
}
|
||||
function loadGroupList( isFirst, sParam ) {
|
||||
alarmUtilService.sendCRUD( "getUserGroupList",
|
||||
angular.isUndefined(sParam) || sParam === "" ? { "userId" : (globalConfig.userId || "") } : { "userGroupId" : sParam }, function( resultData ) {
|
||||
// @TODO
|
||||
// 많이 쓰는 놈 기준 3개를 뽑아 내야 함.
|
||||
isLoadedUserGroupList = true;
|
||||
userGroupList = scope.userGroupList = resultData;
|
||||
alarmUtilService.setTotal( $elTotal, userGroupList.length );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
if( userGroupList.length > 0 ) {
|
||||
if ( isFirst ) {
|
||||
alarmBroadcastService.sendInit( userGroupList[0].id );
|
||||
selectedGroupNumber = userGroupList[0].number;
|
||||
}
|
||||
$timeout(function() {
|
||||
addSelectClass( selectedGroupNumber );
|
||||
});
|
||||
}
|
||||
if ( globalConfig.userId ) {
|
||||
alarmBroadcastService.sendLoadPinpointUser( globalConfig.userDepartment );
|
||||
}
|
||||
}, function( errorData ) {}, $elAlert );
|
||||
function cancelPreviousWork() {
|
||||
if ( bIsCreating === true ) {
|
||||
cancelAddUserGroup();
|
||||
} else if ( bIsUpdating === true ) {
|
||||
removeUserGroup( $workingNode );
|
||||
} else if ( bIsRemoving === true ) {
|
||||
cancelRemoveUserGroup( $workingNode );
|
||||
}
|
||||
}
|
||||
scope.onAddUserGroup = function() {
|
||||
if ( bIsCreating === true ) return;
|
||||
cancelPreviousWork();
|
||||
|
||||
}
|
||||
scope.onRefresh = function() {
|
||||
if ( isRemoving === true ) return;
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_REFRESH_USER_GROUP );
|
||||
reset();
|
||||
alarmUtilService.showLoading( $elLoading, false );
|
||||
loadGroupList( false, $.trim( $elSearchInput.val() ) );
|
||||
};
|
||||
scope.onCreate = function() {
|
||||
if ( isRemoving === true ) return;
|
||||
|
||||
isCreate = true;
|
||||
$elEditGuide.html( "Create new alarm group" );
|
||||
$elEditInput.val("");
|
||||
alarmUtilService.show( $elEdit );
|
||||
$elEditInput.focus();
|
||||
};
|
||||
scope.onUpdate = function($event) {
|
||||
if ( isRemoving === true ) return;
|
||||
|
||||
isCreate = false;
|
||||
var $el = $( $event.toElement || $event.target ).parents("li");
|
||||
var userGroupNumber = alarmUtilService.extractID( $el );
|
||||
var userGroupID = $el.find("span.contents").html();
|
||||
|
||||
$elEditGuide.html( "Input new name of \"" + userGroupID + "\"." );
|
||||
$elEditInput.val( userGroupID ).prop("id", "updateUserGroup_" + userGroupNumber);
|
||||
alarmUtilService.show( $elEdit );
|
||||
$elEditInput.focus().select();
|
||||
bIsCreating = true;
|
||||
alarmUtilService.show( $elNewGroup );
|
||||
$elNewGroup.find("input").val("").focus();
|
||||
};
|
||||
scope.onCancelAddUserGroup = function() {
|
||||
cancelAddUserGroup();
|
||||
};
|
||||
function cancelAddUserGroup() {
|
||||
bIsCreating = false;
|
||||
$workingNode = null;
|
||||
alarmUtilService.hide( $elNewGroup );
|
||||
$elNewGroup.find( "input" ).attr( "placeholder", "New Group" ).val( "" );
|
||||
}
|
||||
scope.onApplyAddUserGroup = function() {
|
||||
alarmUtilService.show( $elLoading );
|
||||
var groupId = $elNewGroup.find("input").val();
|
||||
if ( groupId.length < CONSTS.MIN_GROUPNAME_LENGTH ) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$elNewGroup.find( "input" ).attr( "placeholder", CONSTS.ENTER_AT_LEAST ).val( "" ).focus();
|
||||
return;
|
||||
}
|
||||
alarmUtilService.sendCRUD( "createUserGroup", { "id": groupId }, function( oServerData ) {
|
||||
userGroupList.push({
|
||||
id: oServerData.id,
|
||||
number: oServerData.number
|
||||
});
|
||||
|
||||
alarmBroadcastService.sendInit( name );
|
||||
alarmUtilService.setTotal( $elTotal, userGroupList.length );
|
||||
cancelAddUserGroup();
|
||||
alarmUtilService.hide( $elLoading );
|
||||
}, function( oServerError ) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$elAlert.find(".message").html( oServerError.errorMessage );
|
||||
alarmUtilService.show( $elAlert );
|
||||
});
|
||||
};
|
||||
scope.onAddUserGroupKeydown = function( $event ) {
|
||||
if ( $event.keyCode == 13 ) { // Enter
|
||||
scope.onApplyAddUserGroup();
|
||||
} else if ( $event.keyCode == 27 ) { // ESC
|
||||
cancelAddUserGroup();
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
scope.onUpdateUserGroupKeydown = function( $event ) {
|
||||
if ( $event.keyCode == 13 ) { // Enter
|
||||
scope.onApplyUpdateUserGroup();
|
||||
} else if ( $event.keyCode == 27 ) { // ESC
|
||||
removeUserGroup( $workingNode );
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
scope.onSearch = function() {
|
||||
if ( isRemoving === true ) return;
|
||||
var query = $.trim( $elSearchInput.val() );
|
||||
if ( query.length !== 0 && query.length < 3 ) {
|
||||
alarmUtilService.showLoading( $elLoading, false );
|
||||
alarmUtilService.showAlert( $elAlert, "You must enter at least three characters.");
|
||||
return;
|
||||
cancelPreviousWork();
|
||||
alarmUtilService.show( $elLoading );
|
||||
var query = $.trim( $elSearchInput.val() );
|
||||
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 );
|
||||
alarmUtilService.showLoading( $elLoading, false );
|
||||
loadGroupList( false, query );
|
||||
};
|
||||
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 groupName = $.trim( $elEditInput.val() );
|
||||
if ( groupName === "" ) {
|
||||
alarmUtilService.showLoading( $elLoading, true );
|
||||
alarmUtilService.showAlert( $elAlert, "Input group id.");
|
||||
return;
|
||||
}
|
||||
|
||||
alarmUtilService.showLoading( $elLoading, true );
|
||||
if ( alarmUtilService.hasDuplicateItem( userGroupList, function( userGroup ) {
|
||||
return userGroup.id == groupName;
|
||||
}) && isCreate === true ) {
|
||||
alarmUtilService.showAlert( $elAlert, "Exist a same group name in the lists." );
|
||||
return;
|
||||
}
|
||||
if ( isCreate ) {
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_CREATE_USER_GROUP );
|
||||
createGroup( groupName );
|
||||
} else {
|
||||
updateGroup( alarmUtilService.extractID( $elEditInput ), groupName );
|
||||
}
|
||||
loadData( query );
|
||||
};
|
||||
scope.onCloseAlert = function() {
|
||||
alarmUtilService.closeAlert( $elAlert, $elLoading );
|
||||
};
|
||||
alarmUtilService.hide( $elAlert );
|
||||
};
|
||||
function removeUserGroup( $parent ) {
|
||||
if ( bIsUpdating === true ) {
|
||||
cancelUpdate( $parent );
|
||||
} else {
|
||||
if (bIsRemoving === false) {
|
||||
alarmUtilService.hide( $parent.find(".edit") );
|
||||
alarmUtilService.show( $parent.find(".remove-cancel") );
|
||||
$parent.find(".remove").addClass("remove-confirm");
|
||||
alarmUtilService.hide( $elLoading );
|
||||
bIsRemoving = true;
|
||||
} else {
|
||||
$elLoading.show();
|
||||
var groupNumber = alarmUtilService.extractID($parent);
|
||||
alarmUtilService.sendCRUD("removeUserGroup", {"id": groupNumber}, function () {
|
||||
scope.$apply(function () {
|
||||
for (var i = 0; i < userGroupList.length; i++) {
|
||||
if (userGroupList[i].number == groupNumber) {
|
||||
userGroupList.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
alarmBroadcastService.sendSelectionEmpty();
|
||||
});
|
||||
bIsRemoving = false;
|
||||
$workingNode = null;
|
||||
alarmUtilService.setTotal($elTotal, userGroupList.length);
|
||||
alarmUtilService.hide( $elLoading );
|
||||
}, function (oServerError) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$elAlert.find(".message").html( oServerError.errorMessage );
|
||||
alarmUtilService.show( $elAlert );
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
function cancelRemoveUserGroup( $parent ) {
|
||||
bIsRemoving = false;
|
||||
$workingNode = null;
|
||||
alarmUtilService.hide( $parent.find(".remove-cancel") );
|
||||
alarmUtilService.show( $parent.find(".edit") );
|
||||
$parent.find("span.remove").removeClass("remove-confirm");
|
||||
}
|
||||
scope.onRemoveUserGroup = function( $event ) {
|
||||
cancelPreviousWork();
|
||||
$workingNode = getNode( $event );;
|
||||
removeUserGroup( $workingNode );
|
||||
};
|
||||
scope.onCancelRemoveUserGroup = function() {
|
||||
cancelRemoveUserGroup( $workingNode );
|
||||
};
|
||||
scope.onUpdateUserGroup = function( $event ) {
|
||||
cancelPreviousWork();
|
||||
bIsUpdating = true;
|
||||
$workingNode = getNode( $event );
|
||||
alarmUtilService.hide( $workingNode.find(".edit") );
|
||||
alarmUtilService.show( $workingNode.find(".edit-confirm") );
|
||||
alarmUtilService.hide( $workingNode.find(".contents") );
|
||||
$workingNode.find("input").val( $workingNode.find(".contents").html() ).show();
|
||||
$workingNode.find("input").focus();
|
||||
};
|
||||
scope.onApplyUpdateUserGroup = function() {
|
||||
var groupNumber = alarmUtilService.extractID($workingNode);
|
||||
var groupName = $workingNode.find("input").val();
|
||||
|
||||
if ( groupName === "" ) {
|
||||
$workingNode.find("input").attr("placeholder", CONSTS.ENTER_AT_LEAST).val("").focus();
|
||||
return;
|
||||
}
|
||||
alarmUtilService.show( $elLoading );
|
||||
if ( alarmUtilService.hasDuplicateItem( userGroupList, function( userGroup ) {
|
||||
return userGroup.id === groupName;
|
||||
}) ) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$workingNode.find("input").attr("placeholder", CONSTS.EXIST_A_SAME).val("").focus();
|
||||
return;
|
||||
}
|
||||
analyticsService.send( analyticsService.CONST.MAIN, analyticsService.CONST.CLK_ALARM_CREATE_USER_GROUP );
|
||||
alarmUtilService.sendCRUD( "updateUserGroup", { "number": groupNumber, "id": groupName }, function() {
|
||||
for( var i = 0 ; i < userGroupList.length ; i++ ) {
|
||||
if ( userGroupList[i].number === groupNumber ) {
|
||||
userGroupList[i].id = groupName;
|
||||
}
|
||||
}
|
||||
cancelUpdate( $parent );
|
||||
alarmUtilService.hide( $elLoading );
|
||||
}, function( oServerError ) {
|
||||
alarmUtilService.hide( $elLoading );
|
||||
$elAlert.find( ".message" ).html( oServerError.errorMessage );
|
||||
alarmUtilService.show( $elAlert );
|
||||
});
|
||||
};
|
||||
scope.$on("alarmUserGroup.configuration.show", function() {
|
||||
if ( isLoadedUserGroupList === false ) {
|
||||
loadGroupList( true );
|
||||
if ( bIsLoaded === false ) {
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
function cancelUpdate( $parent ) {
|
||||
alarmUtilService.hide( $parent.find(".edit-confirm") );
|
||||
alarmUtilService.show( $parent.find(".edit") );
|
||||
$parent.find("input").hide();
|
||||
alarmUtilService.show( $parent.find(".contents") );
|
||||
bIsUpdating = false;
|
||||
$workingNode = null;
|
||||
}
|
||||
function getNode( $event ) {
|
||||
return $( $event.toElement || $event.target ).parents("li");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,36 +1,41 @@
|
||||
<div class="some-list">
|
||||
<div class="some-list-header header-blue">
|
||||
<button class="btn btn-primary left" ng-click="onRefresh()"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button>
|
||||
<span class="title">User Group<span class="total"></span></span>
|
||||
<button class="btn btn-primary right" ng-click="onCreate()"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
|
||||
<div class="some-list" style="width:300px">
|
||||
<div class="some-list-header">
|
||||
<span class="title">User Group <span class="total"></span></span>
|
||||
<span class="right" style="text-decoration: underline;cursor:pointer" ng-click="onAddUserGroup()">+ Add</span>
|
||||
</div>
|
||||
<div class="some-list-search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="Enter at least 4 letters to search" ng-keydown="onSearchKeydown()"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button" ng-click="onSearch()">
|
||||
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="some-list-content">
|
||||
<div class="wrapper"><ul>
|
||||
<li class="new-group hide-me">
|
||||
<span class="contents"></span>
|
||||
<input type="text" placeholder="New Group" ng-keydown="onAddUserGroupKeydown($event)"/>
|
||||
<span class="glyphicon glyphicon-remove remove" aria-hidden="true" ng-click="onCancelAddUserGroup()"></span>
|
||||
<span class="glyphicon glyphicon-pencil edit" aria-hidden="true" ng-click="onApplyAddUserGroup()"></span>
|
||||
</li>
|
||||
<li ng-repeat="userGroup in userGroupList" id="{{prefix + userGroup.number}}">
|
||||
<button class="btn btn-primary left edit"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
|
||||
<span class="contents">{{userGroup.id}}</span><span class="remove">x</span>
|
||||
<span class="contents">{{userGroup.id}}</span>
|
||||
<input type="text" ng-keydown="onUpdateuserGroupKeydown($event)"/>
|
||||
<span class="glyphicon glyphicon-remove remove" aria-hidden="true" ng-click="onRemoveUserGroup($event)"></span>
|
||||
<span class="glyphicon glyphicon-arrow-left remove-cancel hide-me" aria-hidden="true" ng-click="onCancelRemoveUserGroup()"></span>
|
||||
<span class="glyphicon glyphicon-ok edit-confirm hide-me" aria-hidden="true" ng-click="onApplyUpdateUserGroup()"></span>
|
||||
<span class="glyphicon glyphicon-pencil edit" aria-hidden="true" ng-click="onUpdateUserGroup($event)"></span>
|
||||
</li>
|
||||
</ul></div>
|
||||
<div class="filter-input">
|
||||
<input type="text" placeholder="Search user group"/>
|
||||
<button class="btn btn-primary" ng-click="onSearch()" style="margin-right:2px"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="some-edit-content hide-me">
|
||||
<div>
|
||||
<div class="title-message">Create new alarm group</div>
|
||||
<input type="text" placeholder="Create New Alarm Group" ng-keydown="onInputEdit($event)"/>
|
||||
<div style="padding-top:10px;">
|
||||
<button class="btn btn-primary left" style="margin-left:5%" ng-click="onCancelEdit()"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
|
||||
<button class="btn btn-primary right" style="margin-right:5%" ng-click="onApplyEdit()"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="some-loading has-not-edit">
|
||||
<div class="some-loading">
|
||||
<div class="timer-loader"></div>
|
||||
<div class="some-alert hide-me">
|
||||
<span class="message"></span>
|
||||
<span class="close-alert" ng-click="onCloseAlert()">X</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="some-alert hide-me">
|
||||
<span class="message"></span>
|
||||
<span class="close-alert" style="color:#FFF;" ng-click="onCloseAlert()">X</span>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user