Bump versions by x.(y+1).z for next dev cycle
[dlux.git] / modules / yangui-resources / src / main / resources / yangui / cf / checkFlow.services.js
index 5a2c49c81a33103b1c1a1309d40d7a10472e27a9..3e28ab1bae47314f41682ecff28418cd0510d11a 100644 (file)
@@ -1,39 +1,36 @@
-define(['app/yangui/yangui.module', 'common/yangutils/yangutils.services'], function(yangui, yangutils) {
-
-  yangui.register.factory('checkFlow', function($http, reqBuilder, apiConnector, yangUtils) {
-
-      var fnc = function($scope) {
-          var requestPath = $scope.selApi.basePath+'/'+$scope.selSubApi.buildApiRequestString().replace('config','operational'),
-              requestData = {},
-              identifiers,
-              getPathIdentifierData = function(pathArray){
-                  var data = '';
-                      pathArray.forEach(function(item){
-                      if( item.hasIdentifier() ) {
-                          data += item.name + ': ' + item.identifierValue + '\n ';
-                      }
-                  });
-                  return data;
-              };
-
-          $http({method: "GET", url: requestPath}).success(function(data) {
-              if(data) {
-                  identifiers = getPathIdentifierData($scope.selSubApi.pathArray);
-                  alert('Flow: \n\n' + identifiers + '\n\n is in controller.');
-              }
-          }).error(function(data, status) {
-              console.info('error sending request to',requestPath,'got',status,'data',data);
-              identifiers = getPathIdentifierData($scope.selSubApi.pathArray);
-              alert('Flow: \n\n' + identifiers + '\n\n isn\'t in controller.');
-          });
-      };
-
-      return {
-        module: 'opendaylight-inventory',
-        revision: null,
-        pathString: '/config/opendaylight-inventory:nodes/node/{id}/table/{id}/flow/{id}/',
-        label: 'Verify operational flow', 
-        getCallback: fnc
-      };
-    });
+define(['app/yangui/yangui.module'], function(yangui) {\r
+\r
+  yangui.register.factory('checkFlow', function($http, YangUtilsRestangularService) {\r
+\r
+      var fnc = function($scope) {\r
+          var requestPath = $scope.selSubApi.buildApiRequestString().replace('config','operational'),\r
+              requestData = {},\r
+              getPathIdentifierData = function(pathArray){\r
+                  var data = '';\r
+                      pathArray.forEach(function(item){\r
+                      if( item.hasIdentifier() ) {\r
+                          data += item.name + ': ' + item.identifierValue + '\n ';\r
+                      }\r
+                  });\r
+                  return data;\r
+              },\r
+              identifiers = getPathIdentifierData($scope.selSubApi.pathArray);\r
+\r
+          YangUtilsRestangularService.one('restconf').customGET(requestPath).then(\r
+              function (data) {\r
+                  alert('Flow: \n\n' + identifiers + '\n\n is in controller.');\r
+              }, function (result) {\r
+                  alert('Flow: \n\n' + identifiers + '\n\n isn\'t in controller.');\r
+              }\r
+          );\r
+      };\r
+\r
+      return {\r
+        module: ['opendaylight-inventory'],\r
+        revision: null,\r
+        pathString: ['config/opendaylight-inventory:nodes/node/{id}/flow-node-inventory:table/{id}/flow/{id}/'],\r
+        label: 'Verify operational flow', \r
+        getCallback: fnc\r
+      };\r
+    });\r
 });
\ No newline at end of file