Skip to content

Project Migration on Pink2 Wizard #1720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: feat-pink-v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
375 changes: 122 additions & 253 deletions src/routes/(console)/(migration-wizard)/resource-form.svelte

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<script lang="ts">
import { provider } from '.';
import { Button, Layout, Typography } from '@appwrite.io/pink-svelte';
import { InputNumber, InputPassword, InputText, InputTextarea } from '$lib/elements/forms';

export let formSubmitted = false;

$: disableButton = (() => {
if (!$provider) return true;

switch ($provider.provider) {
case 'appwrite':
return !$provider.endpoint || !$provider.projectID || !$provider.apiKey;

case 'firebase':
return !$provider.serviceAccount;

case 'supabase':
return (
!$provider.host ||
!$provider.port ||
!$provider.password ||
!$provider.endpoint ||
!$provider.apiKey
);

case 'nhost':
return (
!$provider.region ||
!$provider.subdomain ||
!$provider.password ||
!$provider.adminSecret
);

default:
return true;
}
})();
</script>

<Layout.Stack gap="xl">
{#if $provider.provider === 'appwrite'}
<Layout.Stack gap="l">
<Layout.Stack></Layout.Stack>
<InputText
id="endpoint"
label="Endpoint"
required
placeholder="Enter endpoint"
bind:value={$provider.endpoint} />
<InputText
id="project-id"
label="Project ID"
required
placeholder="Enter project ID"
bind:value={$provider.projectID} />
<InputPassword
id="api-key"
label="API Key"
required
placeholder="Enter API Key"
bind:value={$provider.apiKey} />
</Layout.Stack>
{:else if $provider.provider === 'firebase'}
<Layout.Stack gap="l">
<InputTextarea
id="credentials"
label="Service Account JSON credentials"
required
bind:value={$provider.serviceAccount}
placeholder="Enter Service Account JSON credentials" />
</Layout.Stack>
{:else if $provider.provider === 'supabase'}
<Layout.Stack gap="l">
<Typography.Text variant="m-400" color="--fgcolor-neutral-primary"
>Postgres credentials</Typography.Text>

<InputText
id="host"
label="Host"
required
placeholder="Enter host"
bind:value={$provider.host} />

<InputNumber id="port" label="Port" placeholder="5432" bind:value={$provider.port} />

<InputText
id="username"
label="Username"
placeholder="postgres"
bind:value={$provider.username} />

<InputPassword
id="password"
label="Password"
required
placeholder="Enter password"
bind:value={$provider.password} />

<Typography.Text variant="m-400" color="--fgcolor-neutral-primary"
>Supabase credentials</Typography.Text>

<InputText
id="endpoint"
label="Endpoint"
required
placeholder="Enter endpoint"
bind:value={$provider.endpoint} />

<InputPassword
id="api-key"
label="API Key"
required
placeholder="Enter API Key"
bind:value={$provider.apiKey} />
</Layout.Stack>
{:else if $provider.provider === 'nhost'}
<Layout.Stack gap="l">
<InputText
id="region"
label="Region"
required
placeholder="Enter region"
bind:value={$provider.region} />
<InputText
id="subdomain"
label="Subdomain"
required
placeholder="Enter subdomain"
bind:value={$provider.subdomain} />
<InputText
id="database"
label="Database"
placeholder={$provider.subdomain
? `Default: ${$provider.subdomain}`
: 'Enter database'}
bind:value={$provider.database} />
<InputText
id="username"
label="Username"
placeholder="postgres"
bind:value={$provider.username} />
<InputPassword
id="password"
label="Password"
required
placeholder="Enter password"
bind:value={$provider.password} />
<InputPassword
id="adminSecret"
label="Admin secret"
required
placeholder="Enter admin secret"
bind:value={$provider.adminSecret} />
</Layout.Stack>
{/if}

<Layout.Stack direction="row" justifyContent="flex-end">
<Button.Button
size="s"
disabled={disableButton}
on:click={() => {
formSubmitted = true;
}}>Next</Button.Button>
</Layout.Stack>
</Layout.Stack>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script lang="ts">
import { Layout, Selector, Tag, Spinner, Typography } from '@appwrite.io/pink-svelte';

export let label: string;
export let checked: boolean;
export let isLoading: boolean = false;
export let handleChange: (event: Event) => void;
export let description: string | undefined = undefined;
export let reportValue: string | number | undefined = undefined;
</script>

<Layout.Stack>
<Layout.Stack direction="row" gap="xs" alignItems="flex-start">
<Layout.Stack gap="none">
<Layout.Stack direction="row" gap="xs" alignItems="flex-start">
<Selector.Checkbox {label} bind:checked on:change={handleChange} />

{#if reportValue !== undefined}
<Tag size="xs" selected>{reportValue}</Tag>
{:else if isLoading}
<Spinner size="s" />
{/if}
</Layout.Stack>

{#if description}
<div style:padding-left="2rem">
<Typography.Text variant="m-400" color="--fgcolor-neutral-tertiary">
{description}
</Typography.Text>
</div>
{/if}
</Layout.Stack>
</Layout.Stack>
</Layout.Stack>

This file was deleted.

This file was deleted.

Loading
Loading