Endpoint added
[groupbasedpolicy.git] / groupbasedpolicy-ui / module / src / main / resources / gbp / endpoints / add-endpoint.controller.js
1 define([
2     'app/gbp/endpoints/endpoint.service',
3 ], function () {
4     'use strict';
5
6     angular.module('app.gbp').controller('AddEndpointController', AddEndpointController);
7
8     AddEndpointController.$inject = ['$mdDialog', '$scope', 'EndpointService', 'endpoint'];
9     /* @ngInject */
10     function AddEndpointController($mdDialog, $scope, EndpointService, endpoint) {
11         /* properties */
12         $scope.endpoint = endpoint ? endpoint : EndpointService.createObject();
13
14         /* methods */
15         $scope.closeDialog = closeDialog;
16         $scope.save = save;
17         $scope.checkEndpointGroup = checkEndpointGroup;
18         $scope.checkEndpointCondition = checkEndpointCondition;
19
20         console.log('$scope.rootTenants.data.Tenant', $scope.rootTenants.data.Tenant);
21         /* Implementations */
22
23         function closeDialog(){
24             $mdDialog.cancel();
25             $scope.getEndpointsList();
26         }
27
28         function save() {
29             $scope.endpoint.post(function () {
30                 $scope.closeDialog();
31             }, function () {
32             } );
33         }
34
35         function checkEndpointGroup(){
36             // $scope.bgpRouteForm.nextHopVal.invalidHops = $scope.bgpRoute.getInvalidHops();
37         }
38
39         function checkEndpointCondition(){
40         }
41     }
42 });