From a2b3c592df4761c8be7a196319b0efbb7d67d307 Mon Sep 17 00:00:00 2001 From: Joxit Date: Fri, 2 Apr 2021 04:56:31 +0200 Subject: [PATCH 1/2] feat(search-bar): add search bar to catalog, this will filter images --- src/components/catalog/catalog-element.riot | 23 +++++++--- src/components/catalog/catalog.riot | 2 +- src/components/docker-registry-ui.riot | 9 +++- src/components/search-bar.riot | 48 +++++++++++++++++++++ 4 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 src/components/search-bar.riot diff --git a/src/components/catalog/catalog-element.riot b/src/components/catalog/catalog-element.riot index 15f0caf..5208698 100644 --- a/src/components/catalog/catalog-element.riot +++ b/src/components/catalog/catalog-element.riot @@ -16,7 +16,8 @@ along with this program. If not, see . --> -
+
@@ -24,17 +25,20 @@ along with this program. If not, see . send { state.image || state.repo }
- { state.images.length } images + { state.nImages } images expand_more
-
diff --git a/src/components/catalog/catalog.riot b/src/components/catalog/catalog.riot index 55a5fc5..f8def0f 100644 --- a/src/components/catalog/catalog.riot +++ b/src/components/catalog/catalog.riot @@ -26,7 +26,7 @@ along with this program. If not, see .
- + + + \ No newline at end of file From b643a441130817f6a4dac6cfdc15a1b2e7fa8c3e Mon Sep 17 00:00:00 2001 From: Joxit Date: Sun, 4 Apr 2021 05:59:15 +0200 Subject: [PATCH 2/2] feat(search-bar): add search bar to tag-list, this will filter tag names --- src/components/docker-registry-ui.riot | 7 +++++-- src/components/tag-list/tag-list.riot | 13 ++++++------- src/components/tag-list/tag-table.riot | 8 ++++++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/components/docker-registry-ui.riot b/src/components/docker-registry-ui.riot index 0b6949e..3a03ce1 100644 --- a/src/components/docker-registry-ui.riot +++ b/src/components/docker-registry-ui.riot @@ -33,7 +33,8 @@ along with this program. If not, see . + is-image-remove-activated="{props.isImageRemoveActivated}" on-notify="{ notifySnackbar }" + filter-results="{ state.filter }"> . } }, onSearch(value) { - this.update({ filter: value }) + this.update({ + filter: value + }) }, baseRoute: '([^#]*?)/(\\?[^#]*?)?(#!)?(/?)', router, diff --git a/src/components/tag-list/tag-list.riot b/src/components/tag-list/tag-list.riot index a73a2be..3d220d8 100644 --- a/src/components/tag-list/tag-list.riot +++ b/src/components/tag-list/tag-list.riot @@ -39,7 +39,7 @@ along with this program. If not, see . + on-notify="{ props.onNotify }" filter-results="{ props.filterResults }"> @@ -84,15 +84,14 @@ along with this program. If not, see . const self = this; const oReq = new Http(); oReq.addEventListener('load', function () { - state.tags = []; if (this.status == 200) { - const tags = JSON.parse(this.responseText).tags || []; - state.tags = tags.map(function (tag) { - return new DockerImage(props.image, tag, null, props.registryUrl, props.onNotify); - }).sort(compare); + const tags = (JSON.parse(this.responseText).tags || []) + .map(tag => new DockerImage(props.image, tag, null, props.registryUrl, props.onNotify)) + .sort(compare); window.requestAnimationFrame(self.onResize); self.update({ - page: Math.min(state.page, getNumPages(state.tags)) + page: Math.min(state.page, getNumPages(tags)), + tags }) } else if (this.status == 404) { self.props.onNotify('Server not found', true); diff --git a/src/components/tag-list/tag-table.riot b/src/components/tag-list/tag-table.riot index 37ebf0c..9f99365 100644 --- a/src/components/tag-list/tag-table.riot +++ b/src/components/tag-list/tag-table.riot @@ -40,7 +40,7 @@ along with this program. If not, see . - + @@ -85,6 +85,9 @@ along with this program. If not, see . import RemoveImage, { deleteImage } from './remove-image.riot'; + import { + matchSearch + } from '../search-bar.riot'; export default { components: { ImageDate, @@ -135,7 +138,8 @@ along with this program. If not, see . toDelete: this.state.toDelete }) }, - getPage + getPage, + matchSearch } \ No newline at end of file