mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
chore: remove old files, cleanup
This commit is contained in:
1 parent
22446077fe
commit
1cb716dd7f
7 files changed
-311
No files matched your search
@@ -1,52 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import type { Dependencies } from '$lib/constants';
|
||||
import { InputSelect } from '$lib/elements/forms';
|
||||
import { prefs } from '$lib/stores/user';
|
||||
import { onMount } from 'svelte';
|
||||
import { Pagination } from '.';
|
||||
export let total: number;
|
||||
export let offset: number;
|
||||
export let limit: number;
|
||||
export let path: string;
|
||||
export let name: string = 'Items';
|
||||
export let dependencies: Dependencies[];
|
||||
|
||||
const options = [
|
||||
{ label: '6', value: 6 },
|
||||
{ label: '12', value: 12 },
|
||||
{ label: '24', value: 24 },
|
||||
{ label: '48', value: 48 },
|
||||
{ label: '96', value: 96 },
|
||||
{ label: '192', value: 192 }
|
||||
];
|
||||
|
||||
onMount(() => {
|
||||
prefs.load();
|
||||
$prefs?.pageLimit && (limit = $prefs.pageLimit);
|
||||
});
|
||||
|
||||
async function limitChange() {
|
||||
await prefs.updatePrefs({ ...$prefs, pageLimit: limit });
|
||||
|
||||
await Promise.allSettled([
|
||||
dependencies.forEach((dependency) => {
|
||||
invalidate(dependency);
|
||||
})
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="u-flex u-margin-block-start-32 u-main-space-between">
|
||||
<div class="u-flex u-gap-12 u-cross-center">
|
||||
<InputSelect
|
||||
id="rows"
|
||||
label="Rows per page"
|
||||
showLabel={false}
|
||||
bind:value={limit}
|
||||
{options}
|
||||
on:change={limitChange} />
|
||||
<p class="text">{name} per page. Total results: {total}</p>
|
||||
</div>
|
||||
<Pagination {offset} {limit} sum={total} {path} />
|
||||
</div>
|
||||
@@ -48,5 +48,4 @@ export { default as Heading } from './heading.svelte';
|
||||
export { default as Output } from './output.svelte';
|
||||
export { default as ViewSelector } from './viewSelector.svelte';
|
||||
export { default as LabelCard } from './labelCard.svelte';
|
||||
export { default as CustomPagination } from './customPagination.svelte';
|
||||
export { default as Limit } from './limit.svelte';
|
||||
@@ -1,40 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { CardContainer, Copy, CustomPagination, GridItem1 } from '$lib/components';
|
||||
import { CARD_LIMIT, Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
export let showCreate = false;
|
||||
|
||||
const project = $page.params.project;
|
||||
</script>
|
||||
|
||||
<CardContainer
|
||||
offset={data.offset}
|
||||
total={data.databases.total}
|
||||
on:click={() => (showCreate = true)}
|
||||
event="database">
|
||||
{#each data.databases.databases as database}
|
||||
<GridItem1 href={`${base}/console/project-${project}/databases/database-${database.$id}`}>
|
||||
<svelte:fragment slot="title">{database.name}</svelte:fragment>
|
||||
|
||||
<Copy value={database.$id}>
|
||||
<Pill button><span class="icon-duplicate" />Database ID</Pill>
|
||||
</Copy>
|
||||
</GridItem1>
|
||||
{/each}
|
||||
<svelte:fragment slot="empty">
|
||||
<p class="text">Create a new database</p>
|
||||
</svelte:fragment>
|
||||
</CardContainer>
|
||||
|
||||
<CustomPagination
|
||||
limit={CARD_LIMIT}
|
||||
name="Databases"
|
||||
path={`/console/project-${$page.params.project}/databases`}
|
||||
offset={data.offset}
|
||||
total={data.databases.total}
|
||||
dependencies={[Dependencies.DATABASES]} />
|
||||
@@ -1,15 +0,0 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export type Column = {
|
||||
id: string;
|
||||
title: string;
|
||||
show: boolean;
|
||||
width?: number;
|
||||
};
|
||||
|
||||
export const columns = writable<Column[]>([
|
||||
{ id: '$id', title: 'Database ID', show: true, width: 50 },
|
||||
{ id: 'name', title: 'Name', show: true, width: 120 },
|
||||
{ id: '$createdAt', title: 'Created', show: true, width: 120 },
|
||||
{ id: '$updatedAt', title: 'Updated', show: true, width: 120 }
|
||||
]);
|
||||
@@ -1,77 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Copy, CustomPagination } from '$lib/components';
|
||||
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import {
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableCellHead,
|
||||
TableCellText,
|
||||
TableHeader,
|
||||
TableRowLink,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import type { PageData } from './$types';
|
||||
import type { Column } from './store';
|
||||
|
||||
export let data: PageData;
|
||||
export let columns: Writable<Column[]>;
|
||||
const project = $page.params.project;
|
||||
</script>
|
||||
|
||||
<TableScroll>
|
||||
<TableHeader>
|
||||
{#each $columns as column}
|
||||
{#if column.show}
|
||||
<TableCellHead width={column.width}>{column.title}</TableCellHead>
|
||||
{/if}
|
||||
{/each}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each data.databases.databases as database}
|
||||
<TableRowLink
|
||||
href={`${base}/console/project-${project}/databases/database-${database.$id}`}>
|
||||
{#each $columns as column}
|
||||
{#if column.show}
|
||||
{#if column.id === '$id'}
|
||||
{#key $columns}
|
||||
<TableCell title={column.title}>
|
||||
<Copy value={database.$id}>
|
||||
<Pill button trim>
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
<span class="text u-trim">{database.$id}</span>
|
||||
</Pill>
|
||||
</Copy>
|
||||
</TableCell>
|
||||
{/key}
|
||||
{:else if column.id === 'name'}
|
||||
<TableCellText title={column.title}>
|
||||
{database.name}
|
||||
</TableCellText>
|
||||
{:else if column.id === '$updatedAt'}
|
||||
<TableCellText title={column.title}>
|
||||
{toLocaleDateTime(database.$updatedAt)}
|
||||
</TableCellText>
|
||||
{:else if column.id === '$createdAt'}
|
||||
<TableCellText title={column.title}>
|
||||
{toLocaleDateTime(database.$createdAt)}
|
||||
</TableCellText>
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
</TableRowLink>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
|
||||
<CustomPagination
|
||||
limit={PAGE_LIMIT}
|
||||
name="Databases"
|
||||
path={`/console/project-${$page.params.project}/databases`}
|
||||
offset={data.offset}
|
||||
total={data.databases.total}
|
||||
dependencies={[Dependencies.DATABASES]} />
|
||||
@@ -1,48 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { CardContainer, Copy, CustomPagination, GridItem1 } from '$lib/components';
|
||||
import { CARD_LIMIT, Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { createPersistentPagination } from '$lib/stores/pagination';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
export let showCreate = false;
|
||||
|
||||
const databaseId = $page.params.database;
|
||||
const project = $page.params.project;
|
||||
const offset = createPersistentPagination(CARD_LIMIT);
|
||||
</script>
|
||||
|
||||
<CardContainer
|
||||
event="collection"
|
||||
total={data.collections.total}
|
||||
offset={$offset}
|
||||
on:click={() => (showCreate = true)}>
|
||||
{#each data.collections.collections as collection}
|
||||
<GridItem1
|
||||
href={`${base}/console/project-${project}/databases/database-${databaseId}/collection-${collection.$id}`}>
|
||||
<svelte:fragment slot="title">{collection.name}</svelte:fragment>
|
||||
<svelte:fragment slot="status">
|
||||
{#if !collection.enabled}
|
||||
<Pill>disabled</Pill>
|
||||
{/if}</svelte:fragment>
|
||||
|
||||
<Copy value={collection.$id}>
|
||||
<Pill button><span class="icon-duplicate" />Collection ID</Pill>
|
||||
</Copy>
|
||||
</GridItem1>
|
||||
{/each}
|
||||
<svelte:fragment slot="empty">
|
||||
<p>Create a new collection</p>
|
||||
</svelte:fragment>
|
||||
</CardContainer>
|
||||
|
||||
<CustomPagination
|
||||
limit={CARD_LIMIT}
|
||||
name="Collections"
|
||||
path={`/console/project-${$page.params.project}/databases/database-${$page.params.database}`}
|
||||
offset={data.offset}
|
||||
total={data.collections.total}
|
||||
dependencies={[Dependencies.DATABASE]} />
|
||||
@@ -1,78 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Copy, CustomPagination } from '$lib/components';
|
||||
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import {
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableCellHead,
|
||||
TableCellText,
|
||||
TableHeader,
|
||||
TableRowLink,
|
||||
TableScroll
|
||||
} from '$lib/elements/table';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import type { PageData } from './$types';
|
||||
import type { Column } from './store';
|
||||
|
||||
export let data: PageData;
|
||||
export let columns: Writable<Column[]>;
|
||||
const project = $page.params.project;
|
||||
const databaseId = $page.params.database;
|
||||
</script>
|
||||
|
||||
<TableScroll>
|
||||
<TableHeader>
|
||||
{#each $columns as column}
|
||||
{#if column.show}
|
||||
<TableCellHead width={column.width}>{column.title}</TableCellHead>
|
||||
{/if}
|
||||
{/each}
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{#each data.collections.collections as collection}
|
||||
<TableRowLink
|
||||
href={`${base}/console/project-${project}/databases/database-${databaseId}/collection-${collection.$id}`}>
|
||||
{#each $columns as column}
|
||||
{#if column.show}
|
||||
{#if column.id === '$id'}
|
||||
{#key $columns}
|
||||
<TableCell title={column.title}>
|
||||
<Copy value={collection.$id}>
|
||||
<Pill button trim>
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
<span class="text u-trim">{collection.$id}</span>
|
||||
</Pill>
|
||||
</Copy>
|
||||
</TableCell>
|
||||
{/key}
|
||||
{:else if column.id === 'name'}
|
||||
<TableCellText title={column.title}>
|
||||
{collection.name}
|
||||
</TableCellText>
|
||||
{:else if column.id === '$updatedAt'}
|
||||
<TableCellText title={column.title}>
|
||||
{toLocaleDateTime(collection.$updatedAt)}
|
||||
</TableCellText>
|
||||
{:else if column.id === '$createdAt'}
|
||||
<TableCellText title={column.title}>
|
||||
{toLocaleDateTime(collection.$createdAt)}
|
||||
</TableCellText>
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
</TableRowLink>
|
||||
{/each}
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
|
||||
<CustomPagination
|
||||
limit={PAGE_LIMIT}
|
||||
name="Collections"
|
||||
path={`/console/project-${$page.params.project}/databases/database-${$page.params.database}`}
|
||||
offset={data.offset}
|
||||
total={data.collections.total}
|
||||
dependencies={[Dependencies.DATABASE]} />
|
||||
Reference in new issue
Block a user