2017-03-12 16:24:15 +00:00
|
|
|
angular.module('endpointAccess', [])
|
2017-06-20 11:00:32 +00:00
|
|
|
.controller('EndpointAccessController', ['$scope', '$stateParams', 'EndpointService', 'Notifications',
|
|
|
|
function ($scope, $stateParams, EndpointService, Notifications) {
|
2017-03-12 16:24:15 +00:00
|
|
|
|
2017-06-20 11:00:32 +00:00
|
|
|
$scope.updateAccess = function(authorizedUsers, authorizedTeams) {
|
|
|
|
return EndpointService.updateAccess($stateParams.id, authorizedUsers, authorizedTeams);
|
2017-03-12 16:24:15 +00:00
|
|
|
};
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
function initView() {
|
2017-03-12 16:24:15 +00:00
|
|
|
$('#loadingViewSpinner').show();
|
2017-06-20 11:00:32 +00:00
|
|
|
EndpointService.endpoint($stateParams.id)
|
2017-03-12 16:24:15 +00:00
|
|
|
.then(function success(data) {
|
2017-06-20 11:00:32 +00:00
|
|
|
$scope.endpoint = data;
|
2017-03-12 16:24:15 +00:00
|
|
|
})
|
|
|
|
.catch(function error(err) {
|
2017-05-23 18:56:10 +00:00
|
|
|
Notifications.error('Failure', err, 'Unable to retrieve endpoint details');
|
2017-03-12 16:24:15 +00:00
|
|
|
})
|
|
|
|
.finally(function final(){
|
|
|
|
$('#loadingViewSpinner').hide();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-05-23 18:56:10 +00:00
|
|
|
initView();
|
2017-03-12 16:24:15 +00:00
|
|
|
}]);
|