Skip to content

Commit 5db25a3

Browse files
authored
Merge pull request #2018 from appwrite/1.8.x
Flag for index lengths
2 parents 71bbbfa + cc3936d commit 5db25a3

File tree

7 files changed

+24
-14
lines changed

7 files changed

+24
-14
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=

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
labels: ${{ steps.meta.outputs.labels }}
8080
build-args: |
8181
"PUBLIC_CONSOLE_MODE=cloud"
82-
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt"
82+
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt,index-lengths"
8383
"PUBLIC_APPWRITE_MULTI_REGION=true"
8484
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"
8585
"PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}"
@@ -118,7 +118,7 @@ jobs:
118118
build-args: |
119119
"PUBLIC_CONSOLE_MODE=self-hosted"
120120
"PUBLIC_APPWRITE_MULTI_REGION=false"
121-
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt"
121+
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt,index-lengths"
122122
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"
123123
124124
publish-cloud-no-regions:
@@ -156,6 +156,6 @@ jobs:
156156
build-args: |
157157
"PUBLIC_CONSOLE_MODE=cloud"
158158
"PUBLIC_APPWRITE_MULTI_REGION=false"
159-
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt"
159+
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt,index-lengths"
160160
"PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}"
161161
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"

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]/attributes/string.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
6464
let savedDefault = data.default;
6565
66-
let showEncrypt = flags.showAttributeEncrypt(page.data);
66+
const showEncrypt = flags.showAttributeEncrypt(page.data);
6767
6868
function handleDefaultState(hideDefault: boolean) {
6969
if (hideDefault) {

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+
const 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+
const 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}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
170170
let checked = false;
171171
172-
let showEncrypt = flags.showAttributeEncrypt(data);
172+
const showEncrypt = flags.showAttributeEncrypt(data);
173173
</script>
174174

175175
<Table.Root

0 commit comments

Comments
 (0)