Skip to content

Commit 5a34029

Browse files
committed
feat(catalog): add CATALOG_DEFAULT_EXPANDED to expand repositories by default (#302)
closes #302
1 parent 9ebbbc3 commit 5a34029

File tree

7 files changed

+10
-3
lines changed

7 files changed

+10
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ Some env options are available for use this interface for **only one server** (w
9696
- `USE_CONTROL_CACHE_HEADER`: Use `Control-Cache` header and set to `no-store, no-cache`. This will avoid some issues on multi-arch images (see [#260](https://github.com/Joxit/docker-registry-ui/issues/260) and [#265](https://github.com/Joxit/docker-registry-ui/pull/265)). This option requires registry configuration: `Access-Control-Allow-Headers` with `Cache-Control`. (default: `false`). Since 2.3.0
9797
- `THEME`: Chose your default theme, could be `dark`, `light` or `auto` (see [#283](https://github.com/Joxit/docker-registry-ui/pull/283)). When auto is selected, you will have a switch to manually change from light to dark and vice-versa (see [#291](https://github.com/Joxit/docker-registry-ui/pull/291)). (default: `auto`). Since 2.4.0
9898
- `THEME_*`: See table in [Theme options](#theme-options) section (see [#283](https://github.com/Joxit/docker-registry-ui/pull/283)). Since 2.4.0
99-
- `TAGLIST_ORDER`: Set the default order for the taglist page, could be `num-asc;alpha-asc`, `num-desc;alpha-asc`, `num-asc;alpha-desc`, `num-desc;alpha-desc`, `alpha-asc;num-asc`, `alpha-asc;num-desc`, `alpha-desc;num-asc` or `alpha-desc;num-desc` (see [#307](https://github.com/Joxit/docker-registry-ui/pull/307)). (default: `alpha-asc;num-desc`) Since 2.5.0
99+
- `TAGLIST_ORDER`: Set the default order for the taglist page, could be `num-asc;alpha-asc`, `num-desc;alpha-asc`, `num-asc;alpha-desc`, `num-desc;alpha-desc`, `alpha-asc;num-asc`, `alpha-asc;num-desc`, `alpha-desc;num-asc` or `alpha-desc;num-desc` (see [#307](https://github.com/Joxit/docker-registry-ui/pull/307)). (default: `alpha-asc;num-desc`). Since 2.5.0
100+
- `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
100101

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

bin/90-docker-registry-ui.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ sed -i "s~\${SHOW_CATALOG_NB_TAGS}~${SHOW_CATALOG_NB_TAGS}~" index.html
1212
sed -i "s~\${HISTORY_CUSTOM_LABELS}~${HISTORY_CUSTOM_LABELS}~" index.html
1313
sed -i "s~\${USE_CONTROL_CACHE_HEADER}~${USE_CONTROL_CACHE_HEADER}~" index.html
1414
sed -i "s~\${TAGLIST_ORDER}~${TAGLIST_ORDER}~" index.html
15+
sed -i "s~\${CATALOG_DEFAULT_EXPANDED}~${CATALOG_DEFAULT_EXPANDED}~" index.html
1516

1617
grep -o 'THEME[A-Z_]*' index.html | while read e; do
1718
sed -i "s~\${$e}~$(printenv $e)~" index.html

src/components/catalog/catalog-element.riot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
7070
state.images = props.item.images;
7171
state.repo = props.item.repo;
7272
state.nImages = props.item.images.length;
73+
state.expanded = props.catalogDefaultExpanded;
7374
}
7475
if (props.showCatalogNbTags && state.image) {
7576
this.getNbTags(props, state);

src/components/catalog/catalog.riot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3434
on-notify="{ props.onNotify }"
3535
on-authentication="{ props.onAuthentication }"
3636
show-catalog-nb-tags="{ props.showCatalogNbTags }"
37+
catalog-default-expanded="{ props.catalogDefaultExpanded || state.nRepositories === 1 }"
3738
></catalog-element>
3839
<script>
3940
import CatalogElement from './catalog-element.riot';

src/components/docker-registry-ui.riot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
4141
filter-results="{ state.filter }"
4242
on-authentication="{ onAuthentication }"
4343
show-catalog-nb-tags="{ truthy(props.showCatalogNbTags) }"
44+
catalog-default-expanded="{ truthy(props.catalogDefaultExpanded) }"
4445
></catalog>
4546
</route>
4647
<route path="{baseRoute}taglist/(.*)">

src/components/tag-list/tag-list.riot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
8282
page: router.getPageQueryParam() || 1,
8383
};
8484
try {
85-
this.state.taglistOrder = taglistOrderParser(props.taglistOrder)
86-
} catch(e) {
85+
this.state.taglistOrder = taglistOrderParser(props.taglistOrder);
86+
} catch (e) {
8787
props.onNotify(e);
8888
}
8989
},

src/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
history-custom-labels="${HISTORY_CUSTOM_LABELS}"
4949
use-control-cache-header="${USE_CONTROL_CACHE_HEADER}"
5050
taglist-order="${TAGLIST_ORDER}"
51+
catalog-default-expanded="${CATALOG_DEFAULT_EXPANDED}"
5152
theme="${THEME}"
5253
theme-primary-text="${THEME_PRIMARY_TEXT}"
5354
theme-neutral-text="${THEME_NEUTRAL_TEXT}"
@@ -75,6 +76,7 @@
7576
history-custom-labels="first_custom_labels,second_custom_labels"
7677
use-control-cache-header="false"
7778
taglist-order=""
79+
catalog-default-expanded=""
7880
theme="auto"
7981
theme-primary-text=""
8082
theme-neutral-text=""

0 commit comments

Comments
 (0)