2 'app/gbp/endpoints/endpoint.service',
3 'app/gbp/endpoints/endpoints-list.service',
7 angular.module('app.gbp').controller('EndpointsController', EndpointsController);
9 EndpointsController.$inject = ['$scope', '$mdDialog', 'EndpointsListService'];
11 function EndpointsController($scope, $mdDialog, EndpointsListService) {
13 $scope.endpoints = EndpointsListService.createList();
14 $scope.disableKeyFieldsEditing = false;
15 $scope.endpointsTableQuery = {
16 order: "data['context-id']",
19 options: [25, 50, 100],
23 $scope.openEndpointDialog = openEndpointDialog;
24 $scope.getEndpointsList = getEndpointsList;
25 $scope.deleteEndpointDialog = deleteEndpointDialog;
27 $scope.getEndpointsList();
29 function getEndpointsList() {
30 $scope.endpoints.clearData();
31 $scope.rootTenant ? $scope.endpoints.getByTenantId($scope.rootTenant) : $scope.endpoints.get($scope.rootTenant);
33 $scope.endpointSgtList.clearData();
34 $scope.endpointSgtList.get();
37 function openEndpointDialog(operation, endpointData) {
38 $scope.disableKeyFieldsEditing = operation === 'edit';
40 clickOutsideToClose: true,
41 controller: 'AddEndpointController',
43 templateUrl: $scope.viewPath + 'endpoints/dialog-add-endpoint.tpl.html',
44 parent: angular.element(document.body),
47 endpoint: endpointData,
52 function deleteEndpointDialog(endpointData) {
53 var confirm = $mdDialog.confirm()
54 .title('Delete endpoint')
55 .textContent('Do you want to delete endpoint?')
59 $mdDialog.show(confirm).then(function () {
60 endpointData.deleteEndpoint(function () {
61 $scope.getEndpointsList();
68 $scope.$on('ROOT_TENANT_CHANGED', function () {
69 $scope.getEndpointsList();