Remove GBP-UI and all Dlux dependencies
[groupbasedpolicy.git] / groupbasedpolicy-ui / module / src / main / resources / gbp / endpoints / endpoints-list.service.js
diff --git a/groupbasedpolicy-ui/module/src/main/resources/gbp/endpoints/endpoints-list.service.js b/groupbasedpolicy-ui/module/src/main/resources/gbp/endpoints/endpoints-list.service.js
deleted file mode 100644 (file)
index 369d4e3..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-define([], function () {
-    'use strict';
-
-    angular.module('app.gbp').service('EndpointsListService', EndpointsListService);
-
-    EndpointsListService.$inject = ['$filter', 'Restangular', 'EndpointService'];
-
-    function EndpointsListService($filter, Restangular, EndpointService) {
-        /* methods */
-        this.createList = createList;
-
-        function EndpointsList() {
-            /* properties */
-            this.data = [];
-
-            /* methods */
-            this.setData = setData;
-            this.get = get;
-            this.getByEpg = getByEpg;
-            this.getByTenantId = getByTenantId;
-            this.clearData = clearData;
-
-            /* Implementation */
-            /**
-             * fills EndpointsList object with data
-             * @param data
-             */
-            function setData(data) {
-                var self = this;
-
-                self.clearData();
-                data && data.forEach(function (dataElement) {
-                    self.data.push(EndpointService.createObject(dataElement));
-                });
-            }
-
-            function clearData() {
-                var self = this;
-                self.data = [];
-            }
-
-            function get() {
-                /* jshint validthis:true */
-                var self = this;
-                var restObj = Restangular.one('restconf').one('operational').one('base-endpoint:endpoints');
-
-                return restObj.get().then(function (data) {
-                    self.setData(data.endpoints['address-endpoints']['address-endpoint']);
-                });
-            }
-
-            function getByEpg(epg, tenant, successCallback) {
-                /* jshint validthis:true */
-                var self = this;
-                var restObj = Restangular.one('restconf').one('operational').one('base-endpoint:endpoints');
-
-                return restObj.get().then(function (data) {
-                    var endpoints = $filter('filter')(
-                        data.endpoints['address-endpoints']['address-endpoint'].map(function(endpoint) {
-                            return endpoint;
-                        }),
-                        function (ep) {
-                            if (ep.tenant === tenant && ep['endpoint-group'].indexOf(epg.id) !== -1) {
-                                return true;
-                            }
-                        }
-                    );
-                    self.setData(endpoints);
-
-                    (successCallback || angular.noop)();
-                });
-            }
-
-            function getByTenantId(rootTenant) {
-                var self = this;
-                var restObj = Restangular.one('restconf').one('operational').one('base-endpoint:endpoints');
-                return restObj.get().then(function (data) {
-                    var endpoints = $filter('filter')(data.endpoints['address-endpoints']['address-endpoint'].map(function(endpoint) {
-                        return endpoint;
-                    }), { 'tenant': rootTenant });
-                    self.setData(endpoints);
-                });
-            }
-
-        }
-
-        function createList() {
-            var obj = new EndpointsList();
-
-            return obj;
-        }
-    }
-
-    return EndpointsListService;
-});