Merge branch '1.4.x' of github.com:appwrite/console into 1.4.x

This commit is contained in:
Arman committed 2023-08-24 14:23:52 +02:00
commit 1fd860fc90
18 files changed
+152 -73

No files matched your search

+6 -2
View File
@@ -7,6 +7,8 @@
export let icon: string = null;
export let fullHeight = true;
export let borderRadius: 'xsmall' | 'small' | 'medium' | 'large' = 'small';
export let backgroundColor: string = null;
export let backgroundColorHover: string = null;
enum Radius {
xsmall = '--border-radius-xsmall',
@@ -20,8 +22,10 @@
class="card is-allow-focus u-cursor-pointer"
class:u-height-100-percent={fullHeight}
style:--card-padding={`${padding}rem`}
style:--card-border-radius={`var(${Radius[borderRadius]})`}>
<div class="u-flex u-gap-16">
style:--card-border-radius={`var(${Radius[borderRadius]})`}
style:--p-card-bg-color-default={backgroundColor}
style:--p-card-bg-color-hover={backgroundColorHover}>
<div class="u-flex u-gap-8">
<input
class="is-small u-margin-block-start-2"
type="radio"
-5
View File
@@ -1,5 +1,4 @@
<script lang="ts">
import { beforeNavigate } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { trackEvent } from '$lib/actions/analytics';
@@ -37,10 +36,6 @@
isOpen = false;
wizard.start(Create);
}
beforeNavigate(() => {
wizard.hide();
});
</script>
<svelte:window on:keydown={handleKeyDown} />
+3 -1
View File
@@ -30,7 +30,9 @@
* Cancel navigation when wizard is open and triggered by popstate
*/
beforeNavigate((n) => {
if (!$wizard.show || !$wizard.cover) return;
const external = n.to.url.hostname !== globalThis.location.hostname;
if (external) return;
if (!($wizard.show || $wizard.cover)) return;
if (n.type === 'popstate') {
n.cancel();
}
-2
View File
@@ -84,8 +84,6 @@
$: sortedSteps = [...steps].sort(([a], [b]) => (a > b ? 1 : -1));
$: isLastStep = $wizard.step === steps.size;
$: console.log({ sortedSteps, current: $wizard.step });
</script>
<svelte:window on:keydown={handleKeydown} />
@@ -12,9 +12,11 @@
const dispatch = createEventDispatcher();
export let callbackState: Record<string, string> = null;
export let selectedRepository: string = null;
export let hasInstallations = false;
export let action: 'button' | 'select' = 'select';
let offset = 0;
const limit = 5;
@@ -57,7 +59,11 @@
function connectGitHub() {
const redirect = new URL($page.url);
redirect.searchParams.append('github-installed', 'true');
if (callbackState) {
Object.keys(callbackState).forEach((key) => {
redirect.searchParams.append(key, callbackState[key]);
});
}
const target = new URL(`${sdk.forProject.client.config.endpoint}/vcs/github/authorize`);
target.searchParams.set('projectId', $page.params.project);
target.searchParams.set('success', redirect.toString());
+10 -4
View File
@@ -19,7 +19,7 @@
variables,
repositoryBehaviour: 'new',
repositoryName: template.id,
repositoryPrivate: false,
repositoryPrivate: true,
repositoryId: null
});
wizard.start(CreateTemplate);
@@ -46,7 +46,7 @@
let selectedRepository: string;
const quickStart = marketplace.find((template) => template.id === 'starter');
const templates = marketplace.filter((template) => template.id !== 'starter').slice(0, 3);
const templates = marketplace.filter((template) => template.id !== 'starter').slice(0, 2);
function connect(event: CustomEvent<Models.ProviderRepository>) {
repository.set(event.detail);
@@ -60,7 +60,7 @@
</script>
<WizardCover>
<svelte:fragment slot="title">Create function</svelte:fragment>
<svelte:fragment slot="title">Create Function</svelte:fragment>
<div class="wizard-container container">
<div class="grid-1-1 u-gap-24">
<div>
@@ -74,6 +74,10 @@
bind:hasInstallations
bind:selectedRepository
action="button"
callbackState={{
from: 'github',
to: 'cover'
}}
on:connect={connect} />
</div>
</div>
@@ -125,7 +129,9 @@
}.svg`}
alt={runtime.name} />
</div>
<div class="body-text-2">{runtimeDetail.name}</div>
<div class="body-text-2">
{runtimeDetail.name}
</div>
</button>
</li>
{/each}
@@ -9,7 +9,7 @@
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import Repositories from '../components/repositories.svelte';
import { installation, repository, templateConfig } from '../store';
import { installation, repository, template, templateConfig } from '../store';
let selectedInstallationId: string;
let hasInstallations: boolean;
@@ -41,7 +41,19 @@
function connectGitHub() {
const redirect = new URL($page.url);
redirect.searchParams.append('github-installed', 'true');
const callbackState = {
from: 'github',
to: 'template',
step: '4',
template: $template.id,
templateConfig: JSON.stringify($templateConfig)
};
if (callbackState) {
Object.keys(callbackState).forEach((key) => {
redirect.searchParams.append(key, callbackState[key]);
});
}
const target = new URL(`${sdk.forProject.client.config.endpoint}/vcs/github/authorize`);
target.searchParams.set('projectId', $page.params.project);
target.searchParams.set('success', redirect.toString());
@@ -107,7 +119,7 @@
<div class="u-flex u-cross-center u-flex-vertical u-gap-16">
<Button href={connectGitHub().toString()} fullWidth secondary>
<span class="icon-github" aria-hidden="true" />
<span class="text">Continue with GitHub</span>
<span class="text">GitHub</span>
</Button>
<Button disabled fullWidth secondary>
<span class="icon-gitlab" aria-hidden="true" />
@@ -123,36 +135,35 @@
</Button>
</div>
{/if}
{#if $installation}
<div
class="box u-margin-block-start-20"
style:--box-border-radius="var(--border-radius-small)">
<div class="u-flex u-gap-16">
<div class="avatar is-size-x-small">
<span class={getProviderIcon($installation.provider)} />
</div>
<div class="u-cross-child-center u-line-height-1-5">
<h6 class="u-bold u-trim-1">
{$installation.organization}/{$templateConfig.repositoryName}
</h6>
</div>
</div>
<div class="u-margin-block-start-24">
<FormList>
<InputText
id="repositoryName"
label="Repository name"
placeholder="my-repository"
bind:value={$templateConfig.repositoryName} />
<InputChoice
id="repositoryPrivate"
label="Keep repository private"
bind:value={$templateConfig.repositoryPrivate} />
</FormList>
</div>
</div>
{/if}
{/await}
{#if $installation}
<div
class="box u-margin-block-start-20"
style:--box-border-radius="var(--border-radius-small)">
<div class="u-flex u-gap-16">
<div class="avatar is-size-x-small">
<span class={getProviderIcon($installation.provider)} />
</div>
<div class="u-cross-child-center u-line-height-1-5">
<h6 class="u-bold u-trim-1">
{$installation.organization}/{$templateConfig.repositoryName}
</h6>
</div>
</div>
<div class="u-margin-block-start-24">
<FormList>
<InputText
id="repositoryName"
label="Repository name"
placeholder="my-repository"
bind:value={$templateConfig.repositoryName} />
<InputChoice
id="repositoryPrivate"
label="Keep repository private"
bind:value={$templateConfig.repositoryPrivate} />
</FormList>
</div>
</div>
{/if}
{/if}
</WizardStep>
@@ -17,14 +17,21 @@
organization.
</svelte:fragment>
<ul class="u-flex u-flex-vertical u-gap-24">
<LabelCard name="behaviour" value="new" bind:group={$templateConfig.repositoryBehaviour}>
<ul class="u-flex u-flex-vertical u-gap-16">
<LabelCard
name="behaviour"
value="new"
backgroundColor="var(--color-neutral-5)"
backgroundColorHover="var(--color-neutral-10)"
bind:group={$templateConfig.repositoryBehaviour}>
<svelte:fragment slot="title">Create a new repository</svelte:fragment>
Clone the template and create a new repository in your selected organization.
</LabelCard>
<LabelCard
name="behaviour"
value="existing"
backgroundColor="var(--color-neutral-5)"
backgroundColorHover="var(--color-neutral-10)"
bind:group={$templateConfig.repositoryBehaviour}>
<svelte:fragment slot="title">Add to existing repository</svelte:fragment>
Clone the template to an existing repository in your selected organization.
@@ -51,9 +51,10 @@
label="Runtime"
id="runtime"
placeholder="Select runtime"
bind:value={$templateConfig.runtime}
required
disabled={options.length <= 1}
{options}
required />
bind:value={$templateConfig.runtime} />
{/await}
</FormList>
@@ -18,6 +18,12 @@
import { onMount } from 'svelte';
import Initial from '$lib/wizards/functions/cover.svelte';
import { registerCommands } from '$lib/commandCenter';
import CreateTemplate from '$lib/wizards/functions/createTemplate.svelte';
import {
templateConfig as templateConfigStore,
template as templateStore
} from '$lib/wizards/functions/store.js';
import { marketplace } from '$lib/stores/marketplace.js';
export let data;
@@ -26,8 +32,24 @@
const project = $page.params.project;
onMount(() => {
if ($page.url.searchParams.has('github-installed')) {
openWizard();
const from = $page.url.searchParams.get('from');
if (from === 'github') {
const to = $page.url.searchParams.get('to');
switch (to) {
case 'template':
const step = $page.url.searchParams.get('step');
const template = $page.url.searchParams.get('template');
const templateConfig = $page.url.searchParams.get('templateConfig');
templateStore.set(marketplace.find((item) => item.id === template));
templateConfigStore.set(JSON.parse(templateConfig));
wizard.start(CreateTemplate);
wizard.setStep(Number(step));
break;
case 'cover':
openWizard();
break;
}
}
});
@@ -103,4 +103,4 @@
});
</script>
<Wizard title="Create function" steps={stepsComponents} on:finish={create} on:exit={onFinish} />
<Wizard title="Create Function" steps={stepsComponents} on:finish={create} on:exit={onFinish} />
@@ -16,8 +16,7 @@
{
href: `${path}/templates`,
title: 'Templates',
event: 'templates',
experimental: true
event: 'templates'
}
];
</script>
@@ -35,13 +34,6 @@
event={tab.event}>
{tab.title}
</Tab>
{#if tab.experimental}
<div class="u-flex u-cross-center">
<div class="tag eyebrow-heading-3">
<span class="text u-x-small">Experimental</span>
</div>
</div>
{/if}
{/each}
</Tabs>
</Cover>
@@ -2,7 +2,14 @@
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { Collapsible, CollapsibleItem, EmptySearch, Pagination } from '$lib/components';
import { tooltip } from '$lib/actions/tooltip.js';
import {
Collapsible,
CollapsibleItem,
EmptySearch,
Heading,
Pagination
} from '$lib/components';
import { Button } from '$lib/elements/forms';
import { debounce } from '$lib/helpers/debounce';
import { Container } from '$lib/layout';
@@ -67,9 +74,14 @@
</script>
<Container>
<div class="grid-300px-1fr">
<div class="u-flex u-gap-8 u-cross-center">
<Heading tag="h2" size="5">Templates</Heading>
<div class="tag eyebrow-heading-3">
<span class="text u-x-small">Experimental</span>
</div>
</div>
<div class="grid-300px-1fr u-margin-block-start-24">
<section>
<h3 class="body-text-1 u-bold">Filter templates</h3>
<div
class="input-text-wrapper is-with-end-button u-width-full-line u-max-width-500 u-margin-block-start-12"
style="--amount-of-buttons:1">
@@ -155,6 +167,8 @@
class="grid-box"
style="--grid-item-size:22rem; --grid-item-size-small-screens:19rem">
{#each data.templates as template}
{@const displayed = template.runtimes.slice(0, 2)}
{@const hidden = template.runtimes.slice(2, -1)}
<li>
<article class="card u-min-height-100-percent">
<div class="u-flex u-gap-16 u-cross-center">
@@ -164,7 +178,7 @@
{template.name}
</h2>
<ul class="avatars-group is-with-border">
{#each template.runtimes as runtime}
{#each displayed as runtime}
{@const icon = getIconFromRuntime(runtime.name)}
{#if icon}
<li class="avatars-group-item">
@@ -179,6 +193,19 @@
</li>
{/if}
{/each}
{#if hidden.length}
<li class="avatars-group-item">
<div
class="avatar is-size-small"
use:tooltip={{
content: hidden
.map((n) => n.name)
.join(', ')
}}>
+{hidden.length}
</div>
</li>
{/if}
</ul>
</div>
@@ -40,7 +40,6 @@ export const load: PageLoad = async ({ url, route }) => {
if (search) {
return template.name.toLowerCase().includes(search.toLowerCase());
} else {
console.log(template.name);
return true;
}
});
@@ -1,4 +1,5 @@
<script lang="ts">
import { base } from '$app/paths';
import { Card, Heading } from '$lib/components';
import { Pill } from '$lib/elements';
import { Button } from '$lib/elements/forms';
@@ -34,7 +35,11 @@
<li class="collapsible-item">
<section class="card u-margin-block-start-24">
<h4 class="body-text-1 u-bold">Published by</h4>
{$template.providerOwner}
<img
class="u-margin-block-start-8"
width="130"
src={`${base}/logos/appwrite-full.svg`}
alt="" />
</section>
</li>
</ul>
@@ -48,8 +48,6 @@
$: firebaseProjects = $page.data.firebaseProjects;
$: console.log(firebaseProjects);
// let showAuth = false;
</script>
@@ -20,7 +20,6 @@ export async function load({ depends }) {
try {
const { migrations } = await sdk.forProject.migrations.list();
console.log('migrations', migrations);
return {
migrations,
firebaseProjects: getFirebaseProjects()
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<svg viewBox="0 0 1600 400" xmlns="http://www.w3.org/2000/svg" xmlns:bx="https://boxy-svg.com">
<path d="M 368.384 202.21 C 368.384 257.211 323.798 301.799 268.795 301.799 C 243.248 301.799 219.949 292.177 202.319 276.365 C 230.561 263.65 250.222 235.262 250.222 202.282 C 250.222 169.259 230.512 140.842 202.211 128.151 C 219.856 112.281 243.196 102.622 268.795 102.622 C 323.798 102.622 368.384 147.209 368.384 202.21 Z" fill="#f02e65" style=""/>
<path d="M 228.987 122.718 C 167.825 76.497 79.561 113.816 70.114 189.895 C 65.724 225.253 80.556 260.262 109.009 281.704 C 170.205 327.884 258.443 290.5 267.838 214.414 C 272.197 179.101 257.387 144.148 228.987 122.717 Z M 217.91 137.393 C 267.809 175.046 258.233 252.593 200.674 276.979 C 173.964 288.297 143.242 284.504 120.085 267.028 C 70.189 229.374 79.763 151.827 137.321 127.442 C 164.032 116.126 194.754 119.918 217.91 137.393 Z" fill="#f02e65" style="" bx:origin="0.499777 0.499705"/>
<path d="M 482.978 129.125 C 496.645 129.125 508.294 132.662 517.927 139.74 C 527.559 146.819 534.182 156.201 537.798 167.886 L 537.798 130.838 L 554.85 130.838 L 554.85 265.696 L 537.798 265.696 L 537.798 228.65 C 534.182 240.346 527.559 249.732 517.927 256.81 C 508.294 263.889 496.645 267.428 482.978 267.428 C 470.794 267.428 459.885 264.628 450.252 259.031 C 440.62 253.435 433.129 245.407 427.777 234.947 C 422.426 224.488 419.748 212.261 419.748 198.267 C 419.748 184.111 422.426 171.804 427.777 161.344 C 433.129 150.895 440.579 142.914 450.13 137.396 C 459.68 131.88 470.629 129.125 482.978 129.125 Z M 487.422 144.429 C 472.274 144.429 460.13 149.244 450.987 158.878 C 441.856 168.511 437.29 181.641 437.29 198.267 C 437.29 214.896 441.856 228.027 450.987 237.66 C 460.13 247.291 472.274 252.106 487.422 252.106 C 496.971 252.106 505.574 249.886 513.224 245.441 C 520.883 241 526.894 234.701 531.257 226.55 C 535.618 218.399 537.798 208.973 537.798 198.267 C 537.798 187.563 535.618 178.142 531.257 169.999 C 526.894 161.851 520.883 155.546 513.224 151.096 C 505.574 146.651 496.971 144.429 487.422 144.429 Z M 664.501 129.125 C 676.85 129.125 687.759 131.88 697.226 137.396 C 706.695 142.914 714.106 150.895 719.458 161.344 C 724.809 171.804 727.485 184.111 727.485 198.267 C 727.485 212.261 724.809 224.488 719.458 234.947 C 714.106 245.407 706.651 253.435 697.105 259.031 C 687.555 264.628 676.686 267.428 664.501 267.428 C 650.669 267.428 638.98 263.889 629.43 256.81 C 619.88 249.732 613.296 240.346 609.679 228.65 L 609.679 329.418 L 592.382 329.418 L 592.382 130.838 L 609.679 130.838 L 609.679 167.886 C 613.296 156.201 619.88 146.819 629.43 139.74 C 638.98 132.662 650.669 129.125 664.501 129.125 Z M 659.811 144.429 C 650.261 144.429 641.656 146.651 633.995 151.096 C 626.345 155.546 620.379 161.851 616.1 169.999 C 611.821 178.142 609.679 187.563 609.679 198.267 C 609.679 208.973 611.821 218.399 616.1 226.55 C 620.379 234.701 626.345 241 633.995 245.441 C 641.656 249.886 650.261 252.106 659.811 252.106 C 675.122 252.106 687.308 247.291 696.368 237.66 C 705.419 228.027 709.943 214.896 709.943 198.267 C 709.943 181.641 705.419 168.511 696.368 158.878 C 687.308 149.244 675.122 144.429 659.811 144.429 Z M 830.713 129.125 C 843.064 129.125 853.973 131.88 863.44 137.396 C 872.909 142.914 880.321 150.895 885.673 161.344 C 891.023 171.804 893.7 184.111 893.7 198.267 C 893.7 212.261 891.023 224.488 885.673 234.947 C 880.321 245.407 872.868 253.435 863.318 259.031 C 853.769 264.628 842.901 267.428 830.713 267.428 C 816.883 267.428 805.195 263.889 795.646 256.81 C 786.094 249.732 779.512 240.346 775.896 228.65 L 775.896 329.418 L 758.598 329.418 L 758.598 130.838 L 775.896 130.838 L 775.896 167.886 C 779.512 156.201 786.094 146.819 795.646 139.74 C 805.195 132.662 816.883 129.125 830.713 129.125 Z M 826.027 144.429 C 816.478 144.429 807.87 146.651 800.21 151.096 C 792.561 155.546 786.596 161.851 782.315 169.999 C 778.036 178.142 775.896 187.563 775.896 198.267 C 775.896 208.973 778.036 218.399 782.315 226.55 C 786.596 234.701 792.561 241 800.21 245.441 C 807.87 249.886 816.478 252.106 826.027 252.106 C 841.338 252.106 853.523 247.291 862.582 237.66 C 871.633 228.027 876.158 214.896 876.158 198.267 C 876.158 181.641 871.633 168.511 862.582 158.878 C 853.523 149.244 841.338 144.429 826.027 144.429 Z M 1085.103 128.879 L 1117.707 128.879 L 1080.905 265.696 L 1042.373 265.696 L 1012.988 166.17 L 982.85 265.696 L 944.333 265.696 L 907.776 128.879 L 942.602 128.879 L 964.833 234.58 L 995.199 128.879 L 1032 128.879 L 1062.628 234.58 L 1085.103 128.879 Z M 1169.821 155.047 C 1174.919 146.325 1181.666 139.452 1190.062 134.425 C 1198.468 129.41 1207.853 126.904 1218.222 126.904 L 1218.222 164.193 L 1208.096 164.193 C 1182.579 164.193 1169.821 176.047 1169.821 199.752 L 1169.821 265.696 L 1134.998 265.696 L 1134.998 128.879 L 1169.821 128.879 L 1169.821 155.047 Z M 1233.538 89.594 C 1233.538 83.998 1235.515 79.432 1239.467 75.897 C 1243.42 72.355 1248.607 70.582 1255.019 70.582 C 1261.447 70.582 1266.633 72.355 1270.585 75.897 C 1274.539 79.432 1276.515 83.998 1276.515 89.594 C 1276.515 95.029 1274.539 99.518 1270.585 103.063 C 1266.633 106.606 1261.447 108.379 1255.019 108.379 C 1248.607 108.379 1243.42 106.606 1239.467 103.063 C 1235.515 99.518 1233.538 95.029 1233.538 89.594 Z M 1237.491 128.879 L 1272.317 128.879 L 1272.317 265.696 L 1237.491 265.696 L 1237.491 128.879 Z M 1363.452 235.806 L 1377.028 235.806 L 1377.028 265.696 L 1358.749 265.696 C 1343.435 265.696 1331.706 261.995 1323.555 254.589 C 1315.405 247.173 1311.329 234.826 1311.329 217.542 L 1311.329 158.264 L 1292.316 158.264 L 1292.316 128.879 L 1311.329 128.879 L 1311.329 95.034 L 1346.154 95.034 L 1346.154 128.879 L 1376.782 128.879 L 1376.782 158.264 L 1346.154 158.264 L 1346.154 218.032 C 1346.154 224.62 1347.473 229.233 1350.106 231.867 C 1352.742 234.493 1357.191 235.806 1363.452 235.806 Z M 1530.646 192.094 C 1530.646 195.555 1530.239 199.509 1529.419 203.951 L 14Line truncated
<path d="M 171.666 167.755 C 171.548 168.048 170.023 174.028 168.386 181.123 C 166.683 188.216 163.986 199.414 162.464 206.037 C 159.531 218.173 157.772 226.146 157.772 227.2 C 157.772 227.492 159.591 227.729 161.816 227.729 L 165.864 227.729 L 167.679 219.637 C 168.736 215.242 171.083 205.157 172.957 197.243 C 174.834 189.329 177.118 179.714 177.999 175.843 C 178.878 171.974 179.758 168.46 179.934 168.048 C 180.11 167.521 179.112 167.347 176.063 167.347 C 173.776 167.347 171.782 167.521 171.666 167.755 Z M 140.183 193.138 L 134.79 199.002 L 136.375 200.878 C 137.252 201.932 139.659 204.571 141.709 206.742 L 145.462 210.725 L 156.133 210.725 L 151.089 205.274 C 148.332 202.346 146.046 199.529 146.046 199.179 C 146.046 198.768 148.157 196.132 150.739 193.316 C 153.317 190.446 155.428 187.98 155.428 187.688 C 155.428 187.452 153.201 187.277 150.505 187.277 L 145.638 187.277 L 140.183 193.138 Z M 181.221 187.629 C 181.221 187.806 182.219 188.917 183.449 190.149 C 188.025 194.722 191.248 198.593 191.071 199.352 C 190.956 199.766 188.726 202.519 186.03 205.391 L 181.165 210.725 L 186.616 210.725 L 192.068 210.668 L 197.049 205.215 C 199.808 202.169 202.035 199.469 202.035 199.119 C 202.035 198.827 199.69 196.071 196.757 192.965 L 191.485 187.277 L 186.381 187.277 C 183.508 187.277 181.221 187.452 181.221 187.629 Z" fill="#f02e65" style=""/>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB