From 19e72e4a5f79b1c575c2e5d87066209e310c33a0 Mon Sep 17 00:00:00 2001 From: Jones Magloire Date: Mon, 21 Mar 2022 08:28:57 +0100 Subject: [PATCH] feat(catalog): show number of tags per image (#239) --- Dockerfile | 1 + README.md | 1 + arm32v7.dockerfile | 1 + arm64v8.dockerfile | 1 + bin/entrypoint | 1 + debian.dockerfile | 1 + src/components/catalog/catalog-element.riot | 69 +++++++++++++++------ src/components/catalog/catalog.riot | 40 ++++++------ src/components/docker-registry-ui.riot | 3 +- src/index.html | 5 +- 10 files changed, 84 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b052056..6cf02c11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ WORKDIR /usr/share/nginx/html/ ENV NGINX_PROXY_HEADER_Host '$http_host' ENV NGINX_LISTEN_PORT '80' +ENV SHOW_CATALOG_NB_TAGS 'false' COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh diff --git a/README.md b/README.md index 7c3416e1..67a9254b 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ Some env options are available for use this interface for **only one server**. - `NGINX_LISTEN_PORT`: Listen on a port other than 80. (default: `80` when the user is root, `8080` otherwise). - `DEFAULT_REGISTRIES`: List of comma separated registry URLs (e.g `http://registry.example.com,http://registry:5000`), available only when `SINGLE_REGISTRY=false`. (default: ` `). - `READ_ONLY_REGISTRIES`: Desactivate dialog for remove and add new registries, available only when `SINGLE_REGISTRY=false`. (default: `false`). +- `SHOW_CATALOG_NB_TAGS`: Show number of tags per images on catalog page. This will produce + nb images requests, not recommended on large registries. (default: `false`). There are some examples with [docker-compose](https://docs.docker.com/compose/) and docker-registry-ui as proxy [here](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-proxy/) or docker-registry-ui as standalone [here](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-standalone/). diff --git a/arm32v7.dockerfile b/arm32v7.dockerfile index d0062682..85224198 100644 --- a/arm32v7.dockerfile +++ b/arm32v7.dockerfile @@ -20,6 +20,7 @@ WORKDIR /usr/share/nginx/html/ ENV NGINX_PROXY_HEADER_Host '$http_host' ENV NGINX_LISTEN_PORT '80' +ENV SHOW_CATALOG_NB_TAGS 'false' COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh diff --git a/arm64v8.dockerfile b/arm64v8.dockerfile index 52c54b7a..92df1fc0 100644 --- a/arm64v8.dockerfile +++ b/arm64v8.dockerfile @@ -20,6 +20,7 @@ WORKDIR /usr/share/nginx/html/ ENV NGINX_PROXY_HEADER_Host '$http_host' ENV NGINX_LISTEN_PORT '80' +ENV SHOW_CATALOG_NB_TAGS 'false' COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh diff --git a/bin/entrypoint b/bin/entrypoint index 72e8447b..ca0b934b 100755 --- a/bin/entrypoint +++ b/bin/entrypoint @@ -8,6 +8,7 @@ sed -i "s~\${CATALOG_ELEMENTS_LIMIT}~${CATALOG_ELEMENTS_LIMIT}~" index.html sed -i "s~\${SHOW_CONTENT_DIGEST}~${SHOW_CONTENT_DIGEST}~" index.html sed -i "s~\${DEFAULT_REGISTRIES}~${DEFAULT_REGISTRIES}~" index.html sed -i "s~\${READ_ONLY_REGISTRIES}~${READ_ONLY_REGISTRIES}~" index.html +sed -i "s~\${SHOW_CATALOG_NB_TAGS}~${SHOW_CATALOG_NB_TAGS}~" index.html if [ -z "${DELETE_IMAGES}" ] || [ "${DELETE_IMAGES}" = false ] ; then sed -i "s/\${DELETE_IMAGES}/false/" index.html diff --git a/debian.dockerfile b/debian.dockerfile index 1eff3499..2404728c 100644 --- a/debian.dockerfile +++ b/debian.dockerfile @@ -20,6 +20,7 @@ WORKDIR /usr/share/nginx/html/ ENV NGINX_PROXY_HEADER_Host '$http_host' ENV NGINX_LISTEN_PORT '80' +ENV SHOW_CATALOG_NB_TAGS 'false' COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh diff --git a/src/components/catalog/catalog-element.riot b/src/components/catalog/catalog-element.riot index 52086981..f8fd495e 100644 --- a/src/components/catalog/catalog-element.riot +++ b/src/components/catalog/catalog-element.riot @@ -16,11 +16,12 @@ along with this program. If not, see . --> -
+
- + send { state.image || state.repo } @@ -28,17 +29,28 @@ along with this program. If not, see . { state.nImages } images expand_more
+
+ { state.nbTags } tags + +
- + each="{item in state.images}" + item="{ item }" + >
-
\ No newline at end of file + diff --git a/src/components/catalog/catalog.riot b/src/components/catalog/catalog.riot index 8cd1d9db..370d78a0 100644 --- a/src/components/catalog/catalog.riot +++ b/src/components/catalog/catalog.riot @@ -26,26 +26,30 @@ along with this program. If not, see .
- + - \ No newline at end of file + diff --git a/src/components/docker-registry-ui.riot b/src/components/docker-registry-ui.riot index 8ed1b18f..094efeda 100644 --- a/src/components/docker-registry-ui.riot +++ b/src/components/docker-registry-ui.riot @@ -29,7 +29,8 @@ along with this program. If not, see . + filter-results="{ state.filter }" on-authentication="{ onAuthentication }" + show-catalog-nb-tags="{ truthy(props.showCatalogNbTags) }"/> + default-registries="${DEFAULT_REGISTRIES}" read-only-registries="${READ_ONLY_REGISTRIES}" + show-catalog-nb-tags="${SHOW_CATALOG_NB_TAGS}"> + is-image-remove-activated="true" catalog-elements-limit="1000" single-registry="false" show-catalog-nb-tags="true">