-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1334 from appwrite/1.6.1
1.6.1
- Loading branch information
Showing
17 changed files
with
2,051 additions
and
786 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,3 +153,4 @@ dist | |
|
||
# Sentry Config File | ||
.sentryclirc | ||
.idea |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/routes/(console)/project-[project]/databases/database-[database]/string.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<script context="module" lang="ts"> | ||
import { sdk } from '$lib/stores/sdk'; | ||
import type { Models } from '@appwrite.io/console'; | ||
export async function submitString( | ||
databaseId: string, | ||
collectionId: string, | ||
key: string, | ||
data: Partial<Models.AttributeString> | ||
) { | ||
await sdk.forProject.databases.createStringAttribute( | ||
databaseId, | ||
collectionId, | ||
key, | ||
data.size, | ||
data.required, | ||
data.default, | ||
data.array | ||
); | ||
} | ||
export async function updateString( | ||
databaseId: string, | ||
collectionId: string, | ||
data: Partial<Models.AttributeString>, | ||
originalKey?: string | ||
) { | ||
await sdk.forProject.databases.updateStringAttribute( | ||
databaseId, | ||
collectionId, | ||
originalKey, | ||
data.required, | ||
data.default, | ||
data.size, | ||
data.key !== originalKey ? data.key : undefined | ||
); | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { InputChoice, InputNumber, InputText, InputTextarea } from '$lib/elements/forms'; | ||
import { createConservative } from '$lib/helpers/stores'; | ||
export let data: Partial<Models.AttributeString> = { | ||
required: false, | ||
size: 0, | ||
default: null, | ||
array: false | ||
}; | ||
export let editing = false; | ||
let savedDefault = data.default; | ||
function handleDefaultState(hideDefault: boolean) { | ||
if (hideDefault) { | ||
savedDefault = data.default; | ||
data.default = null; | ||
} else { | ||
data.default = savedDefault; | ||
} | ||
} | ||
const { | ||
stores: { required, array }, | ||
listen | ||
} = createConservative<Partial<Models.AttributeString>>({ | ||
required: false, | ||
array: false, | ||
...data | ||
}); | ||
$: listen(data); | ||
$: handleDefaultState($required || $array); | ||
</script> | ||
|
||
<InputNumber | ||
id="size" | ||
label="Size" | ||
placeholder="Enter size" | ||
bind:value={data.size} | ||
required={!editing} | ||
readonly={editing} /> | ||
{#if data.size >= 50} | ||
<InputTextarea | ||
id="default" | ||
label="Default" | ||
placeholder="Enter string" | ||
disabled={data.required || data.array} | ||
nullable={!data.required && !data.array} | ||
maxlength={data.size} | ||
bind:value={data.default} /> | ||
{:else} | ||
<InputText | ||
id="default" | ||
label="Default" | ||
placeholder="Enter string" | ||
disabled={data.required || data.array} | ||
nullable={!data.required && !data.array} | ||
maxlength={data.size} | ||
bind:value={data.default} /> | ||
{/if} | ||
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}> | ||
Indicate whether this is a required attribute | ||
</InputChoice> | ||
<InputChoice id="array" label="Array" bind:value={data.array} disabled={data.required || editing}> | ||
Indicate whether this attribute should act as an array, with the default value set as an empty | ||
array. | ||
</InputChoice> |