mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
feat(app): push pull container details recreate
This commit is contained in:
parent
c183cb53aa
commit
7b9998bdde
3 changed files with 17 additions and 30 deletions
|
@ -8,47 +8,27 @@ angular.module('portainer.docker')
|
|||
|
||||
helper.isValidTag = isValidTag;
|
||||
helper.createImageConfigForContainer = createImageConfigForContainer;
|
||||
helper.getImagesNamesForDownload = getImagesNamesForDownload;
|
||||
helper.removeDigestFromRepository = removeDigestFromRepository;
|
||||
|
||||
function isValidTag(tag) {
|
||||
return tag.match(/^(?![\.\-])([a-zA-Z0-9\_\.\-])+$/g);
|
||||
}
|
||||
|
||||
// helper.extractImageAndRegistryFromRepository = function(repository) {
|
||||
// var slashCount = _.countBy(repository)['/'];
|
||||
// var registry = null;
|
||||
// var image = repository;
|
||||
// if (slashCount >= 1) {
|
||||
// // assume something/something[/...]
|
||||
// registry = repository.substr(0, repository.indexOf('/'));
|
||||
// // assume valid DNS name or IP (contains at least one '.')
|
||||
// if (_.countBy(registry)['.'] > 0) {
|
||||
// image = repository.substr(repository.indexOf('/') + 1);
|
||||
// } else {
|
||||
// registry = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return {
|
||||
// registry: registry,
|
||||
// image: image
|
||||
// };
|
||||
// };
|
||||
|
||||
helper.getImagesNamesForDownload = function(images) {
|
||||
function getImagesNamesForDownload(images) {
|
||||
var names = images.map(function(image) {
|
||||
return image.RepoTags[0] !== '<none>:<none>' ? image.RepoTags[0] : image.Id;
|
||||
});
|
||||
return {
|
||||
names: names
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {PorImageRegistryModel} registry
|
||||
*/
|
||||
function createImageConfigForContainer(registry) {
|
||||
console.log('registry', registry);
|
||||
const data = {
|
||||
fromImage: ''
|
||||
};
|
||||
|
@ -64,13 +44,12 @@ angular.module('portainer.docker')
|
|||
}
|
||||
|
||||
data.fromImage = fullImageName;
|
||||
console.log('FULL IMAGE NAME', fullImageName);
|
||||
return data;
|
||||
}
|
||||
|
||||
helper.removeDigestFromRepository = function(repository) {
|
||||
function removeDigestFromRepository(repository) {
|
||||
return repository.split('@sha')[0];
|
||||
};
|
||||
}
|
||||
|
||||
return helper;
|
||||
}]);
|
||||
|
|
|
@ -96,6 +96,10 @@ angular.module('portainer.docker')
|
|||
return deferred.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
* PULL IMAGE
|
||||
*/
|
||||
|
||||
function pullImageAndIgnoreErrors(imageConfiguration) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
|
@ -146,6 +150,10 @@ angular.module('portainer.docker')
|
|||
return pullImageAndAcknowledgeErrors(imageConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* ! PULL IMAGE
|
||||
*/
|
||||
|
||||
service.tagImage = function(id, image, registry) {
|
||||
void registry;
|
||||
return Image.tag({id: id, repo: image}).$promise;
|
||||
|
|
|
@ -224,9 +224,9 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
|
|||
if (!pullImage) {
|
||||
return $q.when();
|
||||
}
|
||||
return RegistryService.retrieveRegistryFromRepository(container.Config.Image)
|
||||
.then(function pullImage(containerRegistry) {
|
||||
return ImageService.pullImage(containerRegistry, true);
|
||||
return RegistryService.retrievePorRegistryModelFromRepository(container.Config.Image)
|
||||
.then(function pullImage(registryModel) {
|
||||
return ImageService.pullImage(registryModel, true);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue