mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: add limits to databases, small refactors
This commit is contained in:
@@ -44,8 +44,8 @@
|
||||
</slot>
|
||||
{/if}
|
||||
|
||||
<div class:u-flex={isFlex} class=" u-gap-12 common-section u-main-space-between">
|
||||
<div class="u-flex u-cross-child-center u-gap-16">
|
||||
<header class:u-flex={isFlex} class="u-gap-12 common-section u-main-space-between u-flex-wrap">
|
||||
<div class="u-flex u-cross-child-center u-gap-16 u-flex-wrap">
|
||||
<Heading tag={titleTag} size={titleSize}>{title}</Heading>
|
||||
{#if isCloud && limit !== 'unlimited' && limit < Infinity}
|
||||
<div
|
||||
@@ -71,7 +71,7 @@
|
||||
<div
|
||||
use:tooltip={{
|
||||
content: `Upgrade to add more ${title.toLocaleLowerCase()}`,
|
||||
disabled: total < limit || limit === 'unlimited'
|
||||
disabled: limit === 'unlimited' || total < limit
|
||||
}}>
|
||||
<Button
|
||||
on:click={buttonMethod}
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</slot>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{#if isCloud}
|
||||
<div class="u-hide">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Empty, PaginationWithLimit } from '$lib/components';
|
||||
import { Empty, PaginationWithLimit, ViewSelector } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Container, GridHeader } from '$lib/layout';
|
||||
import { Container, ContainerHeader } from '$lib/layout';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
|
||||
import type { PageData } from './$types';
|
||||
@@ -40,17 +40,20 @@
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<GridHeader
|
||||
title="Databases"
|
||||
{columns}
|
||||
view={data.view}
|
||||
hideColumns={!data.databases.total}
|
||||
hideView={!data.databases.total}>
|
||||
<Button on:click={() => (showCreate = true)} event="create_database">
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Create database</span>
|
||||
</Button>
|
||||
</GridHeader>
|
||||
<ContainerHeader title="Databases" total={data?.databases?.total}>
|
||||
<div class="u-flex u-gap-16 u-cross-center u-flex-wrap">
|
||||
<ViewSelector
|
||||
{columns}
|
||||
view={data.view}
|
||||
hideColumns={!data.databases.total}
|
||||
hideView={!data.databases.total} />
|
||||
|
||||
<Button on:click={() => (showCreate = true)} event="create_database">
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Create database</span>
|
||||
</Button>
|
||||
</div>
|
||||
</ContainerHeader>
|
||||
|
||||
{#if data.databases.total}
|
||||
{#if data.view === 'grid'}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { tierFree, tierPro, tierScale } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { updateStepStatus } from '$lib/stores/wizard';
|
||||
import { onMount } from 'svelte';
|
||||
import { changeOrganizationTier, changeTierSteps } from './store';
|
||||
|
||||
$: if ($changeOrganizationTier.billingPlan === 'tier-0' && $changeTierSteps) {
|
||||
@@ -19,6 +20,17 @@
|
||||
$changeTierSteps = updateStepStatus($changeTierSteps, 2, false);
|
||||
$changeTierSteps = updateStepStatus($changeTierSteps, 3, false);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
//Select closest tier from starting one
|
||||
if ($changeOrganizationTier.billingPlan === 'tier-2') {
|
||||
$changeOrganizationTier.billingPlan = 'tier-1';
|
||||
} else if ($changeOrganizationTier.billingPlan === 'tier-1') {
|
||||
$changeOrganizationTier.billingPlan = 'tier-2';
|
||||
} else if ($changeOrganizationTier.billingPlan === 'tier-0') {
|
||||
$changeOrganizationTier.billingPlan = 'tier-1';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<WizardStep>
|
||||
|
||||
Reference in New Issue
Block a user