fix(registry): fix order of registries in drop down menu EE-1939 (#5960)

Co-authored-by: Prabhat Khera <prabhat.khera@portainer.io>
pull/6079/head
Richard Wei 2021-11-30 11:03:08 +13:00 committed by GitHub
parent 1e80061186
commit c24dc3112b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -80,10 +80,14 @@ class porImageRegistryController {
let showDefaultRegistry = false;
this.registries = await this.EndpointService.registries(this.endpoint.Id, this.namespace);
// Sort the registries by Name
this.registries.sort((a, b) => a.Name.localeCompare(b.Name));
// hide default(anonymous) dockerhub registry if user has an authenticated one
if (!this.registries.some((registry) => registry.Type === RegistryTypes.DOCKERHUB)) {
showDefaultRegistry = true;
this.registries.push(this.defaultRegistry);
// Add dockerhub on top
this.registries.splice(0, 0, this.defaultRegistry);
}
const id = this.model.Registry.Id;