diff --git a/src/routes/console/project-[project]/settings/migrations/(import)/index.ts b/src/routes/console/project-[project]/settings/migrations/(import)/index.ts index 28d0d8ac1..acb8feba2 100644 --- a/src/routes/console/project-[project]/settings/migrations/(import)/index.ts +++ b/src/routes/console/project-[project]/settings/migrations/(import)/index.ts @@ -1,3 +1,8 @@ +import { + PUBLIC_MOCK_APIKEY, + PUBLIC_MOCK_ENDPOINT, + PUBLIC_MOCK_PROJECTID +} from '$env/static/public'; import { wizard } from '$lib/stores/wizard'; import { writable } from 'svelte/store'; import Wizard from './wizard.svelte'; @@ -21,6 +26,8 @@ type SupabaseInput = { port?: number; username?: string; password?: string; + endpoint?: string; + apiKey?: string; }; type NhostInput = { @@ -29,22 +36,20 @@ type NhostInput = { port?: number; username?: string; password?: string; + endpoint?: string; + apiKey?: string; }; type ProviderInput = AppwriteInput | NhostInput | SupabaseInput | FirebaseInput; -const initialProvider: ProviderInput = { provider: '' }; +const initialProvider: ProviderInput = { provider: 'appwrite' }; const mockProvider: ProviderInput = { - provider: '', - endpoint: '', - apiKey: '', - projectID: '', - host: '', - port: '', - username: '', - password: '' + provider: 'appwrite', + endpoint: PUBLIC_MOCK_ENDPOINT, + apiKey: PUBLIC_MOCK_APIKEY, + projectID: PUBLIC_MOCK_PROJECTID }; -export const provider = writable({ ...initialProvider }); +export const provider = writable({ ...mockProvider }); const initialFormData = { users: { diff --git a/src/routes/console/project-[project]/settings/migrations/+page.svelte b/src/routes/console/project-[project]/settings/migrations/+page.svelte index 9b5f2be08..bfd194561 100644 --- a/src/routes/console/project-[project]/settings/migrations/+page.svelte +++ b/src/routes/console/project-[project]/settings/migrations/+page.svelte @@ -16,14 +16,13 @@ import { isSameDay, toLocaleDate } from '$lib/helpers/date'; import { capitalize } from '$lib/helpers/string'; import { Container } from '$lib/layout'; - import { migrator } from '$lib/stores/migrator'; import { sdk } from '$lib/stores/sdk'; import { isSelfHosted } from '$lib/system'; import { openImportWizard } from './(import)'; import Details from './details.svelte'; export let data; - let showDetails = false; + let details: (typeof data.migrations)[number] | null = null; let showCloudExport = false; const mockMigrate = async () => { @@ -34,7 +33,7 @@ const getStatus = (status: string) => { if (status === 'failed') { - return { text: 'Failed', icon: 'clock', iconColor: 'blue' }; + return { text: 'Failed', icon: 'exclamation', iconColor: 'danger' }; } return { text: 'Pending', icon: 'clock', iconColor: 'blue' }; @@ -43,54 +42,93 @@ Migrations - {#if isSelfHosted} - - Import project data -

- Import project data from Cloud to your self-hosted project. Initiate the process of - importing project data from the migrations settings of your Cloud project. -

- - {#if $migrator.status === 'idle'} -
-
- -
-
- - - Date - Source - Status - - - - Today - Heaven - Awesome - - - - -
- {:else} -
-
-
- -
- -
- -
-
-

No imported data yet

+ + Import project data +

Import data from other products or from a different Appwrite instance

+ + {#if data.migrations.length} +
+
+
- {/if} - - +
+ + + + Date + Source + Status + + + + {#each data.migrations as entry} + + {@const source = capitalize(JSON.parse(entry.source).type)} + {@const status = getStatus(entry.status)} + + {isSameDay(new Date(), new Date(entry.$createdAt)) + ? 'Today' + : toLocaleDate(entry.$createdAt)} + + {source} + +
+ + {status.text} +
+
+ + + +
+ {/each} +
+
+ {:else} +
+
    +
  • +
    + Firebase +
    +
  • + +
  • +
    + Supabase +
    +
  • + +
  • +
    + nhost +
    +
  • + +
  • +
    + Appwrite +
    +
  • +
+
+ +
+
+ +
+ +
+ {/if} +
+
+ {#if isSelfHosted} Deploy to Cloud

Export data from your project to Appwrite Cloud

@@ -110,94 +148,6 @@
{:else} - - Import project data -

- Import data from other products or from a different Appwrite instance -

- - {#if data.migrations.length} -
-
- -
-
- - - - Date - Source - Status - - - - {#each data.migrations as entry} - - {@const source = capitalize(JSON.parse(entry.source).type)} - {@const status = getStatus(entry.status)} - - {isSameDay(new Date(), new Date(entry.$createdAt)) - ? 'Today' - : toLocaleDate(entry.$createdAt)} - - {source} - -
- - {status.text} -
-
- - - -
- {/each} -
-
- {:else} -
-
    -
  • -
    - Firebase -
    -
  • - -
  • -
    - Supabase -
    -
  • - -
  • -
    - nhost -
    -
  • - -
  • -
    - Appwrite -
    -
  • -
-
- -
-
- -
- -
- {/if} -
-
Export to self-hosted instance

Export data from your project to a self-hosted instance

@@ -262,7 +212,7 @@
-
+