mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Image improvements (#847)
* Fix image performer filtering * Add performer images tab * Add studio images tab * Rename interface * Add tag images tab * Add path filtering for images * Show image stats on stats page * Fix incorrect scan counts after timeout * Add gallery filters * Relax scene gallery selector
This commit is contained in:
@@ -16,6 +16,7 @@ const Units: Unit[] = [
|
||||
"terabyte",
|
||||
"petabyte",
|
||||
];
|
||||
const shortUnits = ["B", "KB", "MB", "GB", "TB", "PB"];
|
||||
|
||||
const truncate = (
|
||||
value?: string,
|
||||
@@ -32,7 +33,7 @@ const fileSize = (bytes: number = 0) => {
|
||||
|
||||
let unit = 0;
|
||||
let count = bytes;
|
||||
while (count >= 1024) {
|
||||
while (count >= 1024 && unit + 1 < Units.length) {
|
||||
count /= 1024;
|
||||
unit++;
|
||||
}
|
||||
@@ -43,6 +44,11 @@ const fileSize = (bytes: number = 0) => {
|
||||
};
|
||||
};
|
||||
|
||||
const formatFileSizeUnit = (u: Unit) => {
|
||||
const i = Units.indexOf(u);
|
||||
return shortUnits[i];
|
||||
};
|
||||
|
||||
const secondsToTimestamp = (seconds: number) => {
|
||||
let ret = new Date(seconds * 1000).toISOString().substr(11, 8);
|
||||
|
||||
@@ -141,6 +147,7 @@ const formatDate = (intl: IntlShape, date?: string) => {
|
||||
const TextUtils = {
|
||||
truncate,
|
||||
fileSize,
|
||||
formatFileSizeUnit,
|
||||
secondsToTimestamp,
|
||||
fileNameFromPath,
|
||||
age: getAge,
|
||||
|
||||
Reference in New Issue
Block a user