Sort Collections by size (#1026)
- Adds "Size" column to Collections list view - Adds "Size" option to sort dropdown
This commit is contained in:
parent
32428f4d93
commit
cc52dfd940
@ -27,7 +27,7 @@ type SearchResult = {
|
|||||||
value: string;
|
value: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
type SortField = "modified" | "name";
|
type SortField = "modified" | "name" | "totalSize";
|
||||||
type SortDirection = "asc" | "desc";
|
type SortDirection = "asc" | "desc";
|
||||||
const INITIAL_PAGE_SIZE = 10;
|
const INITIAL_PAGE_SIZE = 10;
|
||||||
const sortableFields: Record<
|
const sortableFields: Record<
|
||||||
@ -42,6 +42,10 @@ const sortableFields: Record<
|
|||||||
label: msg("Name"),
|
label: msg("Name"),
|
||||||
defaultDirection: "asc",
|
defaultDirection: "asc",
|
||||||
},
|
},
|
||||||
|
totalSize: {
|
||||||
|
label: msg("Size"),
|
||||||
|
defaultDirection: "desc",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const MIN_SEARCH_LENGTH = 2;
|
const MIN_SEARCH_LENGTH = 2;
|
||||||
|
|
||||||
@ -365,11 +369,12 @@ export class CollectionsList extends LiteElement {
|
|||||||
return html`
|
return html`
|
||||||
<header class="py-2 text-neutral-600 leading-none">
|
<header class="py-2 text-neutral-600 leading-none">
|
||||||
<div
|
<div
|
||||||
class="hidden md:grid md:grid-cols-[repeat(2,1fr)_16ch_repeat(2,10ch)_2.5rem] gap-3"
|
class="hidden md:grid md:grid-cols-[repeat(2,1fr)_16ch_repeat(3,10ch)_2.5rem] gap-3"
|
||||||
>
|
>
|
||||||
<div class="col-span-1 text-xs pl-3">${msg("Collection Name")}</div>
|
<div class="col-span-1 text-xs pl-3">${msg("Collection Name")}</div>
|
||||||
<div class="col-span-1 text-xs">${msg("Top 3 Tags")}</div>
|
<div class="col-span-1 text-xs">${msg("Top 3 Tags")}</div>
|
||||||
<div class="col-span-1 text-xs">${msg("Last Updated")}</div>
|
<div class="col-span-1 text-xs">${msg("Last Updated")}</div>
|
||||||
|
<div class="col-span-1 text-xs">${msg("Size")}</div>
|
||||||
<div class="col-span-1 text-xs">${msg("Web Captures")}</div>
|
<div class="col-span-1 text-xs">${msg("Web Captures")}</div>
|
||||||
<div class="col-span-2 text-xs">${msg("Total Pages")}</div>
|
<div class="col-span-2 text-xs">${msg("Total Pages")}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -441,7 +446,7 @@ export class CollectionsList extends LiteElement {
|
|||||||
html`<li class="mb-2 last:mb-0">
|
html`<li class="mb-2 last:mb-0">
|
||||||
<div class="block border rounded leading-none">
|
<div class="block border rounded leading-none">
|
||||||
<div
|
<div
|
||||||
class="relative p-3 md:p-0 grid grid-cols-1 md:grid-cols-[repeat(2,1fr)_16ch_repeat(2,10ch)_2.5rem] gap-3 lg:h-10 items-center"
|
class="relative p-3 md:p-0 grid grid-cols-1 md:grid-cols-[repeat(2,1fr)_16ch_repeat(3,10ch)_2.5rem] gap-3 lg:h-10 items-center"
|
||||||
>
|
>
|
||||||
<div class="col-span-1 md:pl-3 truncate font-semibold">
|
<div class="col-span-1 md:pl-3 truncate font-semibold">
|
||||||
<a
|
<a
|
||||||
@ -470,6 +475,14 @@ export class CollectionsList extends LiteElement {
|
|||||||
minute="2-digit"
|
minute="2-digit"
|
||||||
></sl-format-date>
|
></sl-format-date>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="col-span-1 truncate text-xs text-neutral-500 font-monostyle"
|
||||||
|
>
|
||||||
|
<sl-format-bytes
|
||||||
|
value=${col.totalSize || 0}
|
||||||
|
display="narrow"
|
||||||
|
></sl-format-bytes>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col-span-1 truncate text-xs text-neutral-500 font-monostyle"
|
class="col-span-1 truncate text-xs text-neutral-500 font-monostyle"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export type Collection = {
|
|||||||
modified: string; // date
|
modified: string; // date
|
||||||
crawlCount: number;
|
crawlCount: number;
|
||||||
pageCount: number;
|
pageCount: number;
|
||||||
|
totalSize: number;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
resources: string[];
|
resources: string[];
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user