yangui fixes
[dlux.git] / modules / yangui-resources / src / main / resources / yangui / cf / checkFlow.services.js
1 define(['app/yangui/yangui.module', 'common/yangutils/yangutils.services'], function(yangui, yangutils) {\r
2 \r
3   yangui.register.factory('checkFlow', function($http, reqBuilder, yangUtils, YangUtilsRestangular) {\r
4 \r
5       var fnc = function($scope) {\r
6           var requestPath = $scope.selSubApi.buildApiRequestString().replace('config','operational'),\r
7               requestData = {},\r
8               getPathIdentifierData = function(pathArray){\r
9                   var data = '';\r
10                       pathArray.forEach(function(item){\r
11                       if( item.hasIdentifier() ) {\r
12                           data += item.name + ': ' + item.identifierValue + '\n ';\r
13                       }\r
14                   });\r
15                   return data;\r
16               },\r
17               identifiers = getPathIdentifierData($scope.selSubApi.pathArray);\r
18 \r
19           YangUtilsRestangular.one('restconf').customGET(requestPath).then(\r
20               function (data) {\r
21                   alert('Flow: \n\n' + identifiers + '\n\n is in controller.');\r
22               }, function (result) {\r
23                   alert('Flow: \n\n' + identifiers + '\n\n isn\'t in controller.');\r
24               }\r
25           );\r
26       };\r
27 \r
28       return {\r
29         module: ['opendaylight-inventory'],\r
30         revision: null,\r
31         pathString: ['config/opendaylight-inventory:nodes/node/{id}/flow-node-inventory:table/{id}/flow/{id}/'],\r
32         label: 'Verify operational flow', \r
33         getCallback: fnc\r
34       };\r
35     });\r
36 });