diff --git a/src/lib/stores/migration.ts b/src/lib/stores/migration.ts index dd794ccdf7..f6498f4b9e 100644 --- a/src/lib/stores/migration.ts +++ b/src/lib/stores/migration.ts @@ -35,21 +35,23 @@ export const createMigrationFormStore = () => { }; }; -const resources = [ - 'user', - 'team', - 'membership', - 'file', - 'bucket', - 'function', - 'envVar', - 'deployment', - 'database', - 'collection', - 'index', - 'attribute', - 'document' -] as const; +export const ResourcesFriendly = { + user: { singular: 'User', plural: 'Users' }, + team: { singular: 'Team', plural: 'Teams' }, + membership: { singular: 'Membership', plural: 'Memberships' }, + file: { singular: 'File', plural: 'Files' }, + bucket: { singular: 'Bucket', plural: 'Buckets' }, + function: { singular: 'Function', plural: 'Functions' }, + 'environment variable': { singular: 'Environment Variable', plural: 'Environment Variables' }, + deployment: { singular: 'Deployment', plural: 'Deployments' }, + database: { singular: 'Database', plural: 'Databases' }, + collection: { singular: 'Collection', plural: 'Collections' }, + index: { singular: 'Index', plural: 'Indexes' }, + attribute: { singular: 'Attribute', plural: 'Attributes' }, + document: { singular: 'Document', plural: 'Documents' } +}; + +const resources = Object.keys(ResourcesFriendly); type Resource = (typeof resources)[number]; @@ -101,7 +103,7 @@ export const migrationFormToResources = ( addResource('function'); } if (formData.functions.env) { - addResource('envVar'); + addResource('environment variable'); } if (formData.functions.inactive) { addResource('deployment'); @@ -155,7 +157,7 @@ export const resourcesToMigrationForm = ( if (resources.includes('function') && isVersionAtLeast(version, '1.4.0')) { formData.functions.root = true; } - if (resources.includes('envVar') && isVersionAtLeast(version, '1.4.0')) { + if (resources.includes('environment variable') && isVersionAtLeast(version, '1.4.0')) { formData.functions.env = true; } if (resources.includes('deployment') && isVersionAtLeast(version, '1.4.0')) { diff --git a/src/routes/console/(migration-wizard)/resource-form.svelte b/src/routes/console/(migration-wizard)/resource-form.svelte index 77572a0b52..41d39cee0a 100644 --- a/src/routes/console/(migration-wizard)/resource-form.svelte +++ b/src/routes/console/(migration-wizard)/resource-form.svelte @@ -3,7 +3,7 @@ import { Button } from '$lib/elements/forms'; import { deepMap } from '$lib/helpers/object'; import type { WritableValue } from '$lib/helpers/types'; - import { sdk, type getSdkForProject } from '$lib/stores/sdk'; + import { type getSdkForProject } from '$lib/stores/sdk'; import { onMount } from 'svelte'; @@ -107,19 +107,10 @@ ); break; case 'firebase': - if ($provider.projectId) { - // OAuth - report = await sdk.forProject.migrations.getFirebaseReportOAuth( - providerResources.firebase, - $provider.projectId - ); - } else if ($provider.serviceAccount) { - // Manual auth - report = await projectSdk.migrations.getFirebaseReport( - providerResources.firebase, - $provider.serviceAccount - ); - } + report = await projectSdk.migrations.getFirebaseReport( + providerResources.firebase, + $provider.serviceAccount + ); break; case 'nhost': @@ -353,7 +344,7 @@
Import all functions and their active deployment
- {entity + 's'} + {total(Object.values(entityCounter)) > 1 + ? ResourcesFriendly[entity].plural + : ResourcesFriendly[entity].singular} {totalItems(entityCounter)}