mirror of https://github.com/portainer/portainer
feat(volume-creation): retrieve available drivers from the engine (#751)
parent
53f31ba3b8
commit
50305e0eee
@ -0,0 +1,15 @@
|
||||
angular.module('portainer.helpers')
|
||||
.factory('VolumeHelper', [function VolumeHelperFactory() {
|
||||
'use strict';
|
||||
var helper = {};
|
||||
|
||||
helper.createDriverOptions = function(optionArray) {
|
||||
var options = {};
|
||||
optionArray.forEach(function (option) {
|
||||
options[option.name] = option.value;
|
||||
});
|
||||
return options;
|
||||
};
|
||||
|
||||
return helper;
|
||||
}]);
|
@ -0,0 +1,20 @@
|
||||
angular.module('portainer.services')
|
||||
.factory('InfoService', ['$q', 'Info', function InfoServiceFactory($q, Info) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
|
||||
service.getVolumePlugins = function() {
|
||||
var deferred = $q.defer();
|
||||
Info.get({}).$promise
|
||||
.then(function success(data) {
|
||||
var plugins = data.Plugins.Volume;
|
||||
deferred.resolve(plugins);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({msg: 'Unable to retrieve volume plugin information', err: err});
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
Loading…
Reference in new issue