Add GitLab to registries list (#1817)

Signed-off-by: Cintia Sanchez Garcia <cynthiasg@icloud.com>
This commit is contained in:
Cintia Sánchez García 2022-02-08 13:15:17 +01:00 committed by GitHub
parent 91520ef66f
commit 04860fe13f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1 @@
<svg width="2500" height="2305" viewBox="0 0 256 236" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet"><path d="M128.075 236.075l47.104-144.97H80.97l47.104 144.97z" fill="#E24329"/><path d="M128.075 236.074L80.97 91.104H14.956l113.119 144.97z" fill="#FC6D26"/><path d="M14.956 91.104L.642 135.16a9.752 9.752 0 0 0 3.542 10.903l123.891 90.012-113.12-144.97z" fill="#FCA326"/><path d="M14.956 91.105H80.97L52.601 3.79c-1.46-4.493-7.816-4.492-9.275 0l-28.37 87.315z" fill="#E24329"/><path d="M128.075 236.074l47.104-144.97h66.015l-113.12 144.97z" fill="#FC6D26"/><path d="M241.194 91.104l14.314 44.056a9.752 9.752 0 0 1-3.543 10.903l-123.89 90.012 113.119-144.97z" fill="#FCA326"/><path d="M241.194 91.105h-66.015l28.37-87.315c1.46-4.493 7.816-4.492 9.275 0l28.37 87.315z" fill="#E24329"/></svg>

After

Width:  |  Height:  |  Size: 814 B

View File

@ -11,6 +11,7 @@ const defaultProps = {
'oci://quay.io/myproject/myimagen',
'oci://mcr.microsoft.com/myproject/myimagen',
'oci://bundle.bar/myproject/myimagen',
'oci://registry.gitlab.com/myproject/myimagen',
'oci://localhost:5000/myproject/myimagen',
],
};
@ -35,9 +36,10 @@ describe('ContainerAlternativeLocations', () => {
expect(screen.getByText('Google CR')).toBeInTheDocument();
expect(screen.getByText('Quay')).toBeInTheDocument();
expect(screen.getByText('Bundle Bar')).toBeInTheDocument();
expect(screen.getByText('GitLab Registry')).toBeInTheDocument();
expect(screen.getByText('localhost:5000')).toBeInTheDocument();
expect(screen.getAllByRole('button')).toHaveLength(8);
expect(screen.getAllByRole('button')).toHaveLength(9);
});
});

View File

@ -15,6 +15,7 @@ enum RegistryType {
Google = 'google',
Quay = 'quay',
BundleBar = 'bundlebar',
Gitlab = 'gitlab',
Unknown = 'unknown',
}
@ -57,6 +58,10 @@ const REGISTRIES: RegistryList = {
name: 'Bundle Bar',
icon: '/static/media/registries/bundlebar.svg',
},
[RegistryType.Gitlab]: {
name: 'GitLab Registry',
icon: '/static/media/registries/gitlab.svg',
},
[RegistryType.Unknown]: {
name: '',
icon: '/static/media/registries/unknown.svg',
@ -65,6 +70,7 @@ const REGISTRIES: RegistryList = {
const getRegistryData = (url: string): RegistryInfo => {
let registryType: RegistryType = RegistryType.Unknown;
// We use http as protocol to be sure that we get correct hostname
const urlToCheck = url.startsWith(OCI_PREFIX) ? url.replace(OCI_PREFIX, 'https://') : `https://${url}`;
@ -100,6 +106,9 @@ const getRegistryData = (url: string): RegistryInfo => {
case /bundle\.bar/.test(hostname):
registryType = RegistryType.BundleBar;
break;
case /gitlab\.com/.test(hostname):
registryType = RegistryType.Gitlab;
break;
}
let registry: RegistryInfo = {

View File

@ -413,6 +413,62 @@ exports[`ContainerAlternativeLocations creates snapshot 1`] = `
</div>
</div>
</div>
<div
role="listitem"
>
<div
class="d-flex flex-row align-items-center mw-100"
>
<img
alt="Registry icon"
class="me-2 icon registryIcon"
src="/static/media/registries/gitlab.svg"
/>
<div
class="text-truncate text-break url"
>
GitLab Registry
</div>
<div
class="position-relative undefined"
>
<button
aria-label="Copy registry url to clipboard"
class="btn btn-sm btn-link text-dark border-0 position-relative copyBtn"
type="button"
>
<div
aria-hidden="true"
class="d-flex flex-row align-items-center"
>
<svg
fill="none"
height="1em"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
viewBox="0 0 24 24"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<rect
height="13"
rx="2"
ry="2"
width="13"
x="9"
y="9"
/>
<path
d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
/>
</svg>
</div>
</button>
</div>
</div>
</div>
<div
role="listitem"
>