mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: stores issue, again in some places.
This commit is contained in:
@@ -11,13 +11,15 @@
|
||||
IconPlus,
|
||||
IconReact
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { currentPlan } from '$lib/stores/organization';
|
||||
import { isServiceLimited } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { page } from '$app/state';
|
||||
|
||||
$: isLimited = isServiceLimited('platforms', $organization, page.data.platforms.total);
|
||||
</script>
|
||||
|
||||
{#if $canWritePlatforms}
|
||||
{#if isCloud && $currentPlan?.platforms >= page.data.platforms.total}
|
||||
{#if isLimited}
|
||||
<Tooltip maxWidth="200px">
|
||||
<div>
|
||||
<Button disabled>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script lang="ts" context="module">
|
||||
<script lang="ts" module>
|
||||
export let showCreateBucket = writable(false);
|
||||
</script>
|
||||
|
||||
@@ -7,28 +7,34 @@
|
||||
import { Empty, PaginationWithLimit } from '$lib/components';
|
||||
import Create from './create.svelte';
|
||||
import { Container, ResponsiveContainerHeader } from '$lib/layout';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { writable } from 'svelte/store';
|
||||
import { canWriteBuckets } from '$lib/stores/roles';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { Icon, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { columns } from './store';
|
||||
import Grid from './grid.svelte';
|
||||
import Table from './table.svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import { resolveRoute } from '$lib/stores/navigation';
|
||||
import { isServiceLimited } from '$lib/stores/billing';
|
||||
import type { PageProps } from './$types';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
|
||||
export let data;
|
||||
|
||||
const project = page.params.project;
|
||||
let { data }: PageProps = $props();
|
||||
|
||||
async function bucketCreated(event: CustomEvent<Models.Bucket>) {
|
||||
showCreateBucket.set(false);
|
||||
await goto(
|
||||
`${base}/project-${page.params.region}-${project}/storage/bucket-${event.detail.$id}`
|
||||
resolveRoute('/(console)/project-[region]-[project]/storage/bucket-[bucket]', {
|
||||
...page.params,
|
||||
bucket: event.detail.$id
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const isLimited = $derived(isServiceLimited('buckets', $organization, data.buckets.total));
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -38,10 +44,21 @@
|
||||
bind:view={data.view}
|
||||
searchPlaceholder="Search by name or ID">
|
||||
{#if $canWriteBuckets}
|
||||
<Button on:click={() => ($showCreateBucket = true)} event="create_bucket" size="s">
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Create bucket
|
||||
</Button>
|
||||
<Tooltip disabled={!isLimited} maxWidth="200px">
|
||||
<div>
|
||||
<Button
|
||||
size="s"
|
||||
event="create_bucket"
|
||||
disabled={isLimited}
|
||||
on:click={() => ($showCreateBucket = true)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Create bucket
|
||||
</Button>
|
||||
</div>
|
||||
<svelte:fragment slot="tooltip">
|
||||
You have reached the maximum number of buckets for your plan.
|
||||
</svelte:fragment>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</ResponsiveContainerHeader>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user