Skip to content

Commit

Permalink
feat(taglist): add new option TAGLIST_PAGE_SIZE (Joxit#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vulwsztyn authored Jun 5, 2023
1 parent 4091baa commit 9cfb679
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Some env options are available for use this interface for **only one server** (w
- `CATALOG_DEFAULT_EXPANDED`: Expand by default all repositories in catalog (see [#302](https://github.com/Joxit/docker-registry-ui/issues/302)). (default: `false`). Since 2.5.0
- `CATALOG_MIN_BRANCHES`: Set the minimum repository/namespace to expand (e.g. `joxit/docker-registry-ui` `joxit/` is the repository/namespace). Can be 0 to disable branching. (see [#319](https://github.com/Joxit/docker-registry-ui/pull/319)). (default: `1`). Since 2.5.0
- `CATALOG_MAX_BRANCHES`: Set the maximum repository/namespace to expand (e.g. `joxit/docker-registry-ui` `joxit/` is the repository/namespace). Can be 0 to disable branching. (see [#319](https://github.com/Joxit/docker-registry-ui/pull/319)). (default: `1`). Since 2.5.0
- `TAGLIST_PAGE_SIZE`: Set the number of tags to display in one page. (default: `100`). Since 2.5.0

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/).

Expand Down
1 change: 1 addition & 0 deletions bin/90-docker-registry-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sed -i "s~\${TAGLIST_ORDER}~${TAGLIST_ORDER}~" index.html
sed -i "s~\${CATALOG_DEFAULT_EXPANDED}~${CATALOG_DEFAULT_EXPANDED}~" index.html
sed -i "s~\${CATALOG_MIN_BRANCHES}~${CATALOG_MIN_BRANCHES}~" index.html
sed -i "s~\${CATALOG_MAX_BRANCHES}~${CATALOG_MAX_BRANCHES}~" index.html
sed -i "s~\${TAGLIST_PAGE_SIZE}~${TAGLIST_PAGE_SIZE}~" index.html

grep -o 'THEME[A-Z_]*' index.html | while read e; do
sed -i "s~\${$e}~$(printenv $e)~" index.html
Expand Down
1 change: 1 addition & 0 deletions src/components/docker-registry-ui.riot
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
on-authentication="{ onAuthentication }"
use-control-cache-header="{ truthy(props.useControlCacheHeader) }"
taglist-order="{ props.taglistOrder }"
tags-per-page="{ props.tagsPerPage }"
></tag-list>
</route>
<route path="{baseRoute}taghistory/(.*)">
Expand Down
11 changes: 9 additions & 2 deletions src/components/tag-list/tag-list.riot
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<material-spinner></material-spinner>
</div>

<pagination pages="{ getPageLabels(state.page, getNumPages(state.tags)) }" onPageUpdate="{onPageUpdate}"></pagination>
<pagination
pages="{ getPageLabels(state.page, getNumPages(state.tags, props.tagsPerPage)) }"
onPageUpdate="{onPageUpdate}"
></pagination>

<tag-table
if="{ state.loadend }"
Expand All @@ -54,10 +57,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
on-notify="{ props.onNotify }"
filter-results="{ props.filterResults }"
on-authentication="{ props.onAuthentication }"
tags-per-page="{ props.tagsPerPage }"
>
</tag-table>

<pagination pages="{ getPageLabels(state.page, getNumPages(state.tags)) }" onPageUpdate="{onPageUpdate}"></pagination>
<pagination
pages="{ getPageLabels(state.page, getNumPages(state.tags, props.tagsPerPage)) }"
onPageUpdate="{onPageUpdate}"
></pagination>

<script>
import { Http } from '../../scripts/http';
Expand Down
2 changes: 1 addition & 1 deletion src/components/tag-list/tag-table.riot
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
});
},
getPage(tags, page) {
const sortedTags = getPage(tags, page);
const sortedTags = getPage(tags, page, this.props.tagsPerPage);
if (this.state.orderType === 'date') {
sortedTags.sort((e1, e2) =>
!this.state.desc
Expand Down
2 changes: 2 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
theme-footer-text="${THEME_FOOTER_TEXT}"
theme-footer-neutra-text="${THEME_FOOTER_NEUTRAL_TEXT}"
theme-footer-background="${THEME_FOOTER_BACKGROUND}"
tags-per-page="${TAGLIST_PAGE_SIZE}"
>
</docker-registry-ui>
<!-- endbuild -->
Expand Down Expand Up @@ -92,6 +93,7 @@
theme-footer-text=""
theme-footer-neutra-text=""
theme-footer-background=""
tags-per-page=""
>
</docker-registry-ui>
<!-- endbuild -->
Expand Down

0 comments on commit 9cfb679

Please sign in to comment.