mirror of https://github.com/portainer/portainer
feat(registry): disable browse for quay.io registry (#2971)
* feat(registry): disable browse for quay.io registry * refactor(registry): browsable urls check done with functionpull/2981/head
parent
1138fd5ab1
commit
3d4af7c54f
|
@ -62,10 +62,10 @@
|
|||
<a ui-sref="portainer.registries.registry.access({id: item.Id})" ng-if="$ctrl.accessManagement">
|
||||
<i class="fa fa-users" aria-hidden="true"></i> Manage access
|
||||
</a>
|
||||
<a ui-sref="portainer.registries.registry.repositories({id: item.Id})" ng-if="$ctrl.registryManagement" class="space-left">
|
||||
<a ui-sref="portainer.registries.registry.repositories({id: item.Id})" ng-if="$ctrl.registryManagement && $ctrl.canBrowse(item)" class="space-left">
|
||||
<i class="fa fa-search" aria-hidden="true"></i> Browse
|
||||
</a>
|
||||
<a ui-sref="portainer.extensions.extension({id: 1})" ng-if="!$ctrl.registryManagement" class="space-left" style="color: #767676" tooltip-append-to-body="true" tooltip-placement="bottom" tooltip-class="portainer-tooltip" uib-tooltip="Feature available via an extension">
|
||||
<a ui-sref="portainer.extensions.extension({id: 1})" ng-if="!$ctrl.registryManagement && $ctrl.canBrowse(item)" class="space-left" style="color: #767676" tooltip-append-to-body="true" tooltip-placement="bottom" tooltip-class="portainer-tooltip" uib-tooltip="Feature available via an extension">
|
||||
<i class="fa fa-search" aria-hidden="true"></i> Browse (extension)
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -10,6 +10,7 @@ angular.module('portainer.app').component('registriesDatatable', {
|
|||
reverseOrder: '<',
|
||||
accessManagement: '<',
|
||||
removeAction: '<',
|
||||
registryManagement: '<'
|
||||
registryManagement: '<',
|
||||
canBrowse: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
access-management="applicationState.application.authentication && isAdmin"
|
||||
remove-action="removeAction"
|
||||
registry-management="registryManagementAvailable"
|
||||
can-browse="canBrowse"
|
||||
></registries-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import _ from 'lodash-es';
|
||||
|
||||
angular.module('portainer.app')
|
||||
.controller('RegistriesController', ['$q', '$scope', '$state', 'RegistryService', 'DockerHubService', 'ModalService', 'Notifications', 'ExtensionService', 'Authentication',
|
||||
function ($q, $scope, $state, RegistryService, DockerHubService, ModalService, Notifications, ExtensionService, Authentication) {
|
||||
|
@ -10,6 +12,12 @@ function ($q, $scope, $state, RegistryService, DockerHubService, ModalService, N
|
|||
dockerHubPassword: ''
|
||||
};
|
||||
|
||||
const nonBrowsableUrls = ['quay.io'];
|
||||
|
||||
$scope.canBrowse = function(item) {
|
||||
return ! _.includes(nonBrowsableUrls, item.URL);
|
||||
}
|
||||
|
||||
$scope.updateDockerHub = function() {
|
||||
var dockerhub = $scope.dockerhub;
|
||||
dockerhub.Password = $scope.formValues.dockerHubPassword;
|
||||
|
|
Loading…
Reference in New Issue