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

feat(images): enable auto completion for image names when creating a container or a service (#1355)

This commit is contained in:
Yassir Hannoun 2017-11-07 08:05:13 +01:00 committed by Anthony Lapenna
parent b9e535d7a5
commit 1b6b4733bd
5 changed files with 16 additions and 8 deletions

View file

@ -1,16 +1,21 @@
angular.module('portainer')
.controller('porImageRegistryController', ['$q', 'RegistryService', 'DockerHubService', 'Notifications',
function ($q, RegistryService, DockerHubService, Notifications) {
.controller('porImageRegistryController', ['$q', 'RegistryService', 'DockerHubService', 'ImageService', 'Notifications',
function ($q, RegistryService, DockerHubService, ImageService, Notifications) {
var ctrl = this;
ctrl.availableImages = [];
function initComponent() {
$q.all({
registries: RegistryService.registries(),
dockerhub: DockerHubService.dockerhub()
dockerhub: DockerHubService.dockerhub(),
availableImages: ctrl.autoComplete ? ImageService.images() : []
})
.then(function success(data) {
var dockerhub = data.dockerhub;
var registries = data.registries;
ctrl.availableImages = _.flatten(_.map(data.availableImages, function (image) {
return image.RepoTags ? image.RepoTags : [];
}));
ctrl.availableRegistries = [dockerhub].concat(registries);
if (!ctrl.registry.Id) {
ctrl.registry = dockerhub;