mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Remove organization storage usage from bucket view
This commit is contained in:
+2
-11
@@ -33,12 +33,7 @@
|
||||
TableRowLink
|
||||
} from '$lib/elements/table';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import {
|
||||
bytesToSize,
|
||||
calculateSize,
|
||||
humanFileSize,
|
||||
sizeToBytes
|
||||
} from '$lib/helpers/sizeConvertion';
|
||||
import { calculateSize, humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
|
||||
import { Container, ContainerHeader } from '$lib/layout';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -60,10 +55,6 @@
|
||||
|
||||
const projectId = $page.params.project;
|
||||
const bucketId = $page.params.bucket;
|
||||
const usedStorage =
|
||||
isCloud && data?.organizationUsage?.storageTotal
|
||||
? bytesToSize(data.organizationUsage.storageTotal, 'GB')
|
||||
: null;
|
||||
const getPreview = (fileId: string) =>
|
||||
sdk
|
||||
.forProject($page.params.region, $page.params.project)
|
||||
@@ -122,7 +113,7 @@
|
||||
<svelte:window on:beforeunload={beforeunload} />
|
||||
|
||||
<Container>
|
||||
<ContainerHeader title="Files" serviceId="storage" isFlex={false} total={usedStorage}>
|
||||
<ContainerHeader title="Files" serviceId="storage" isFlex={false}>
|
||||
<svelte:fragment let:isButtonDisabled>
|
||||
<SearchQuery search={data.search} placeholder="Search by filename">
|
||||
<div
|
||||
|
||||
@@ -3,31 +3,26 @@ import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, getSearch, pageToOffset } from '$lib/helpers/load';
|
||||
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
import { isCloud } from '$lib/system';
|
||||
|
||||
export const load: PageLoad = async ({ params, depends, url, route, parent }) => {
|
||||
const { organization } = await parent();
|
||||
export const load: PageLoad = async ({ params, depends, url, route }) => {
|
||||
depends(Dependencies.FILES);
|
||||
const page = getPage(url);
|
||||
const search = getSearch(url);
|
||||
const limit = getLimit(params.project, url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
const [files, organizationUsage] = await Promise.all([
|
||||
sdk
|
||||
.forProject(params.region, params.project)
|
||||
.storage.listFiles(
|
||||
params.bucket,
|
||||
[Query.limit(limit), Query.offset(offset), Query.orderDesc('')],
|
||||
search
|
||||
),
|
||||
isCloud && organization?.$id ? sdk.forConsole.billing.listUsage(organization.$id) : null
|
||||
]);
|
||||
const files = await sdk
|
||||
.forProject(params.region, params.project)
|
||||
.storage.listFiles(
|
||||
params.bucket,
|
||||
[Query.limit(limit), Query.offset(offset), Query.orderDesc('')],
|
||||
search
|
||||
);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
search,
|
||||
files,
|
||||
organizationUsage
|
||||
files
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user