Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/lib/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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}
Expand All @@ -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)}
Expand Down
Loading