Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@
}
},
icon: IconPlus,
group: 'rows'
group: 'rows',
disabled: !table || !$canWriteTables
},
{
label: 'Create column',
Expand All @@ -175,7 +176,7 @@
},
icon: IconPlus,
group: 'columns',
disabled: !$canWriteTables
disabled: !table || !$canWriteTables
},
{
label: 'Go to rows',
Expand Down Expand Up @@ -257,7 +258,7 @@
},
icon: IconPlus,
group: 'indexes',
disabled: !$canWriteTables
disabled: !table || !$canWriteTables
}
]);

Expand Down Expand Up @@ -385,7 +386,16 @@
<title>{table?.name ?? 'Table'} - Appwrite</title>
</svelte:head>

<slot />
{#if table}
<slot />
Comment thread
greptile-apps[bot] marked this conversation as resolved.
{:else}
<Layout.Stack alignItems="center" justifyContent="center" style="min-height: 400px;">
<Typography.Title size="m">Table deleted or not found</Typography.Title>
<Typography.Text>
The table you're looking for no longer exists or could not be found.
</Typography.Text>
</Layout.Stack>
{/if}

<SideSheet
closeOnBlur={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { LayoutLoad } from './$types';
import { Dependencies } from '$lib/constants';
import { Breadcrumbs, toDatabaseType, useDatabaseSdk } from '$database/(entity)';
import { guardResourceBlock } from '$lib/helpers/project';
import { AppwriteException } from '@appwrite.io/console';

export const load: LayoutLoad = async ({ params, depends, parent }) => {
const { database, project } = await parent();
Expand All @@ -15,10 +16,18 @@ export const load: LayoutLoad = async ({ params, depends, parent }) => {
toDatabaseType(database.type)
);

const table = await databaseSdk.getEntity({
databaseId: params.database,
entityId: params.table
});
let table = null;

try {
table = await databaseSdk.getEntity({
databaseId: params.database,
entityId: params.table
});
} catch (e) {
if (!(e instanceof AppwriteException) || e.code !== 404) {
throw e;
}
}

return {
table,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ import { buildGridQueries, extractSortFromQueries, loadGridRows } from '$databas

export const load: PageLoad = async ({ params, depends, url, route, parent }) => {
const { table } = await parent();

if (!table) {
return {
offset: 0,
limit: SPREADSHEET_PAGE_LIMIT,
view: View.Grid,
query: '',
currentSort: { column: null, direction: 'default' },
parsedQueries: new Map(),
rows: {
total: 0,
rows: []
}
};
}

depends(Dependencies.ROWS);

const page = getPage(url);
Expand Down