mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Fix: blocked resource info
This commit is contained in:
1 parent
3b77754edf
commit
dca376c310
4 files changed
+119
-66
No files matched your search
@@ -17,6 +17,8 @@
|
||||
import { Icon, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import EmptySearch from '$lib/components/emptySearch.svelte';
|
||||
import ErrorResourceBlocked from '../errorResourceBlocked.svelte';
|
||||
import ErrorFailedToLoad from '../errorFailedToLoad.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -46,56 +48,64 @@
|
||||
]);
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<Layout.Stack direction="row" alignItems="center">
|
||||
<SearchQuery placeholder="Search by name or ID" />
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
|
||||
<ViewSelector
|
||||
{columns}
|
||||
view={data.view}
|
||||
hideColumns={!data.databases.total}
|
||||
hideView={!data.databases.total} />
|
||||
{#if $canWriteDatabases}
|
||||
<Button
|
||||
on:click={() => (showCreate = true)}
|
||||
event="create_database"
|
||||
disabled={isCreationDisabled}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Create database
|
||||
</Button>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
|
||||
{#if data.databases.total}
|
||||
{#if data.view === 'grid'}
|
||||
<Grid {data} bind:showCreate />
|
||||
{:else}
|
||||
<Table {data} />
|
||||
{/if}
|
||||
|
||||
<PaginationWithLimit
|
||||
name="Databases"
|
||||
limit={data.limit}
|
||||
offset={data.offset}
|
||||
total={data.databases.total} />
|
||||
{:else if data.search}
|
||||
<EmptySearch target="databases" hidePagination>
|
||||
<Button
|
||||
href={`${base}/project-${page.params.region}-${page.params.project}/databases`}
|
||||
size="s"
|
||||
secondary>Clear Search</Button>
|
||||
</EmptySearch>
|
||||
{#if data.error}
|
||||
{#if data.error.type === 'general_resource_blocked'}
|
||||
<ErrorResourceBlocked resource="Databases" />
|
||||
{:else}
|
||||
<Empty
|
||||
single
|
||||
href="https://appwrite.io/docs/products/databases/databases"
|
||||
target="database"
|
||||
allowCreate={$canWriteDatabases}
|
||||
on:click={() => (showCreate = true)} />
|
||||
<ErrorFailedToLoad resource="Databases" />
|
||||
{/if}
|
||||
</Container>
|
||||
{:else}
|
||||
<Container>
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<Layout.Stack direction="row" alignItems="center">
|
||||
<SearchQuery placeholder="Search by name or ID" />
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
|
||||
<ViewSelector
|
||||
{columns}
|
||||
view={data.view}
|
||||
hideColumns={!data.databases.total}
|
||||
hideView={!data.databases.total} />
|
||||
{#if $canWriteDatabases}
|
||||
<Button
|
||||
on:click={() => (showCreate = true)}
|
||||
event="create_database"
|
||||
disabled={isCreationDisabled}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Create database
|
||||
</Button>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
|
||||
<Create bind:showCreate on:created={handleCreate} />
|
||||
{#if data.databases.total}
|
||||
{#if data.view === 'grid'}
|
||||
<Grid {data} bind:showCreate />
|
||||
{:else}
|
||||
<Table {data} />
|
||||
{/if}
|
||||
|
||||
<PaginationWithLimit
|
||||
name="Databases"
|
||||
limit={data.limit}
|
||||
offset={data.offset}
|
||||
total={data.databases.total} />
|
||||
{:else if data.search}
|
||||
<EmptySearch target="databases" hidePagination>
|
||||
<Button
|
||||
href={`${base}/project-${page.params.region}-${page.params.project}/databases`}
|
||||
size="s"
|
||||
secondary>Clear Search</Button>
|
||||
</EmptySearch>
|
||||
{:else}
|
||||
<Empty
|
||||
single
|
||||
href="https://appwrite.io/docs/products/databases/databases"
|
||||
target="database"
|
||||
allowCreate={$canWriteDatabases}
|
||||
on:click={() => (showCreate = true)} />
|
||||
{/if}
|
||||
</Container>
|
||||
|
||||
<Create bind:showCreate on:created={handleCreate} />
|
||||
{/if}
|
||||
@@ -21,23 +21,35 @@ export const load: PageLoad = async ({ url, route, depends, params, parent }) =>
|
||||
// already loaded by parent.
|
||||
const { currentPlan } = await parent();
|
||||
|
||||
const { databases, policies, lastBackups } = await fetchDatabasesAndBackups(
|
||||
limit,
|
||||
offset,
|
||||
params,
|
||||
search,
|
||||
currentPlan
|
||||
);
|
||||
try {
|
||||
const { databases, policies, lastBackups } = await fetchDatabasesAndBackups(
|
||||
limit,
|
||||
offset,
|
||||
params,
|
||||
search,
|
||||
currentPlan
|
||||
);
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
view,
|
||||
search,
|
||||
policies,
|
||||
databases,
|
||||
lastBackups
|
||||
};
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
view,
|
||||
search,
|
||||
policies,
|
||||
databases,
|
||||
lastBackups
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
error: {
|
||||
type: error.type,
|
||||
},
|
||||
offset,
|
||||
limit,
|
||||
view,
|
||||
search,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
async function fetchDatabasesAndBackups(
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { Card } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
import { Typography } from '@appwrite.io/pink-svelte';
|
||||
export let resource: string;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Card>
|
||||
<Typography.Title size="s">Failed to load {resource}</Typography.Title>
|
||||
<p class="text-red-500">
|
||||
An error occurred while trying to load the {resource.toLowerCase()}. Please try again later or contact support if the issue persists.
|
||||
</p>
|
||||
</Card>
|
||||
</Container>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { Card } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
import { Typography } from '@appwrite.io/pink-svelte';
|
||||
export let resource: string;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Card>
|
||||
<Typography.Title size="s">Your {resource} is paused</Typography.Title>
|
||||
<p class="text-red-500">
|
||||
We've detected unusual activity and temporarily paused your {resource}. If you believe
|
||||
this is a mistake or need urgent access, please contact support@appwrite.io.
|
||||
</p>
|
||||
</Card>
|
||||
</Container>
|
||||
Reference in new issue
Block a user