more wizard fixes

This commit is contained in:
Damodar Lohani committed 2024-09-18 14:40:53 +05:45
1 parent ffd9d52fa9
commit c37086be36
3 files changed
+29 -17

No files matched your search

+3
View File
@@ -22,6 +22,9 @@ export const canWriteTeams = derived(scopes, ($scopes) => $scopes.includes('team
export const canWriteCollections = derived(scopes, ($scopes) =>
$scopes.includes('collections.write')
);
export const canWriteDocuments = derived(scopes, ($scopes) =>
$scopes.includes('documents.write')
);
export const canWriteExecutions = derived(scopes, ($scopes) =>
$scopes.includes('executions.write')
);
@@ -7,7 +7,7 @@
import type { ColumnType } from '$lib/helpers/types';
import { Container } from '$lib/layout';
import { preferences } from '$lib/stores/preferences';
import { canWriteCollections } from '$lib/stores/roles';
import { canWriteCollections, canWriteDocuments } from '$lib/stores/roles';
import { wizard } from '$lib/stores/wizard';
import type { PageData } from './$types';
import CreateAttributeDropdown from './attributes/createAttributeDropdown.svelte';
@@ -37,6 +37,7 @@
);
function openWizard() {
if (!$canWriteDocuments) return;
wizard.start(Create);
}
@@ -114,13 +115,18 @@
</EmptySearch>
{:else}
<Empty
allowCreate={$canWriteDocuments}
single
href="https://appwrite.io/docs/products/databases/documents"
target="document"
on:click={openWizard} />
{/if}
{:else}
<Empty allowCreate={$canWriteCollections} single target="attribute" on:click={() => (showCreateDropdown = true)}>
<Empty
allowCreate={$canWriteCollections}
single
target="attribute"
on:click={() => (showCreateDropdown = true)}>
<div class="u-text-center">
<Heading size="7" tag="h2">Create an attribute to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
@@ -135,19 +141,19 @@
event="empty_documentation"
ariaLabel={`create {target}`}>Documentation</Button>
{#if $canWriteCollections}
<CreateAttributeDropdown
bind:showCreateDropdown
bind:showCreate={showCreateAttribute}
bind:selectedOption={selectedAttribute}>
<Button
secondary
event="create_attribute"
on:click={() => {
showCreateDropdown = !showCreateDropdown;
}}>
Create attribute
</Button>
</CreateAttributeDropdown>
<CreateAttributeDropdown
bind:showCreateDropdown
bind:showCreate={showCreateAttribute}
bind:selectedOption={selectedAttribute}>
<Button
secondary
event="create_attribute"
on:click={() => {
showCreateDropdown = !showCreateDropdown;
}}>
Create attribute
</Button>
</CreateAttributeDropdown>
{/if}
</div>
</Empty>
@@ -133,13 +133,14 @@
</div>
{:else}
<Empty
allowCreate={$canWriteCollections}
single
href="https://appwrite.io/docs/products/databases/collections#indexes"
target="index"
on:click={() => (showCreateIndex = true)} />
on:click={() => (showCreateIndex = $canWriteCollections)} />
{/if}
{:else}
<Empty single target="attribute" on:click={() => (showCreateDropdown = true)}>
<Empty single target="attribute" on:click={() => (showCreateDropdown = $canWriteCollections)}>
<div class="u-text-center">
<Heading size="7" tag="h2">Create an attribute to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
@@ -153,6 +154,7 @@
text
event="empty_documentation"
ariaLabel={`create {target}`}>Documentation</Button>
{#if $canWriteCollections}
<CreateAttributeDropdown
bind:showCreateDropdown
bind:showCreate={showCreateAttribute}
@@ -166,6 +168,7 @@
Create attribute
</Button>
</CreateAttributeDropdown>
{/if}
</div>
</Empty>
{/if}