1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 18:59:41 +02:00

feat(templates): new templates capabilities (#862)

This commit is contained in:
Anthony Lapenna 2017-05-18 23:00:08 +02:00 committed by GitHub
parent c3363604ac
commit 0579251c70
10 changed files with 276 additions and 159 deletions

View file

@ -8,10 +8,18 @@ angular.module('portainer.services')
Template.get({key: key}).$promise
.then(function success(data) {
var templates = data.map(function (tpl, idx) {
var template = new TemplateViewModel(tpl);
var template;
if (key === 'linuxserver.io') {
template = new TemplateLSIOViewModel(tpl);
} else {
template = new TemplateViewModel(tpl);
}
template.index = idx;
return template;
});
if (key === 'linuxserver.io') {
templates = TemplateHelper.filterLinuxServerIOTemplates(templates);
}
deferred.resolve(templates);
})
.catch(function error(err) {
@ -20,10 +28,6 @@ angular.module('portainer.services')
return deferred.promise;
};
service.filterLinuxServerIOTemplates = function(templates) {
return TemplateHelper.filterLinuxServerIOTemplates(templates);
};
service.createTemplateConfiguration = function(template, containerName, network, containerMapping) {
var imageConfiguration = ImageHelper.createImageConfigForContainer(template.Image, template.Registry);
var containerConfiguration = service.createContainerConfiguration(template, containerName, network, containerMapping);