mirror of https://github.com/portainer/portainer
31 lines
914 B
JavaScript
31 lines
914 B
JavaScript
angular.module('portainer.helpers')
|
|
.factory('ImageHelper', [function ImageHelperFactory() {
|
|
'use strict';
|
|
return {
|
|
createImageConfigForCommit: function(imageName, registry) {
|
|
var imageNameAndTag = imageName.split(':');
|
|
var image = imageNameAndTag[0];
|
|
if (registry) {
|
|
image = registry + '/' + imageNameAndTag[0];
|
|
}
|
|
var imageConfig = {
|
|
repo: image,
|
|
tag: imageNameAndTag[1] ? imageNameAndTag[1] : 'latest'
|
|
};
|
|
return imageConfig;
|
|
},
|
|
createImageConfigForContainer: function (imageName, registry) {
|
|
var imageNameAndTag = imageName.split(':');
|
|
var image = imageNameAndTag[0];
|
|
if (registry) {
|
|
image = registry + '/' + imageNameAndTag[0];
|
|
}
|
|
var imageConfig = {
|
|
fromImage: image,
|
|
tag: imageNameAndTag[1] ? imageNameAndTag[1] : 'latest'
|
|
};
|
|
return imageConfig;
|
|
}
|
|
};
|
|
}]);
|