Skip to content

Commit b15fd62

Browse files
committed
Flag for index lengths
1 parent 1f10ee9 commit b15fd62

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PUBLIC_CONSOLE_MODE=self-hosted
2-
PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt
2+
PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt,index-lengths
33
PUBLIC_APPWRITE_MULTI_REGION=false
44
PUBLIC_APPWRITE_ENDPOINT=http://localhost/v1
55
PUBLIC_STRIPE_KEY=

src/lib/flags.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ function isFlagEnabled(name: string) {
2121
export const flags = {
2222
showSites: isFlagEnabled('sites'),
2323
showCsvImport: isFlagEnabled('csv-import'),
24-
showAttributeEncrypt: isFlagEnabled('attribute-encrypt')
24+
showAttributeEncrypt: isFlagEnabled('attribute-encrypt'),
25+
showIndexLengths: isFlagEnabled('index-lengths')
2526
};

src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/createIndex.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import { type Attributes, collection, indexes } from '../store';
1515
import { Icon, Layout } from '@appwrite.io/pink-svelte';
1616
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
17+
import { flags } from '$lib/flags';
1718
1819
export let showCreateIndex = false;
1920
export let externalAttribute: Attributes = null;
@@ -38,6 +39,8 @@
3839
3940
let attributeList = [{ value: '', order: '', length: null }];
4041
42+
let showLengths = flags.showIndexLengths(page.data);
43+
4144
function generateIndexKey() {
4245
let indexKeys = $indexes.map((index) => index.key);
4346
@@ -149,7 +152,7 @@
149152
placeholder="Select Order" />
150153

151154
<Layout.Stack direction="row" alignItems="flex-end" gap="xs">
152-
{#if selectedType === IndexType.Key}
155+
{#if selectedType === IndexType.Key && showLengths}
153156
<InputNumber
154157
id={`length-${i}`}
155158
label={i === 0 ? 'Length' : undefined}

src/routes/(console)/project-[region]-[project]/databases/database-[database]/collection-[collection]/indexes/overviewIndex.svelte

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
import { InputText } from '$lib/elements/forms';
44
import { Layout } from '@appwrite.io/pink-svelte';
55
import type { Models } from '@appwrite.io/console';
6+
import { page } from '$app/state';
7+
import { flags } from '$lib/flags';
68
79
export let showOverview = false;
810
export let selectedIndex: Models.Index = null;
11+
12+
let showLengths = flags.showIndexLengths(page.data);
913
</script>
1014

1115
<Modal title="Overview" bind:show={showOverview}>
@@ -39,12 +43,14 @@
3943
id={`value-${selectedIndex.orders[i]}`}
4044
value={selectedIndex.orders[i]}
4145
readonly />
42-
<InputText
43-
required
44-
label={i === 0 ? 'Length' : ''}
45-
id={`value-${selectedIndex.lengths[i]}`}
46-
value={selectedIndex.lengths[i]?.toString() ?? null}
47-
readonly />
46+
{#if showLengths}
47+
<InputText
48+
required
49+
label={i === 0 ? 'Length' : ''}
50+
id={`value-${selectedIndex.lengths[i]}`}
51+
value={selectedIndex.lengths[i]?.toString() ?? null}
52+
readonly />
53+
{/if}
4854
</Layout.Stack>
4955
{/each}
5056
{/if}

0 commit comments

Comments
 (0)