From 991eaf932d5bd6be89822fe16458d63a3fda2082 Mon Sep 17 00:00:00 2001 From: Joxit Date: Sun, 3 May 2020 22:42:36 +0200 Subject: [PATCH 1/2] feat: add content element limit closes: #127 --- bin/entrypoint | 4 ++++ src/scripts/script.js | 1 + src/scripts/static.js | 1 + src/tags/catalog.tag | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/entrypoint b/bin/entrypoint index 41f056e3..dc4fd94f 100755 --- a/bin/entrypoint +++ b/bin/entrypoint @@ -12,6 +12,10 @@ if [ "${SHOW_CONTENT_DIGEST}" = false ] ; then sed -i -r "s/(showContentDigest[:=])[^,;]*/\1false/" scripts/docker-registry-ui.js fi +if [ -n "${CATALOG_ELEMENTS_LIMIT}" ] ; then + sed -i -r "s/(catalogElementsLimit[:=])[^,;]*/\1${CATALOG_ELEMENTS_LIMIT}/" scripts/docker-registry-ui.js +fi + get_nginx_proxy_headers() { ( env && diff --git a/src/scripts/script.js b/src/scripts/script.js index 70ad3834..7553643b 100644 --- a/src/scripts/script.js +++ b/src/scripts/script.js @@ -18,6 +18,7 @@ var registryUI = {} registryUI.URL_QUERY_PARAM_REGEX = /[&?]url=/; registryUI.URL_PARAM_REGEX = /^url=/; registryUI.showContentDigest = true; +registryUI.catalogElementsLimit = 100000; registryUI.url = function(byPassQueryParam) { if (!registryUI._url) { diff --git a/src/scripts/static.js b/src/scripts/static.js index 112cd153..eb5caceb 100644 --- a/src/scripts/static.js +++ b/src/scripts/static.js @@ -34,6 +34,7 @@ registryUI.name = function() { registryUI.pullUrl = '${PULL_URL}'; registryUI.isImageRemoveActivated = true; registryUI.showContentDigest = true; +registryUI.catalogElementsLimit = 100000; registryUI.catalog = {}; registryUI.taglist = {}; registryUI.taghistory = {}; diff --git a/src/tags/catalog.tag b/src/tags/catalog.tag index 5f157c1e..0c5390e5 100644 --- a/src/tags/catalog.tag +++ b/src/tags/catalog.tag @@ -68,7 +68,7 @@ along with this program. If not, see . registryUI.catalog.loadend = true; registryUI.catalog.instance.update(); }); - oReq.open('GET', registryUI.url() + '/v2/_catalog?n=100000'); + oReq.open('GET', registryUI.url() + '/v2/_catalog?n=' + registryUI.catalogElementsLimit); oReq.send(); }; registryUI.catalog.display(); From d1700ccf74f8f3600732577e964bc9d92f2ea758 Mon Sep 17 00:00:00 2001 From: Joxit Date: Sat, 23 May 2020 01:16:49 +0200 Subject: [PATCH 2/2] chore: update README for new option `CATALOG_ELEMENTS_LIMIT` --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a56f53bb..8483f644 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like - Customise docker pull command on static registry UI (see [#71](https://github.com/Joxit/docker-registry-ui/issues/71)) **static interface**. - Add custom header via environment variable and file via `NGINX_PROXY_HEADER_*` (see [#89](https://github.com/Joxit/docker-registry-ui/pull/89)) **static interface** - Show/Hide content digest in taglist via `SHOW_CONTENT_DIGEST` (values are: [`true`, `false`], default: `true`) (see [#126](https://github.com/Joxit/docker-registry-ui/issues/126)). +- Limit the number of elements in the image list via `CATALOG_ELEMENTS_LIMIT` (see [#127](https://github.com/Joxit/docker-registry-ui/pull/127)). ## FAQ @@ -255,4 +256,4 @@ check out the [Electron](examples/electron/README.md) standalone application. - [Unable to push image when docker-registry-ui is used as a proxy on non 80 port](https://github.com/Joxit/docker-registry-ui/tree/master/examples/issue-88) ([#88](https://github.com/Joxit/docker-registry-ui/issues/88)) - [Add custom headers bases on environment variable and/or file when the ui is used as proxy](https://github.com/Joxit/docker-registry-ui/tree/master/examples/proxy-headers) ([#89](https://github.com/Joxit/docker-registry-ui/pull/89)) - [UI showing same sha256 content digest for all tags + Delete is not working](https://github.com/Joxit/docker-registry-ui/tree/master/examples/issue-116) ([#116](https://github.com/Joxit/docker-registry-ui/issues/116)) -- [Electron-based Standalone Application](https://github.com/Joxit/docker-registry-ui/tree/master/examples/electron) ([#129](https://github.com/Joxit/docker-registry-ui/pull/129)) \ No newline at end of file +- [Electron-based Standalone Application](https://github.com/Joxit/docker-registry-ui/tree/master/examples/electron) ([#129](https://github.com/Joxit/docker-registry-ui/pull/129))