Merge branch 'feat-g4' of github.com:appwrite/console into feat-g4

This commit is contained in:
Torsten Dittmann committed 2023-08-17 16:25:27 +02:00
commit 0b9a3397ad
5 files changed
+172 -99

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@
"@analytics/google-tag-manager": "^0.5.3",
"@appwrite.io/console": "npm:matej-appwrite-console@7.1.125",
"@appwrite.io/pink": "0.1.0-next.3",
"@appwrite.io/pink-icons": "0.1.0-next.3",
"@appwrite.io/pink-icons": "^0.1.0-next.3",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
+1 -1
View File
@@ -22,7 +22,7 @@
"@analytics/google-tag-manager": "^0.5.3",
"@appwrite.io/console": "npm:matej-appwrite-console@7.1.125",
"@appwrite.io/pink": "0.1.0-next.3",
"@appwrite.io/pink-icons": "0.1.0-next.3",
"@appwrite.io/pink-icons": "^0.1.0-next.3",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
"@sentry/tracing": "^7.44.2",
@@ -1,7 +1,7 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/stores';
import { EmptySearch } from '$lib/components';
import { EmptySearch, PaginationInline } from '$lib/components';
import { Button, InputSearch, InputSelect } from '$lib/elements/forms';
import { timeFromNow } from '$lib/helpers/date';
import { app } from '$lib/stores/app';
@@ -15,6 +15,8 @@
export let selectedRepository: string = null;
export let hasInstallations = false;
export let action: 'button' | 'select' = 'select';
let offset = 0;
const limit = 1;
$: {
hasInstallations = $installations?.total > 0;
@@ -114,59 +116,67 @@
{:then response}
{#if response?.length}
<ul class="table is-remove-outer-styles common-section">
{#each response as repo}
<li class="table-row">
<div class="table-col">
<div
class="u-flex u-cross-center u-gap-8"
style="margin-block: .75rem;">
{#if action === 'select'}
<input
class="is-small u-margin-inline-end-8"
type="radio"
name="repositories"
bind:group={selectedRepository}
on:change={() => repository.set(repo)}
value={repo.id} />
{/if}
{#each response as repo, i}
{#if i < offset + limit && i > offset - limit}
<li class="table-row">
<div class="table-col">
<div
class="avatar is-size-x-small"
style:--p-text-size="1.25rem"
class:is-color-empty={!repo.runtime}>
{#if repo.runtime}
<img
src={`${base}/icons/${$app.themeInUse}/color/${
repo.runtime.split('-')[0]
}.svg`}
alt={repo.name} />
class="u-flex u-cross-center u-gap-8"
style="margin-block: .75rem;">
{#if action === 'select'}
<input
class="is-small u-margin-inline-end-8"
type="radio"
name="repositories"
bind:group={selectedRepository}
on:change={() => repository.set(repo)}
value={repo.id} />
{/if}
</div>
<div class="u-flex u-gap-8">
<span class="text">{repo.name}</span>
{#if repo.private}
<span
class="icon-lock-closed"
style="font-size: var(--icon-size-small)"
aria-hidden="true" />
{/if}
<time class="u-color-text-gray" datetime={repo.pushedAt}>
{timeFromNow(repo.pushedAt)}
</time>
</div>
{#if action === 'button'}
<div class="u-margin-inline-start-auto">
<Button
secondary
on:click={() => dispatch('connect', repo)}>
Connect
</Button>
<div
class="avatar is-size-x-small"
style:--p-text-size="1.25rem"
class:is-color-empty={!repo.runtime}>
{#if repo.runtime}
<img
src={`${base}/icons/${$app.themeInUse}/color/${
repo.runtime.split('-')[0]
}.svg`}
alt={repo.name} />
{/if}
</div>
{/if}
<div class="u-flex u-gap-8">
<span class="text u-trim-1">{repo.name}</span>
{#if repo.private}
<span
class="icon-lock-closed"
style="font-size: var(--icon-size-small)"
aria-hidden="true" />
{/if}
<time
class="u-color-text-gray u-trim-1"
datetime={repo.pushedAt}>
{timeFromNow(repo.pushedAt)}
</time>
</div>
{#if action === 'button'}
<div class="u-margin-inline-start-auto">
<Button
secondary
on:click={() => dispatch('connect', repo)}>
Connect
</Button>
</div>
{/if}
</div>
</div>
</div>
</li>
</li>
{/if}
{/each}
</ul>
<div class="u-flex u-margin-block-start-32 u-main-space-between">
<p class="text">Total results: {response?.length}</p>
<PaginationInline {limit} bind:offset sum={response?.length} />
</div>
{:else if search}
<EmptySearch hidePages>
<div class="common-section">
+18 -7
View File
@@ -29,7 +29,6 @@
<script lang="ts">
import { base } from '$app/paths';
import { Heading } from '$lib/components';
import { clickOnEnter } from '$lib/helpers/a11y';
import WizardCover from '$lib/layout/wizardCover.svelte';
import { app } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
@@ -40,6 +39,7 @@
import Repositories from './components/repositories.svelte';
import CreateManual from './createManual.svelte';
import CreateGit from './createGit.svelte';
import { Button } from '$lib/elements/forms';
let hasInstallations: boolean;
let selectedRepository: string;
@@ -77,10 +77,9 @@
</div>
</div>
<p class="u-margin-block-start-16">
You can also create a function <span
You can also create a function <button
class="link"
on:keyup={clickOnEnter}
on:click={() => wizard.start(CreateManual)}>manually</span>
on:click={() => wizard.start(CreateManual)}>manually</button>
or using the CLI.
<a href="http://#" target="_blank" rel="noopener noreferrer" class="link"
>Learn more</a
@@ -101,8 +100,9 @@
{:then runtimes}
<ul
class="grid-box u-margin-block-start-16"
style:--grid-gap="1rem"
style:--p-grid-item-size="8rem">
style:--grid-item-size="8rem"
style:--grid-item-size-small-screens="9rem"
style:--grid-gap="1rem">
{#each quickStart.runtimes.filter((_template, index) => index < 6) as runtime}
{@const runtimeDetail = runtimes.find(
(r) => r.$id === runtime.name
@@ -138,13 +138,19 @@
src={`${base}/icons/${$app.themeInUse}/grayscale/dotnet.svg`}
alt="dotnet-7.0" />
</div>
<div class="body-text-2 u-trim">Coming soon</div>
<div class="body-text-2 u-trim">Soon</div>
</div>
</li>
{/if}
</ul>
{/await}
<Button text class="u-margin-inline-start-auto u-margin-block-start-16">
All starter templates <span
class="icon-cheveron-right"
aria-hidden="true" />
</Button>
</section>
<div class="u-sep-block-start common-section" />
<section class="common-section">
<h2 class="heading-level-6">Templates</h2>
<p class="text u-margin-block-start-8">
@@ -155,6 +161,7 @@
{#each templates as template}
<li class="clickable-list-item">
<button
type="button"
on:click={() => connectTemplate(template)}
class="clickable-list-button u-width-full-line u-flex u-gap-12">
<div class="avatar is-size-small" style:--p-text-size="1.25rem">
@@ -171,6 +178,10 @@
{/each}
</ul>
</section>
<Button text class="u-margin-inline-start-auto u-margin-block-start-16">
<span> All templates </span>
<span class="icon-cheveron-right" aria-hidden="true" />
</Button>
</div>
</div>
</div>
@@ -3,6 +3,7 @@
import { WizardStep } from '$lib/layout';
import { template, templateConfig } from '../store';
import { FormList, Helper, InputChoice } from '$lib/elements/forms';
import { Collapsible, CollapsibleItem } from '$lib/components';
async function beforeSubmit() {
for (const variable of $template.variables) {
@@ -15,6 +16,14 @@
}
}
}
$: appwriteVariable = $template.variables.find((v) => v.name === 'APPWRITE_API_KEY');
$: requiredVariables = $template?.variables?.filter(
(v) => v.required && v.name !== 'APPWRITE_API_KEY'
);
$: optionalVariables = $template?.variables?.filter(
(v) => !v.required && v.name !== 'APPWRITE_API_KEY'
);
</script>
<WizardStep {beforeSubmit}>
@@ -23,50 +32,93 @@
Edit the values of the environment variables that will be passed to your function at
runtime.
</svelte:fragment>
<div class="u-flex u-flex-vertical u-gap-24">
{#if $template?.variables?.length}
<div class="u-flex u-flex-vertical u-gap-16">
<p class="text u-bold">Environment variables</p>
{#if $template?.variables?.length}
{#if requiredVariables?.length}
<Collapsible>
<CollapsibleItem open={true}>
<svelte:fragment slot="title">Required variables</svelte:fragment>
<svelte:fragment slot="subtitle">
<span class="inline-tag">{requiredVariables.length}</span>
</svelte:fragment>
{#each $template.variables as variable}
{#if variable.name === 'APPWRITE_API_KEY'}
<div
class="box"
style:--box-padding="1rem"
style:--box-border-radius="var(--border-radius-small)">
<FormList>
<div>
<InputText
id={variable.name}
label={variable.name}
placeholder={variable.placeholder ?? ''}
required={variable.required}
autocomplete={false}
bind:value={$templateConfig.appwriteApiKey} />
<Helper type="neutral">
This API key will allow you to interact with the Appwrite
server APIs. <a
href="http://#"
target="_blank"
rel="noopener noreferrer"
class="link">Learn more</a
>.
</Helper>
</div>
<InputChoice id="generate" label="Generate API key on completion">
The <code class="inline-code">APPWRITE_API_KEY</code> will be automatically
generated for your project and applied to this function once it's
created.
</InputChoice>
</FormList>
</div>
{/if}
<FormList>
{#each requiredVariables as variable}
<div>
<InputText
id={variable.name}
label={variable.name}
placeholder={variable.placeholder ?? 'Enter value'}
required={variable.required}
autocomplete={false}
bind:value={$templateConfig.appwriteApiKey} />
<Helper type="neutral">
{@html variable.description}
</Helper>
{/each}
<Helper type="neutral">
{@html variable.description}
</Helper>
</div>
{/each}
</FormList>
</CollapsibleItem>
</Collapsible>
{/if}
{#if appwriteVariable}
<div
class="box"
style:--box-padding="1rem"
style:--box-border-radius="var(--border-radius-small)">
<FormList>
<div>
<InputText
id={appwriteVariable.name}
label={appwriteVariable.name}
placeholder={appwriteVariable.placeholder ?? 'Enter value'}
required={appwriteVariable.required}
autocomplete={false}
bind:value={$templateConfig.appwriteApiKey} />
<Helper type="neutral">
This API key will allow you to interact with the Appwrite server APIs. <a
href="http://#"
target="_blank"
rel="noopener noreferrer"
class="link">Learn more</a
>.
</Helper>
</div>
<InputChoice id="generate" label="Generate API key on completion">
The <code class="inline-code">APPWRITE_API_KEY</code> will be automatically generated
for your project and applied to this function once it's created.
</InputChoice>
</FormList>
</div>
{/if}
</div>
{#if optionalVariables?.length}
<Collapsible>
<CollapsibleItem>
<svelte:fragment slot="title">Optional variables</svelte:fragment>
<svelte:fragment slot="subtitle">
<span class="inline-tag">{optionalVariables.length}</span>
</svelte:fragment>
<FormList>
{#each optionalVariables as variable}
<div>
<InputText
id={variable.name}
label={variable.name}
placeholder={variable.placeholder ?? 'Enter value'}
required={variable.required}
autocomplete={false}
bind:value={$templateConfig.appwriteApiKey} />
<Helper type="neutral">
{@html variable.description}
</Helper>
</div>
{/each}
</FormList>
</CollapsibleItem>
</Collapsible>
{/if}
{/if}
</WizardStep>