Sidepanel - templates, controllers
[groupbasedpolicy.git] / groupbasedpolicy-ui / module / src / main / resources / gbp / endpoints / add-endpoint.controller.js
index be2c06eb535c7bcbe5de637f9610f687e2959918..baeb00e08f80f0dcba595b26ea6bfe89b801bbef 100644 (file)
@@ -6,9 +6,9 @@ define([
 
     angular.module('app.gbp').controller('AddEndpointController', AddEndpointController);
 
-    AddEndpointController.$inject = ['$filter', '$mdDialog', '$scope', 'EndpointService', 'endpoint', 'ForwardingService', 'TenantService'];
+    AddEndpointController.$inject = ['$state', '$filter', '$mdDialog', '$scope', 'EndpointService', 'endpoint', 'ForwardingService'];
     /* @ngInject */
-    function AddEndpointController($filter, $mdDialog, $scope, EndpointService, endpoint, ForwardingService, TenantService) {
+    function AddEndpointController($state, $filter, $mdDialog, $scope, EndpointService, endpoint, ForwardingService) {
         /* properties */
 
         $scope.endpoint = endpoint ? endpoint : EndpointService.createObject();
@@ -46,7 +46,8 @@ define([
 
         function closeDialog(){
             $mdDialog.cancel();
-            $scope.getEndpointsList();
+            if($state.current.name == 'main.gbp.index.endpoints')
+                $scope.getEndpointsList();
         }
 
         function save() {
@@ -58,6 +59,7 @@ define([
             }
             $scope.endpoint.post(function () {
                 $scope.closeDialog();
+                $scope.broadcastFromRoot('endpointChanged');
             }, function () {
             } );
         }
@@ -86,7 +88,7 @@ define([
 
         function createFilterFor(query) {
             return function filterFn(epg) {
-                return (epg.indexOf(query) === 0);
+                return (epg.toLowerCase().indexOf(query.toLowerCase()) === 0);
             };
         }