aboutsummaryrefslogtreecommitdiffstats
path: root/demo-ui/app/services/eplServices.js
diff options
context:
space:
mode:
Diffstat (limited to 'demo-ui/app/services/eplServices.js')
-rw-r--r--demo-ui/app/services/eplServices.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/demo-ui/app/services/eplServices.js b/demo-ui/app/services/eplServices.js
new file mode 100644
index 0000000..20fb7af
--- /dev/null
+++ b/demo-ui/app/services/eplServices.js
@@ -0,0 +1,64 @@
+(function(){
+
+ var eplServices = function ($http, dbg) {
+
+ var _eplBasePath = "/svcmgr/webapi/svc/epl"
+ var _eplUrl = "unset";
+
+ var setEplUrl = function (eplMgrCfg) {
+ dbg.p("in setEplUrl");
+ _eplUrl = "http://"+eplMgrCfg.ip+":"+eplMgrCfg.port+_eplBasePath;
+ dbg.p(_eplUrl);
+ }
+
+ var getEplUrl = function () {
+ dbg.p("in setEplUrl");
+ return _eplUrl;
+ }
+
+ var getEplList = function() {
+ dbg.p("in eplServices.getEplList()",2);
+ var url = _eplUrl+ "/list;"
+ dbg.p("GET: " + url , 2);
+ return $http.get(url)
+ .then(function(response){ return response.data; });
+ };
+ var createEpl = function(epl) {
+ dbg.p("in eplServices.createEpl()",2)
+ var url = _eplUrl;
+ dbg.p("POST: " + url, 2);
+ dbg.pj(epl);
+ return $http.post(url, epl)
+ .then(function(response){ return response.data; });
+ };
+ var updateEpl = function(epl) {
+ dbg.p("in eplServices.updateEpl()",2)
+ var url = _eplUrl + "/" + epl.id;
+ dbg.p("PUT: " + url, 2);
+ dbg.pj(epl);
+ return $http.put(url, epl)
+ .then(function(response){ return response.data; });
+ };
+ var deleteEpl = function(epl) {
+ dbg.p("in eplServices.deleteEpl()",2)
+ var url = _eplUrl + "/" + epl.id;
+ dbg.p("DELELE: " + url, 2);
+ dbg.pj(epl);
+ return $http.delete(url)
+ .then(function(response){ return response.data; });
+ };
+
+ return { // public API
+ setEplUrl : setEplUrl,
+ getEplUrl : getEplUrl,
+ createEpl : createEpl,
+ getEplList : getEplList,
+ deleteEpl : deleteEpl,
+ updateEpl : updateEpl
+ };
+ };
+
+ var module = angular.module("vcpe");
+ module.factory("eplServices", eplServices);
+
+}()); \ No newline at end of file