mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-28 16:09:54 +03:00
feat: reduce the sha hash size when the tag is too long
This commit is contained in:
parent
00fe443a7c
commit
06d6293e79
2 changed files with 5 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
||||||
if (chars >= 70) {
|
if (chars >= 70) {
|
||||||
self.display_id = self.digest;
|
self.display_id = self.digest;
|
||||||
self.title = '';
|
self.title = '';
|
||||||
} else if (chars === 0) {
|
} else if (chars <= 0) {
|
||||||
self.display_id = '';
|
self.display_id = '';
|
||||||
self.title = self.digest;
|
self.title = self.digest;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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.
|
// window.innerWidth is a blocking access, cache its result.
|
||||||
const innerWidth = window.innerWidth;
|
const innerWidth = window.innerWidth;
|
||||||
var chars = 0;
|
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) {
|
if (innerWidth >= 1440) {
|
||||||
chars = 71;
|
chars = 71;
|
||||||
} else if (innerWidth < 1024) {
|
} else if (innerWidth < 1024) {
|
||||||
|
@ -101,6 +104,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// SHA256:12345678 + scaled between 1024 and 1440px
|
// SHA256:12345678 + scaled between 1024 and 1440px
|
||||||
chars = 15 + 56 * ((innerWidth - 1024) / 416);
|
chars = 15 + 56 * ((innerWidth - 1024) / 416);
|
||||||
}
|
}
|
||||||
|
if (max > 20) chars -= (max - 20);
|
||||||
registryUI.taglist.tags.map(function (image) {
|
registryUI.taglist.tags.map(function (image) {
|
||||||
image.trigger('content-digest-chars', chars);
|
image.trigger('content-digest-chars', chars);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue