Merge branch 'main' of github.com:appwrite/console into feat-custom-smtp

This commit is contained in:
Arman committed 2023-04-27 14:00:09 +02:00
commit fa21777a88
36 files changed
+204 -146

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
VITE_APPWRITE_ENDPOINT=
VITE_APPWRITE_ENDPOINT=http://localhost/v1
VITE_APPWRITE_GROWTH_ENDPOINT=
VITE_GA_PROJECT=
VITE_CONSOLE_MODE=self-hosted
+8 -3
View File
@@ -40,12 +40,17 @@ git clone https://github.com/appwrite/console.git appwrite-console
```
### 2. Install dependencies with npm
Navigate to the Appwrite Console repository and install dependencies.
```bash
npm install
cd appwrite-console && npm install
```
### 3. Setup environment variables
### 3. Install and run Appwrite locally
When you run the Appwrite Console locally, it needs to point to a backend as well. The easiest way to do this is to run an Appwrite instance locally.
Follow the [install instructions](https://appwrite.io/docs/installation) in the Appwrite docs.
### 4. Setup environment variables
Add a `.env` file by copying the `.env.example` file as a template in the project's root directory.
+1 -1
View File
@@ -42,7 +42,7 @@
<div class="u-text-center">
<Heading size="7" tag="h2">Create your first {target} to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
Need a hand? Check out our documentation.
Need a hand? Learn more in our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
+1 -1
View File
@@ -31,7 +31,7 @@
}
}
}
checkOverflow();
requestAnimationFrame(checkOverflow);
window.addEventListener('resize', checkOverflow);
return {
+1 -1
View File
@@ -134,7 +134,7 @@
You have no teams. Create a team to see them here.
</p>
<p class="text u-line-height-1-5">
Need a hand? Check out our <a
Need a hand? Learn more in our <a
href="https://appwrite.io/docs/client/teams"
target="_blank"
rel="noopener noreferrer">
+1 -1
View File
@@ -153,7 +153,7 @@
You have no users. Create a user to see them here.
</p>
<p class="text u-line-height-1-5">
Need a hand? Check out our <a
Need a hand? Learn more in our <a
href="https://appwrite.io/docs/server/users"
target="_blank"
rel="noopener noreferrer">
+1 -1
View File
@@ -84,7 +84,7 @@
bind:value
bind:this={element}
on:invalid={handleInvalid}
style:--amount-of-buttons={required ? 0 : 1.75} />
style:--amount-of-buttons={nullable && !required ? 1.75 : 0} />
<ul
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
{#if nullable && !required}
+9 -7
View File
@@ -27,15 +27,17 @@
error = element.validationMessage;
};
$: if (element && required && !value) {
element.setCustomValidity('This field is required');
const isNotEmpty = (value: string | number | boolean) => {
return typeof value === 'boolean' ? true : !!value;
};
$: if (required && !isNotEmpty(value)) {
element?.setCustomValidity('This field is required');
} else {
element?.setCustomValidity('');
}
$: if (element && required && value) {
element.setCustomValidity('');
}
$: if (value) {
$: if (isNotEmpty(value)) {
error = null;
}
+18 -13
View File
@@ -53,6 +53,9 @@
value = prevValue;
}
}
$: showTextCounter = !!maxlength;
$: showNullCheckbox = nullable && !required;
</script>
<FormItem>
@@ -75,19 +78,21 @@
class:u-padding-inline-end-56={typeof maxlength === 'number'}
bind:this={element}
on:invalid={handleInvalid} />
<ul
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
{#if maxlength}
<li class="buttons-list-item">
<TextCounter max={maxlength} count={value?.length ?? 0} />
</li>
{/if}
{#if nullable && !required}
<li class="buttons-list-item">
<NullCheckbox checked={value === null} on:change={handleNullChange} />
</li>
{/if}
</ul>
{#if showTextCounter || showNullCheckbox}
<ul
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
{#if showTextCounter}
<li class="buttons-list-item">
<TextCounter max={maxlength} count={value?.length ?? 0} />
</li>
{/if}
{#if showNullCheckbox}
<li class="buttons-list-item">
<NullCheckbox checked={value === null} on:change={handleNullChange} />
</li>
{/if}
</ul>
{/if}
</div>
{#if error}
<Helper type="warning">{error}</Helper>
+19 -14
View File
@@ -51,6 +51,9 @@
value = prevValue;
}
}
$: showTextCounter = !!maxlength;
$: showNullCheckbox = nullable && !required;
</script>
<FormItem>
@@ -73,20 +76,22 @@
bind:this={element}
on:invalid={handleInvalid}
style:--amount-of-buttons={required ? undefined : 0.25} />
<ul
class="buttons-list u-gap-8 u-cross-center u-position-absolute d u-inset-block-end-1 u-inset-inline-end-1 u-padding-block-8 u-padding-inline-12"
style="border-end-end-radius:0.0625rem;">
{#if maxlength}
<li class="buttons-list-item">
<TextCounter max={maxlength} count={value?.length ?? 0} />
</li>
{/if}
{#if nullable && !required}
<li class="buttons-list-item">
<NullCheckbox checked={value === null} on:change={handleNullChange} />
</li>
{/if}
</ul>
{#if showTextCounter || showNullCheckbox}
<ul
class="buttons-list u-gap-8 u-cross-center u-position-absolute d u-inset-block-end-1 u-inset-inline-end-1 u-padding-block-8 u-padding-inline-12"
style="border-end-end-radius:0.0625rem;">
{#if showTextCounter}
<li class="buttons-list-item">
<TextCounter max={maxlength} count={value?.length ?? 0} />
</li>
{/if}
{#if showNullCheckbox}
<li class="buttons-list-item">
<NullCheckbox checked={value === null} on:change={handleNullChange} />
</li>
{/if}
</ul>
{/if}
</div>
{#if error}
+27 -7
View File
@@ -1,6 +1,8 @@
<script lang="ts">
import { onMount } from 'svelte';
import { FormItem, Helper, Label } from '.';
import NullCheckbox from './nullCheckbox.svelte';
import TextCounter from './textCounter.svelte';
export let label: string;
export let optionalText: string | undefined = undefined;
@@ -9,6 +11,7 @@
export let value = '';
export let placeholder = '';
export let required = false;
export let nullable = false;
export let disabled = false;
export let readonly = false;
export let autofocus = false;
@@ -39,15 +42,20 @@
error = element.validationMessage;
};
const handleInput = () => {
if (value === '') {
value = null;
}
};
$: if (value) {
error = null;
}
let prevValue = '';
function handleNullChange(e: CustomEvent<boolean>) {
const isNull = e.detail;
if (isNull) {
prevValue = value;
value = null;
} else {
value = prevValue;
}
}
</script>
<FormItem>
@@ -66,9 +74,21 @@
type="url"
autocomplete={autocomplete ? 'on' : 'off'}
bind:value
on:input={handleInput}
bind:this={element}
on:invalid={handleInvalid} />
<ul
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
{#if maxlength}
<li class="buttons-list-item">
<TextCounter max={maxlength} count={value?.length ?? 0} />
</li>
{/if}
{#if nullable && !required}
<li class="buttons-list-item">
<NullCheckbox checked={value === null} on:change={handleNullChange} />
</li>
{/if}
</ul>
</div>
{#if error}
<Helper type="warning">{error}</Helper>
+6
View File
@@ -11,6 +11,12 @@ async function securedCopy(value: string) {
function unsecuredCopy(value: string) {
const textArea = document.createElement('textarea');
textArea.value = value;
// Avoid scrolling to bottom
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.position = 'fixed';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
@@ -75,7 +75,7 @@
<div class="u-text-center">
<Heading size="7" tag="h2">Create your first attribute to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
Need a hand? Check out our documentation.
Need a hand? Learn more in our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
@@ -180,7 +180,7 @@
<div class="u-text-center">
<Heading size="7" tag="h2">Create your first attribute to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
Need a hand? Check out our documentation.
Need a hand? Learn more in our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
@@ -34,8 +34,7 @@
</script>
<script lang="ts">
import { InputChoice } from '$lib/elements/forms';
import Boolean from '../document-[document]/attributes/boolean.svelte';
import { InputChoice, InputSelect } from '$lib/elements/forms';
export let editing = false;
export let data: Partial<Models.AttributeBoolean> = {
@@ -49,18 +48,17 @@
}
</script>
<Boolean
<InputSelect
id="default"
label="Default value"
bind:value={data.default}
attribute={{
key: data.key,
required: data.required,
status: 'enabled',
type: 'boolean',
array: data.array
}}
disabled={data.array || data.required} />
placeholder="Select a value"
disabled={data.required || data.array}
options={[
{ label: 'NULL', value: null },
{ label: 'True', value: true },
{ label: 'False', value: false }
]}
bind:value={data.default} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
</InputChoice>
@@ -48,7 +48,7 @@
id="default"
label="Default value"
bind:value={data.default}
disabled={data.required} />
disabled={data.required || data.array} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
</InputChoice>
@@ -71,31 +71,19 @@
</svelte:fragment>
<FormList>
{#if selectedAttribute?.type !== 'relationship'}
<div>
<InputText
id="key"
label="Attribute Key"
placeholder="Enter Key"
bind:value={selectedAttribute.key}
autofocus
required
readonly />
<div class="u-flex u-gap-4 u-margin-block-start-8 u-small">
<span
class="icon-info u-cross-center u-margin-block-start-2 u-line-height-1 u-icon-small"
aria-hidden="true" />
<span class="text u-line-height-1-5">
Allowed characters: alphanumeric, hyphen, non-leading underscore, period
</span>
</div>
</div>
<InputText
id="key"
label="Attribute Key"
placeholder="Enter Key"
bind:value={selectedAttribute.key}
autofocus
readonly />
{/if}
{#if option}
<svelte:component
this={option.component}
bind:data={selectedAttribute}
editing
bind:data={selectedAttribute}
on:close={() => (option = null)} />
{/if}
</FormList>
@@ -50,7 +50,8 @@
label="Default value"
placeholder="Enter value"
bind:value={data.default}
disabled={data.required} />
disabled={data.required || data.array}
nullable={!data.required && !data.array} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
</InputChoice>
@@ -36,8 +36,7 @@
</script>
<script lang="ts">
import { InputChoice, InputTags } from '$lib/elements/forms';
import Enum from '../document-[document]/attributes/enum.svelte';
import { InputChoice, InputSelect, InputTags } from '$lib/elements/forms';
export let editing = false;
export let data: Partial<Models.AttributeEnum>;
@@ -45,6 +44,20 @@
$: if (data.required || data.array) {
data.default = null;
}
$: options = [
...(data?.elements ?? []).map((element) => {
return {
label: element,
value: element
};
}),
!data.required &&
!data.array && {
label: 'NULL',
value: null
}
].filter(Boolean);
</script>
<InputTags
@@ -53,19 +66,12 @@
bind:tags={data.elements}
placeholder="Add elements here"
required />
<Enum
<InputSelect
id="default"
label="Default value"
attribute={{
key: data.key,
type: 'string',
status: 'enabled',
format: 'enum',
elements: data.elements ?? [],
required: data.required,
default: data.default
}}
disabled={data.array || data.required}
placeholder="Select a value"
{options}
bind:value={data.default} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
@@ -54,9 +54,20 @@
}
</script>
<InputNumber id="min" label="Min" placeholder="Enter size" bind:value={data.min} />
<InputNumber id="max" label="Max" placeholder="Enter size" bind:value={data.max} />
<InputNumber
id="min"
label="Min"
placeholder="Enter size"
bind:value={data.min}
step="any"
required={editing} />
<InputNumber
id="max"
label="Max"
placeholder="Enter size"
bind:value={data.max}
step="any"
required={editing} />
<InputNumber
id="default"
label="Default value"
@@ -65,6 +76,7 @@
max={data.max}
bind:value={data.default}
disabled={data.required || data.array}
nullable={!data.required && !data.array}
step="any" />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
@@ -54,9 +54,18 @@
}
</script>
<InputNumber id="min" label="Min" placeholder="Enter size" bind:value={data.min} />
<InputNumber id="max" label="Max" placeholder="Enter size" bind:value={data.max} />
<InputNumber
id="min"
label="Min"
placeholder="Enter size"
bind:value={data.min}
required={editing} />
<InputNumber
id="max"
label="Max"
placeholder="Enter size"
bind:value={data.max}
required={editing} />
<InputNumber
id="default"
label="Default value"
@@ -64,7 +73,8 @@
min={data.min}
max={data.max}
bind:value={data.default}
disabled={data.required || data.array} />
disabled={data.required || data.array}
nullable={!data.required && !data.array} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
</InputChoice>
@@ -48,7 +48,8 @@
label="Default value"
placeholder="Enter value"
bind:value={data.default}
disabled={data.required || data.array} />
disabled={data.required || data.array}
nullable={!data.required && !data.array} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
</InputChoice>
@@ -98,7 +98,6 @@
});
// Reactive statements
$: getCollections(search).then((res) => (collectionList = res));
$: collections = collectionList?.collections?.filter((n) => n.$id !== $collection.$id) ?? [];
@@ -219,7 +218,6 @@
placeholder="Select a relation"
options={relationshipType}
disabled={editing} />
<div class="u-flex u-flex-vertical u-gap-16">
<div class="box">
<div class="u-flex u-align u-cross-center u-main-center u-gap-32">
@@ -34,8 +34,7 @@
</script>
<script lang="ts">
import { InputChoice, InputNumber } from '$lib/elements/forms';
import String from '../document-[document]/attributes/string.svelte';
import { InputChoice, InputNumber, InputText, InputTextarea } from '$lib/elements/forms';
export let data: Partial<Models.AttributeString> = {
required: false,
@@ -55,22 +54,27 @@
label="Size"
placeholder="Enter size"
bind:value={data.size}
required
required={!editing}
readonly={editing} />
<String
id="default"
label="Default value"
attribute={{
key: 'default',
type: 'string',
required: data.required,
array: data.array,
size: data.size,
default: data.default,
status: 'enabled'
}}
disabled={data.required || data.array}
bind:value={data.default} />
{#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>
@@ -49,7 +49,8 @@
label="Default value"
placeholder="Enter value"
bind:value={data.default}
disabled={data.required || data.array} />
disabled={data.required || data.array}
nullable={!data.required && !data.array} />
<InputChoice id="required" label="Required" bind:value={data.required} disabled={data.array}>
Indicate whether this is a required attribute
</InputChoice>
@@ -7,7 +7,6 @@
export let value: boolean;
export let attribute: Models.AttributeBoolean;
export let optionalText: string | undefined = undefined;
export let disabled = false;
</script>
<InputSelect
@@ -22,5 +21,4 @@
{ label: 'True', value: true },
{ label: 'False', value: false }
].filter(Boolean)}
bind:value
{disabled} />
bind:value />
@@ -7,7 +7,6 @@
export let value: string;
export let attribute: Models.AttributeEnum;
export let optionalText: string | undefined = undefined;
export let disabled = false;
$: options = [
...attribute.elements.map((element) => {
@@ -31,5 +30,4 @@
{optionalText}
required={attribute.required}
placeholder="Select a value"
showLabel={!!label?.length}
{disabled} />
showLabel={!!label?.length} />
@@ -17,5 +17,5 @@
required={attribute.required}
min={attribute.min}
max={attribute.max}
bind:value
step={attribute.type === 'double' ? 'any' : 1} />
step={attribute.type === 'double' ? 'any' : 1}
bind:value />
@@ -3,12 +3,12 @@
import { PaginationInline } from '$lib/components';
import { SelectSearchItem } from '$lib/elements';
import { Button, InputSelectSearch, Label } from '$lib/elements/forms';
import { preferences } from '$lib/stores/preferences';
import { sdk } from '$lib/stores/sdk';
import { Query, type Models } from '@appwrite.io/console';
import { onMount } from 'svelte';
import { doc } from '../store';
import { isRelationshipToMany } from './store';
import { preferences } from '$lib/stores/preferences';
export let id: string;
export let label: string;
@@ -32,7 +32,7 @@
onMount(async () => {
if (value) {
if (isRelationshipToMany(attribute)) {
relatedList = value as string[];
relatedList = (value as string[]).slice();
} else {
singleRel = value as string;
}
@@ -7,30 +7,27 @@
export let value: string;
export let attribute: Models.AttributeString;
export let optionalText: string | undefined = undefined;
export let disabled = false;
</script>
{#if attribute.size >= 50}
<InputTextarea
{id}
{label}
nullable
nullable={!attribute.required}
placeholder="Enter string"
showLabel={!!label?.length}
required={attribute.required}
maxlength={attribute.size}
{disabled}
bind:value />
{:else}
<InputText
{id}
{label}
{optionalText}
nullable
nullable={!attribute.required}
placeholder="Enter string"
showLabel={!!label?.length}
required={attribute.required}
maxlength={attribute.size}
{disabled}
bind:value />
{/if}
@@ -15,5 +15,6 @@
{optionalText}
placeholder="Enter URL"
showLabel={!!label?.length}
nullable={!attribute.required}
required={attribute.required}
bind:value />
@@ -125,7 +125,7 @@
<div class="u-text-center">
<Heading size="7" tag="h2">Create your first attribute to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
Need a hand? Check out our documentation.
Need a hand? Learn more in our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
@@ -110,7 +110,7 @@
<p class="text u-line-height-1-5">
You have no execution logs. Create and activate a deployment to see it here.
</p>
<p class="text u-line-height-1-5">Need a hand? Check out our documentation</p>
<p class="text u-line-height-1-5">Need a hand? Learn more in our documentation</p>
</div>
<div class="u-flex u-gap-16">
<Button text external href="https://appwrite.io/docs/functions#execute">
@@ -10,6 +10,8 @@ export const load: PageLoad = async ({ params, depends }) => {
const key = await sdk.forConsole.projects.getKey(params.project, params.key);
if (key.expire) {
key.expire = new Date(key.expire).toISOString().slice(0, 23);
} else {
key.expire = undefined;
}
return {
@@ -142,7 +142,7 @@
<div class="u-text-center">
<Heading size="7" tag="h4">Create your first platform to get started.</Heading>
<p class="body-text-2 u-bold u-margin-block-start-4">
Need a hand? Check out our documentation.
Need a hand? Learn more in our documentation.
</p>
</div>
<div class="u-flex u-gap-16 u-main-center">
@@ -5,7 +5,7 @@
const example1 = `dependencies:
appwrite: ^${$versions['client-flutter']}`;
const example2 = `pub get appwrite`;
const example2 = `flutter pub add appwrite`;
</script>
<WizardStep>