Skip to content

Commit e470fed

Browse files
committed
feature: allow to hide tag history to simplify the user interface
I would like to use docker-registry-ui to inform users about the available tags for our images. The users of this interface are not interested in the technical backgrounds how it works and I worry that it would confuse them. Note: One needs to be aware, that this is data is available nonetheless. This is only a user interface switch for hiding the button.
1 parent cfbc6e7 commit e470fed

File tree

7 files changed

+21
-4
lines changed

7 files changed

+21
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Some env options are available for use this interface for **only one server** (w
119119
- `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
120120
- `TAGLIST_PAGE_SIZE`: Set the number of tags to display in one page. (default: `100`). Since 2.5.0
121121
- `REGISTRY_SECURED`: By default, the UI will check on every requests if your registry is secured or not (you will see `401` responses in your console). Set to `true` if your registry uses Basic Authentication and divide by two the number of call to your registry. (default `false`). Since 2.5.0
122-
122+
- `SHOW_TAG_HISTORY`: Whether to show the tag history feature or not. Allows to simplify the user interface by hiding it form the tag list if set to `false`. (default: `true`).
123123
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/).
124124

125125
### Theme options

bin/90-docker-registry-ui.sh

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ sed -i "s~\${PULL_URL}~${PULL_URL}~" index.html
66
sed -i "s~\${SINGLE_REGISTRY}~${SINGLE_REGISTRY}~" index.html
77
sed -i "s~\${CATALOG_ELEMENTS_LIMIT}~${CATALOG_ELEMENTS_LIMIT}~" index.html
88
sed -i "s~\${SHOW_CONTENT_DIGEST}~${SHOW_CONTENT_DIGEST}~" index.html
9+
sed -i "s~\${SHOW_TAG_HISTORY}~${SHOW_TAG_HISTORY}~" index.html
910
sed -i "s~\${DEFAULT_REGISTRIES}~${DEFAULT_REGISTRIES}~" index.html
1011
sed -i "s~\${READ_ONLY_REGISTRIES}~${READ_ONLY_REGISTRIES}~" index.html
1112
sed -i "s~\${SHOW_CATALOG_NB_TAGS}~${SHOW_CATALOG_NB_TAGS}~" index.html

src/components/docker-registry-ui.riot

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
7272
pull-url="{ state.pullUrl }"
7373
image="{ router.getTagListImage() }"
7474
show-content-digest="{ truthy(props.showContentDigest) }"
75+
show-tag-history="{ falsy(props.showTagHistory) }"
7576
is-image-remove-activated="{ truthy(props.isImageRemoveActivated) }"
7677
on-notify="{ notifySnackbar }"
7778
filter-results="{ state.filter }"
@@ -146,7 +147,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
146147
import SearchBar from './search-bar.riot';
147148
import ErrorPage from './error-page.riot';
148149
import VersionNotification from './version-notification.riot';
149-
import { stripHttps, getRegistryServers, setRegistryServers, truthy, stringToArray } from '../scripts/utils';
150+
import { stripHttps, getRegistryServers, setRegistryServers, truthy, falsy, stringToArray } from '../scripts/utils';
150151
import router from '../scripts/router';
151152
import { loadTheme } from '../scripts/theme';
152153
@@ -262,6 +263,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
262263
version,
263264
latest,
264265
truthy,
266+
falsy,
265267
stringToArray,
266268
};
267269
</script>

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

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5050
asc="{state.asc}"
5151
page="{ state.page }"
5252
show-content-digest="{props.showContentDigest}"
53+
show-tag-history="{props.showTagHistory}"
5354
is-image-remove-activated="{props.isImageRemoveActivated}"
5455
onReverseOrder="{ onReverseOrder }"
5556
registry-url="{ props.registryUrl }"

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5252
Tag
5353
</th>
5454
<th class="architectures">Arch</th>
55-
<th class="show-tag-history">History</th>
55+
<th class="show-tag-history" if="{ props.showTagHistory }">History</th>
5656
<th
5757
class="remove-tag { state.toDelete.size > 0 && !state.singleDeleteAction ? 'delete' : '' }"
5858
if="{ props.isImageRemoveActivated }"
@@ -109,7 +109,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
109109
<td class="architectures">
110110
<architectures image="{ image }"></architectures>
111111
</td>
112-
<td class="show-tag-history">
112+
<td class="show-tag-history" if="{ props.showTagHistory }">
113113
<tag-history-button image="{ image }"></tag-history-button>
114114
</td>
115115
<td if="{ props.isImageRemoveActivated }" class="remove-tag">

src/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
name="${REGISTRY_TITLE}"
4040
pull-url="${PULL_URL}"
4141
show-content-digest="${SHOW_CONTENT_DIGEST}"
42+
show-tag-history="${SHOW_TAG_HISTORY}"
4243
is-image-remove-activated="${DELETE_IMAGES}"
4344
catalog-elements-limit="${CATALOG_ELEMENTS_LIMIT}"
4445
single-registry="${SINGLE_REGISTRY}"
@@ -74,6 +75,7 @@
7475
name="Development Registry"
7576
pull-url=""
7677
show-content-digest="true"
78+
show-tag-history="true"
7779
is-image-remove-activated="true"
7880
catalog-elements-limit="1000"
7981
single-registry="false"

src/scripts/utils.js

+11
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,17 @@ export function truthy(value) {
217217
return value === true || value === 'true';
218218
}
219219

220+
/**
221+
* only is false if explicitly set to boolean false or string 'false'.
222+
* defaults to true in any other case, e.g. if empty.
223+
*
224+
* @param {string|boolean} value the input value to check
225+
* @returns {boolean} false if explicity set, true otherwise
226+
*/
227+
export function falsy(value) {
228+
return value !== false && value !== 'false';
229+
}
230+
220231
export function stringToArray(value) {
221232
return value && typeof value === 'string' ? value.split(',') : [];
222233
}

0 commit comments

Comments
 (0)