-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
212 additions
and
196 deletions.
There are no files selected for viewing
117 changes: 57 additions & 60 deletions
117
web/src/main/webapp/common/services/alarm-util.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,67 @@ | ||
(function($) { | ||
'use strict'; | ||
|
||
/** | ||
* (en) Alarm 설정의 공통된 리스트 구현 코드를 공유함. | ||
* @ko Alarm 설정의 공통된 리스트 구현 코드를 공유함. | ||
* @group Service | ||
* @name AlarmUtilService | ||
* @class | ||
*/ | ||
|
||
pinpointApp.constant('AlarmUtilServiceConfig', { | ||
"hideClass": "hide-me" | ||
}); | ||
|
||
pinpointApp.service( "AlarmUtilService", [ "AlarmUtilServiceConfig", "$timeout", "AlarmAjaxService", "SystemConfigurationService", function ( $config, $timeout, $ajaxService, SystemConfigService ) { | ||
var self = this; | ||
this.show = function( $el ) { | ||
$el.removeClass( $config.hideClass ); | ||
}; | ||
this.hide = function() { | ||
for( var i = 0 ; i < arguments.length ; i++ ) { | ||
arguments[i].addClass( $config.hideClass ); | ||
} | ||
}; | ||
this.sendCRUD = function( funcName, data, successCallback, failCallback ) { | ||
if ( ( angular.isUndefined( data ) || data === "" ) ) { | ||
data = { | ||
"userId" : ( SystemConfigService.get("userId") || "" ) | ||
}; | ||
} | ||
pinpointApp.service( "AlarmUtilService", [ "AlarmUtilServiceConfig", "$timeout", "AlarmAjaxService", "SystemConfigurationService", | ||
function ( $config, $timeout, $ajaxService, SystemConfigService ) { | ||
var self = this; | ||
this.show = function( $el ) { | ||
$el.removeClass( $config.hideClass ); | ||
}; | ||
this.hide = function() { | ||
for( var i = 0 ; i < arguments.length ; i++ ) { | ||
arguments[i].addClass( $config.hideClass ); | ||
} | ||
}; | ||
this.sendCRUD = function( funcName, data, successCallback, failCallback ) { | ||
if ( ( angular.isUndefined( data ) || data === "" ) ) { | ||
SystemConfigService.getConfig().then(function(config) { | ||
data = { | ||
"userId" : ( config["userId"] || "" ) | ||
}; | ||
}); | ||
} | ||
|
||
$timeout(function() { | ||
$ajaxService[funcName](data, function (resultData) { | ||
if (resultData.errorCode || resultData.status) { | ||
failCallback(resultData); | ||
} else { | ||
successCallback(resultData); | ||
} | ||
$timeout(function() { | ||
$ajaxService[funcName](data, function (resultData) { | ||
if (resultData.errorCode || resultData.status) { | ||
failCallback(resultData); | ||
} else { | ||
successCallback(resultData); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
this.setTotal = function( $elTotal, n ) { | ||
$elTotal.html( "(" + n + ")"); | ||
}; | ||
this.hasDuplicateItem = function( list, func ) { | ||
var len = list.length; | ||
var has = false; | ||
for( var i = 0 ; i < len ; i++ ) { | ||
if ( func( list[i] ) ) { | ||
has = true; | ||
break; | ||
}; | ||
this.setTotal = function( $elTotal, n ) { | ||
$elTotal.html( "(" + n + ")"); | ||
}; | ||
this.hasDuplicateItem = function( list, func ) { | ||
var len = list.length; | ||
var has = false; | ||
for( var i = 0 ; i < len ; i++ ) { | ||
if ( func( list[i] ) ) { | ||
has = true; | ||
break; | ||
} | ||
} | ||
} | ||
return has; | ||
}; | ||
this.closeAlert = function( $elAlert, $elLoading ) { | ||
$elAlert.animate({ | ||
height: 50, | ||
}, 100, function() { | ||
self.hide( $elAlert, $elLoading ); | ||
}); | ||
}; | ||
this.extractID = function( $el ) { | ||
return $el.prop("id").split("_")[1]; | ||
}; | ||
this.getNode = function( $event, tagName ) { | ||
return $( $event.toElement || $event.target ).parents( tagName ); | ||
}; | ||
}]); | ||
return has; | ||
}; | ||
this.closeAlert = function( $elAlert, $elLoading ) { | ||
$elAlert.animate({ | ||
height: 50 | ||
}, 100, function() { | ||
self.hide( $elAlert, $elLoading ); | ||
}); | ||
}; | ||
this.extractID = function( $el ) { | ||
return $el.prop("id").split("_")[1]; | ||
}; | ||
this.getNode = function( $event, tagName ) { | ||
return $( $event.toElement || $event.target ).parents( tagName ); | ||
}; | ||
} | ||
]); | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.