Skip to content

Refactor terminologies for Databases #1816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: feat-pink-v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/commandCenter/panels/ai.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
credentials: 'include'
});

// TODO: change collections to tables after docs are updated!
const examples = [
'How to add platform in the console?',
'How can I manage users, permissions, and access control in Appwrite?',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/commandCenter/panels/createAttribute.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { initCreateAttribute } from '$routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/+layout.svelte';
import { attributeOptions } from '$routes/(console)/project-[project]/databases/database-[database]/collection-[collection]/attributes/store';
import { initCreateAttribute } from '$routes/(console)/project-[project]/databases/database-[database]/table-[table]/+layout.svelte';
import { attributeOptions } from '$routes/(console)/project-[project]/databases/database-[database]/table-[table]/columns/store';
import Template from './template.svelte';

let search = '';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/commandCenter/searchers/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const collectionsSearcher = (async (query: string) => {
label: col.name,
callback: () => {
goto(
`${base}/project-${projectId}/databases/database-${databaseId}/collection-${col.$id}`
`${base}/project-${projectId}/databases/database-${databaseId}/table-${col.$id}`
);
}
}) as const
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/columnSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

onMount(async () => {
if (isCustomCollection) {
const prefs = preferences.getCustomCollectionColumns(page.params.collection);
const prefs = preferences.getCustomCollectionColumns(page.params.table);
columns.set(
$columns.map((column) => {
column.hide = prefs?.includes(column.id) ?? false;
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/eventModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
if (selected.service) {
fields.push(selected.service.name, '*');
}
// TODO: change collections and documents terminology later
if (selected.resource?.name === 'documents') {
fields.push('collections', '*');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
{/if}
</div>
<div></div>
<span>Import all databases, including collections, indexes and attributes</span>
<span>Import all databases, including tables, indexes and columns</span>

{#if resources?.includes('document')}
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@
$showCreate = false;
await invalidate(Dependencies.DATABASE);
await goto(
`${base}/project-${project}/databases/database-${databaseId}/collection-${event.detail.$id}`
`${base}/project-${project}/databases/database-${databaseId}/table-${event.detail.$id}`
);
}

$: $registerCommands([
{
label: 'Create collection',
label: 'Create table',
callback() {
$showCreate = true;
if (!page.url.pathname.endsWith(databaseId)) {
goto(`${base}/project-${project}/databases/database-${databaseId}`);
}
},
keys: page.url.pathname.endsWith(databaseId) ? ['c'] : ['c', 'c'],
disabled: page.url.pathname.includes('collection-') || !$canWriteCollections,
disabled: page.url.pathname.includes('table-') || !$canWriteCollections,
group: 'databases',
icon: IconPlus
},
Expand Down Expand Up @@ -70,12 +70,12 @@
rank: page.url.pathname.endsWith('backups') ? 10 : 0
},
{
label: 'Go to collections',
label: 'Go to tables',
callback() {
goto(`${base}/project-${project}/databases/database-${databaseId}`);
},
disabled:
page.url.pathname.endsWith(databaseId) || page.url.pathname.includes('collection-'),
page.url.pathname.endsWith(databaseId) || page.url.pathname.includes('table-'),
keys: ['g', 'c'],
group: 'databases'
},
Expand All @@ -84,8 +84,7 @@
callback() {
goto(`${base}/project-${project}/databases/database-${databaseId}/usage`);
},
disabled:
page.url.pathname.includes('/usage') || page.url.pathname.includes('collection-'),
disabled: page.url.pathname.includes('/usage') || page.url.pathname.includes('table-'),
keys: ['g', 'u'],
group: 'databases'
},
Expand All @@ -95,7 +94,7 @@
goto(`${base}/project-${project}/databases/database-${databaseId}/backups`);
},
disabled:
page.url.pathname.includes('/backups') || page.url.pathname.includes('collection-'),
page.url.pathname.includes('/backups') || page.url.pathname.includes('table-'),
keys: ['g', 'b'],
group: 'databases'
},
Expand All @@ -106,13 +105,13 @@
},
disabled:
page.url.pathname.includes('/settings') ||
page.url.pathname.includes('collection-') ||
page.url.pathname.includes('table-') ||
!$canWriteDatabases,
keys: ['g', 's'],
group: 'databases'
},
{
label: 'Find collections',
label: 'Find tables',
callback: () => {
addSubPanel(CollectionsPanel);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
hideColumns={!data.collections.total}
hideView={!data.collections.total} />
{#if $canWriteCollections}
<Button on:click={() => ($showCreate = true)} event="create_collection">
<Button on:click={() => ($showCreate = true)} event="create_table">
<Icon icon={IconPlus} slot="start" size="s" />
Create collection
Create table
</Button>
{/if}
</Layout.Stack>
Expand All @@ -41,16 +41,17 @@
{/if}

<PaginationWithLimit
name="Collections"
name="Tables"
limit={data.limit}
offset={data.offset}
total={data.collections.total} />
{:else}
<!-- TODO: update collections docs url and content later -->
<Empty
single
allowCreate={$canWriteCollections}
href="https://appwrite.io/docs/products/databases/collections"
target="collection"
target="table"
on:click={() => ($showCreate = true)} />
{/if}
</Container>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
}
</script>

<Modal title="Create collection" size="m" bind:show={showCreate} onSubmit={create} bind:error>
<Modal title="Create table" size="m" bind:show={showCreate} onSubmit={create} bind:error>
<InputText
id="name"
label="Name"
placeholder="Enter collection name"
placeholder="Enter table name"
bind:value={name}
autofocus
required />
Expand All @@ -68,10 +68,10 @@
size="s"
on:click={() => {
showCustomId = true;
}}><Icon icon={IconPencil} /> Collection ID</Tag>
}}><Icon icon={IconPencil} /> Table ID</Tag>
</div>
{/if}
<CustomId autofocus bind:show={showCustomId} name="Collection" bind:id />
<CustomId autofocus bind:show={showCustomId} name="Table" bind:id />

<svelte:fragment slot="footer">
<Button secondary on:click={() => (showCreate = false)}>Cancel</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
disableEmpty={!$canWriteCollections}
total={data.collections.total}
on:click={() => (showCreate = true)}
event="collection">
event="table">
{#each data.collections.collections as collection}
<GridItem1
href={`${base}/project-${projectId}/databases/database-${databaseId}/collection-${collection.$id}`}>
href={`${base}/project-${projectId}/databases/database-${databaseId}/table-${collection.$id}`}>
<svelte:fragment slot="title">{collection.name}</svelte:fragment>
<svelte:fragment slot="status">
{#if !collection.enabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
const tabs = [
{
href: path,
title: 'Collections',
event: 'collections',
title: 'Tables',
event: 'tables',
hasChildren: true
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import Delete from '../delete.svelte';
import { database } from '../store';
import { Query } from '@appwrite.io/console';
import { Layout, Skeleton } from '@appwrite.io/pink-svelte';

let showDelete = false;
let showError: false | 'name' | 'email' | 'password' = false;
Expand Down Expand Up @@ -93,21 +94,21 @@

<CardGrid>
<svelte:fragment slot="title">Delete database</svelte:fragment>
The database will be permanently deleted, including all collections within it. This action
is irreversible.
The database will be permanently deleted, including all tables within it. This action is
irreversible.
<svelte:fragment slot="aside">
<BoxAvatar>
<svelte:fragment slot="title">
<h6 class="u-bold u-trim-1">{$database.name}</h6>
<span class="u-flex u-gap-8">
{#await loadCollectionCount()}
<div class="loader is-small"></div>
{:then count}
{count}
{/await}

Collections
</span>
<Layout.Stack direction="column" gap="xxs">
<h6 class="u-bold u-trim-1">{$database.name}</h6>
<span class="u-flex u-gap-8">
{#await loadCollectionCount()}
<Skeleton variant="line" width="100%" height={19.5} />
{:then count}
{count} {count === 1 ? 'Table' : 'Tables'}
{/await}
</span>
</Layout.Stack>
</svelte:fragment>
</BoxAvatar>
</svelte:fragment>
Expand Down
Loading
Loading