(Go: >> BACK << -|- >> HOME <<)

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide SHA-Hash column #131

Merged
merged 3 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like
- Add Title when using `REGISTRY_URL` (see [#28](https://github.com/Joxit/docker-registry-ui/issues/28)) **static interface**.
- 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)).

## FAQ

Expand Down
4 changes: 4 additions & 0 deletions bin/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ if [ -z "${DELETE_IMAGES}" ] || [ "${DELETE_IMAGES}" = false ] ; then
sed -i -r "s/(isImageRemoveActivated[:=])[^,;]*/\1false/" scripts/docker-registry-ui.js
fi

if [ "${SHOW_CONTENT_DIGEST}" = false ] ; then
sed -i -r "s/(showContentDigest[:=])[^,;]*/\1false/" scripts/docker-registry-ui.js
fi

get_nginx_proxy_headers() {
(
env &&
Expand Down
1 change: 1 addition & 0 deletions src/scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
var registryUI = {}
registryUI.URL_QUERY_PARAM_REGEX = /[&?]url=/;
registryUI.URL_PARAM_REGEX = /^url=/;
registryUI.showContentDigest = true;

registryUI.url = function(byPassQueryParam) {
if (!registryUI._url) {
Expand Down
1 change: 1 addition & 0 deletions src/scripts/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ registryUI.name = function() {
};
registryUI.pullUrl = '${PULL_URL}';
registryUI.isImageRemoveActivated = true;
registryUI.showContentDigest = true;
registryUI.catalog = {};
registryUI.taglist = {};
registryUI.taghistory = {};
Expand Down
8 changes: 8 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,14 @@ image-content-digest {
padding: 7px 5px;
}

taglist .creation-date {
width: 10em;
}

taglist .image-size {
width: 7em;
}

catalog material-card,
tag-history material-card {
min-height: auto;
Expand Down
2 changes: 1 addition & 1 deletion src/tags/image-content-digest.tag
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if (chars >= 70) {
self.display_id = self.digest;
self.title = '';
} else if (chars === 0) {
} else if (chars <= 0) {
self.display_id = '';
self.title = self.digest;
} else {
Expand Down
16 changes: 10 additions & 6 deletions src/tags/taglist.tag
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<table show="{ registryUI.taglist.loadend }" style="border: none;">
<thead>
<tr>
<th>Creation date</th>
<th>Size</th>
<th id="image-content-digest-header">Content Digest</th>
<th class="creation-date">Creation date</th>
<th class="image-size">Size</th>
<th id="image-content-digest-header" if="{ registryUI.showContentDigest }">Content Digest</th>

<th
id="image-tag-header"
Expand All @@ -60,13 +60,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<tr each="{ image in this.opts.tags }">
<td>
<td class="creation-date">
<image-date image="{ image }"/>
</td>
<td>
<td class="image-size">
<image-size image="{ image }"/>
</td>
<td>
<td if="{ registryUI.showContentDigest }">
<image-content-digest image="{ image }"/>
<copy-to-clipboard target="digest" image={ image }/>
</td>
Expand All @@ -93,6 +93,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// window.innerWidth is a blocking access, cache its result.
const innerWidth = window.innerWidth;
var chars = 0;
var max = registryUI.taglist.tags.reduce(function(acc, e) {
return e.tag.length > acc ? e.tag.length : acc;
}, 0);
if (innerWidth >= 1440) {
chars = 71;
} else if (innerWidth < 1024) {
Expand All @@ -101,6 +104,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// SHA256:12345678 + scaled between 1024 and 1440px
chars = 15 + 56 * ((innerWidth - 1024) / 416);
}
if (max > 20) chars -= (max - 20);
registryUI.taglist.tags.map(function (image) {
image.trigger('content-digest-chars', chars);
});
Expand Down