You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/services/api/settingsService.js

46 lines
1.2 KiB

angular.module('portainer.services')
.factory('SettingsService', ['$q', 'Settings', function SettingsServiceFactory($q, Settings) {
'use strict';
var service = {};
service.settings = function() {
var deferred = $q.defer();
Settings.get().$promise
.then(function success(data) {
var settings = new SettingsViewModel(data);
deferred.resolve(settings);
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to retrieve application settings', err: err });
});
return deferred.promise;
};
service.update = function(settings) {
return Settings.update({}, settings).$promise;
};
service.publicSettings = function() {
var deferred = $q.defer();
Settings.publicSettings().$promise
.then(function success(data) {
var settings = new SettingsViewModel(data);
deferred.resolve(settings);
})
.catch(function error(err) {
deferred.reject({ msg: 'Unable to retrieve application settings', err: err });
});
return deferred.promise;
};
service.checkLDAPConnectivity = function(settings) {
return Settings.checkLDAPConnectivity({}, settings).$promise;
};
return service;
}]);