mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-26 23:19:54 +03:00
feat(taglist): show size with a decimal for images between 1 and 10
fixes #276
This commit is contained in:
parent
ee93d5bba8
commit
017f6620f0
4 changed files with 10 additions and 4 deletions
|
@ -41,4 +41,5 @@
|
|||
- Enrico [@Enrico204](https://github.com/Enrico204)
|
||||
- [@clyvari](https://github.com/clyvari)
|
||||
- Laszlo Boros [@Semmu](https://github.com/Semmu)
|
||||
- [@JKDingwall](https://github.com/JKDingwall)
|
||||
- [@JKDingwall](https://github.com/JKDingwall)
|
||||
- Martin Herren [@MartinHerren](https://github.com/MartinHerren)
|
||||
|
|
2
dist/docker-registry-ui.js
vendored
2
dist/docker-registry-ui.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "docker-registry-ui",
|
||||
"version": "2.3.2",
|
||||
"version": "2.3.3",
|
||||
"scripts": {
|
||||
"format": "npm run format-html && npm run format-js && npm run format-riot",
|
||||
"format-html": "find src rollup rollup.config.js -name '*.html' -exec prettier --config .prettierrc -w --parser html {} \\;",
|
||||
|
|
|
@ -8,7 +8,12 @@ export function bytesToSize(bytes) {
|
|||
return '0 Byte';
|
||||
}
|
||||
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.ceil(bytes / Math.pow(1024, i)) + ' ' + sizes[i];
|
||||
const number = bytes / Math.pow(1024, i);
|
||||
if (number < 10) {
|
||||
const decimal = (bytes - Math.floor(number) * Math.pow(1024, i)) / Math.pow(1024, i);
|
||||
return `${Math.floor(number)}.${Math.floor(decimal * 10)} ${sizes[i]}`;
|
||||
}
|
||||
return Math.ceil(number) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
export function dateFormat(date) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue