mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
Add a button next to the image field when creating a new container, which takes the user to the Docker Hub search page for this image. Version identifiers are trimmed from the image name to ensure that matching images will be found.
This commit is contained in:
parent
20f8d03366
commit
25c010ec3e
2 changed files with 25 additions and 0 deletions
|
@ -28,6 +28,14 @@
|
|||
ng-change="$ctrl.onImageChange()"
|
||||
required
|
||||
/>
|
||||
<span ng-if="$ctrl.displayedRegistryURL() === 'docker.io'" class="input-group-btn">
|
||||
<a href="https://hub.docker.com/search?type=image&q={{$ctrl.model.Image | trimshasum | trimversiontag}}"
|
||||
class="btn btn-default"
|
||||
title="Search image on Docker Hub"
|
||||
target="_blank">
|
||||
<i class="fab fa-docker"></i> Search
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -305,4 +305,21 @@ angular
|
|||
}
|
||||
return _.split(imageName, '@sha256')[0];
|
||||
};
|
||||
})
|
||||
.filter('trimversiontag', function () {
|
||||
'use strict';
|
||||
return function trimversiontag(fullName) {
|
||||
if (!fullName) {
|
||||
return fullName;
|
||||
}
|
||||
var versionIdx = fullName.lastIndexOf(':');
|
||||
if (versionIdx < 0) {
|
||||
return fullName;
|
||||
}
|
||||
var hostIdx = fullName.indexOf('/');
|
||||
if (hostIdx > versionIdx) {
|
||||
return fullName;
|
||||
}
|
||||
return fullName.substring(0, versionIdx);
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue