Merge pull request #1862 from appwrite/hide-csv-imports

Hide: csv imports, show conditionally.
This commit is contained in:
Darshan
2025-05-20 17:37:26 +05:30
committed by GitHub
2 changed files with 21 additions and 7 deletions
+2
View File
@@ -28,6 +28,8 @@ export const isProd = ENV.PROD;
export const hasStripePublicKey = !!VARS.PUBLIC_STRIPE_KEY;
export const GRACE_PERIOD_OVERRIDE = false;
export const APPWRITE_OFFICIALS_ORG = 'appwriteOfficials';
export function isMultiRegionSupported(url: URL): boolean {
if (env.PUBLIC_APPWRITE_MULTI_REGION === 'true') return true;
@@ -24,6 +24,8 @@
import { base } from '$app/paths';
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
import type { Models } from '@appwrite.io/console';
import { organization } from '$lib/stores/organization';
import { APPWRITE_OFFICIALS_ORG, isCloud } from '$lib/system';
export let data: PageData;
@@ -86,6 +88,14 @@
$isCsvImportInProgress = false;
}
}
/**
* Controls visibility of CSV Imports feature:
* - Shown if running on self-hosted
* - Shown on cloud only if the organization is Appwrite's.
* - Hidden on cloud for any non-Appwrite organization.
*/
$: showCsvImports = !isCloud || $organization.$id === APPWRITE_OFFICIALS_ORG;
</script>
{#key page.params.collection}
@@ -99,13 +109,15 @@
analyticsSource="database_documents" />
<Layout.Stack direction="row" alignItems="center" justifyContent="flex-end">
<ViewSelector view={data.view} {columns} hideView />
<Button
secondary
event={Click.DatabaseImportCsv}
disabled={!(hasAttributes && hasValidAttributes)}
on:click={() => (showImportCSV = true)}>
Import CSV
</Button>
{#if showCsvImports}
<Button
secondary
event={Click.DatabaseImportCsv}
disabled={!(hasAttributes && hasValidAttributes)}
on:click={() => (showImportCSV = true)}>
Import CSV
</Button>
{/if}
{#if !$isSmallViewport}
<Button
disabled={!(hasAttributes && hasValidAttributes)}