Skip to content

Commit bb4f7cf

Browse files
committed
Merge branch '1.8.x' into 'csv-imports-errors'.
2 parents dc5c4ed + 9e118ab commit bb4f7cf

File tree

11 files changed

+110
-80
lines changed

11 files changed

+110
-80
lines changed

.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"
82+
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt"
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"
121+
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt"
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"
159+
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,csv-import,attribute-encrypt"
160160
"PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}"
161161
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"dependencies": {
2424
"@ai-sdk/svelte": "^1.1.24",
25-
"@appwrite.io/console": "https://pkg.pr.new/appwrite-labs/cloud/@appwrite.io/console@a5e5564",
25+
"@appwrite.io/console": "^1.9.0",
2626
"@appwrite.io/pink-icons": "0.25.0",
2727
"@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1",
2828
"@appwrite.io/pink-legacy": "^1.0.3",

pnpm-lock.yaml

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/flags.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ function isFlagEnabled(name: string) {
2020

2121
export const flags = {
2222
showSites: isFlagEnabled('sites'),
23-
showCsvImport: isFlagEnabled('csv-import')
23+
showCsvImport: isFlagEnabled('csv-import'),
24+
showAttributeEncrypt: isFlagEnabled('attribute-encrypt')
2425
};

src/lib/sdk/billing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export type Plan = {
310310
users: number;
311311
teams: number;
312312
databases: number;
313+
databasesAllowEncrypt: boolean;
313314
buckets: number;
314315
fileSize: number;
315316
functions: number;
@@ -339,7 +340,6 @@ export type Plan = {
339340
backupPolicies: number;
340341
emailBranding: boolean;
341342
supportsCredits: boolean;
342-
databasesAllowEncrypt: boolean;
343343
supportsOrganizationRoles: boolean;
344344
buildSize: number; // in MB
345345
deploymentSize: number; // in MB

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
<Layout.Stack direction="row" alignItems="center" gap="s">
118118
<Layout.Stack inline direction="row" alignItems="center" gap="xxs">
119119
<span class="text u-trim-1" data-private>{attribute.key}</span>
120-
{#if isString(attribute) && !attribute.encrypt}
120+
{#if isString(attribute) && attribute.encrypt}
121121
<Tooltip>
122122
<Icon
123123
size="s"

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

Lines changed: 51 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import { ActionMenu, Selector } from '@appwrite.io/pink-svelte';
5151
import { InputNumber, InputText, InputTextarea } from '$lib/elements/forms';
5252
import { Popover, Layout, Tag, Typography, Link } from '@appwrite.io/pink-svelte';
53+
import { flags } from '$lib/flags';
5354
5455
export let data: Partial<Models.AttributeString> = {
5556
required: false,
@@ -62,6 +63,8 @@
6263
6364
let savedDefault = data.default;
6465
66+
let showEncrypt = flags.showAttributeEncrypt(page.data);
67+
6568
function handleDefaultState(hideDefault: boolean) {
6669
if (hideDefault) {
6770
savedDefault = data.default;
@@ -84,7 +87,7 @@
8487
8588
$: handleDefaultState($required || $array);
8689
87-
// check plan on cloud, always allow on self-hosted!
90+
// Check plan on cloud, always allow on self-hosted
8891
$: supportsStringEncryption = isCloud ? $currentPlan?.databasesAllowEncrypt : true;
8992
</script>
9093

@@ -125,50 +128,53 @@
125128
disabled={data.required || editing}
126129
description="Indicate whether this attribute is an array. Defaults to an empty array." />
127130

128-
<Layout.Stack gap="xs" direction="column">
129-
<div class="popover-holder" class:disabled-checkbox={!supportsStringEncryption || editing}>
130-
<Layout.Stack inline gap="s" alignItems="flex-start" direction="row">
131-
<Popover let:toggle placement="bottom-start">
132-
<Selector.Checkbox
133-
size="s"
134-
id="encrypt"
135-
bind:checked={data.encrypt}
136-
disabled={!supportsStringEncryption || editing} />
137-
138-
<Layout.Stack gap="xxs" direction="column">
139-
<button
140-
type="button"
141-
class="u-cursor-pointer"
142-
on:click={(e) => {
143-
if (!supportsStringEncryption) {
144-
toggle(e);
145-
} else {
146-
data.encrypt = !data.encrypt;
147-
}
148-
}}>
149-
<Layout.Stack inline gap="xxs" direction="row" alignItems="center">
150-
<Typography.Text variant="m-500">Encrypted</Typography.Text>
151-
{#if !supportsStringEncryption}
152-
<Tag variant="default" size="xs" on:click={toggle}>Pro</Tag>
153-
{/if}
154-
</Layout.Stack>
155-
</button>
156-
<Typography.Text color="--fgcolor-neutral-tertiary">
157-
Indicate whether this attribute is encrypted. Encrypted attributes cannot be
158-
queried.
159-
</Typography.Text>
160-
</Layout.Stack>
161-
162-
<ActionMenu.Root width="180px" slot="tooltip">
163-
<Typography.Text variant="m-500">
164-
Available on Pro plan. <Link.Anchor href={$upgradeURL}>Upgrade</Link.Anchor>
165-
to enable encrypted attributes.
166-
</Typography.Text>
167-
</ActionMenu.Root>
168-
</Popover>
169-
</Layout.Stack>
170-
</div>
171-
</Layout.Stack>
131+
{#if showEncrypt}
132+
<Layout.Stack gap="xs" direction="column">
133+
<div class="popover-holder" class:disabled-checkbox={!supportsStringEncryption || editing}>
134+
<Layout.Stack inline gap="s" alignItems="flex-start" direction="row">
135+
<Popover let:toggle placement="bottom-start">
136+
<Selector.Checkbox
137+
size="s"
138+
id="encrypt"
139+
bind:checked={data.encrypt}
140+
disabled={!supportsStringEncryption || editing} />
141+
142+
<Layout.Stack gap="xxs" direction="column">
143+
<button
144+
type="button"
145+
class="u-cursor-pointer"
146+
on:click={(e) => {
147+
if (!supportsStringEncryption) {
148+
toggle(e);
149+
} else {
150+
data.encrypt = !data.encrypt;
151+
}
152+
}}>
153+
<Layout.Stack inline gap="xxs" direction="row" alignItems="center">
154+
<Typography.Text variant="m-500">Encrypted</Typography.Text>
155+
{#if !supportsStringEncryption}
156+
<Tag variant="default" size="xs" on:click={toggle}>Pro</Tag>
157+
{/if}
158+
</Layout.Stack>
159+
</button>
160+
<Typography.Text color="--fgcolor-neutral-tertiary">
161+
Indicate whether this attribute is encrypted. Encrypted attributes
162+
cannot be queried.
163+
</Typography.Text>
164+
</Layout.Stack>
165+
166+
<ActionMenu.Root width="180px" slot="tooltip">
167+
<Typography.Text variant="m-500">
168+
Available on Pro plan. <Link.Anchor href={$upgradeURL}
169+
>Upgrade</Link.Anchor>
170+
to enable encrypted attributes.
171+
</Typography.Text>
172+
</ActionMenu.Root>
173+
</Popover>
174+
</Layout.Stack>
175+
</div>
176+
</Layout.Stack>
177+
{/if}
172178

173179
<style lang="scss">
174180
.popover-holder {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,15 @@
7979
{ id: 'type' },
8080
{ id: 'attributes' },
8181
{ id: 'orders' },
82+
{ id: 'lengths' },
8283
{ id: 'actions', width: 40 }
8384
]}>
8485
<svelte:fragment slot="header" let:root>
8586
<Table.Header.Cell column="key" {root}>Key</Table.Header.Cell>
8687
<Table.Header.Cell column="type" {root}>Type</Table.Header.Cell>
8788
<Table.Header.Cell column="attributes" {root}>Attributes</Table.Header.Cell>
88-
<Table.Header.Cell column="orders" {root}>Asc/Desc</Table.Header.Cell>
89+
<Table.Header.Cell column="orders" {root}>Orders</Table.Header.Cell>
90+
<Table.Header.Cell column="lengths" {root}>Lengths</Table.Header.Cell>
8991
<Table.Header.Cell column="actions" {root} />
9092
</svelte:fragment>
9193
{#each data.collection.indexes as index}
@@ -118,6 +120,9 @@
118120
<Table.Cell column="orders" {root}>
119121
{index.orders}
120122
</Table.Cell>
123+
<Table.Cell column="lengths" {root}>
124+
{index.lengths}
125+
</Table.Cell>
121126
<Table.Cell column="actions" {root}>
122127
<Popover let:toggle padding="none" placement="bottom-end">
123128
<Button text icon ariaLabel="more options" on:click={toggle}>

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

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
66
import { Modal } from '$lib/components';
77
import { Dependencies } from '$lib/constants';
8-
import { Button, InputSelect, InputText } from '$lib/elements/forms';
8+
import { Button, InputNumber, InputSelect, InputText } from '$lib/elements/forms';
99
import { remove } from '$lib/helpers/array';
1010
import { addNotification } from '$lib/stores/notifications';
1111
import { sdk } from '$lib/stores/sdk';
@@ -36,7 +36,7 @@
3636
label: attribute.key
3737
}));
3838
39-
let attributeList = [{ value: '', order: '' }];
39+
let attributeList = [{ value: '', order: '', length: null }];
4040
4141
function generateIndexKey() {
4242
let indexKeys = $indexes.map((index) => index.key);
@@ -51,8 +51,8 @@
5151
5252
function initialize() {
5353
attributeList = externalAttribute
54-
? [{ value: externalAttribute.key, order: 'ASC' }]
55-
: [{ value: '', order: 'ASC' }];
54+
? [{ value: externalAttribute.key, order: 'ASC', length: null }]
55+
: [{ value: '', order: 'ASC', length: null }];
5656
selectedType = IndexType.Key;
5757
key = `index_${$indexes.length + 1}`;
5858
}
@@ -78,8 +78,10 @@
7878
key,
7979
selectedType,
8080
attributeList.map((a) => a.value),
81-
attributeList.map((a) => a.order)
81+
attributeList.map((a) => a.order),
82+
attributeList.map((a) => (a.length ? Number(a.length) : null))
8283
);
84+
8385
await Promise.allSettled([
8486
invalidate(Dependencies.COLLECTION),
8587
invalidate(Dependencies.DATABASE)
@@ -105,7 +107,7 @@
105107
if (addAttributeDisabled) return;
106108
107109
// We assign instead of pushing to trigger Svelte's reactivity
108-
attributeList = [...attributeList, { value: '', order: '' }];
110+
attributeList = [...attributeList, { value: '', order: '', length: null }];
109111
}
110112
</script>
111113

@@ -134,17 +136,26 @@
134136
label={i === 0 ? 'Attribute' : undefined}
135137
placeholder="Select Attribute"
136138
bind:value={attribute.value} />
139+
140+
<InputSelect
141+
options={[
142+
{ value: 'ASC', label: 'ASC' },
143+
{ value: 'DESC', label: 'DESC' }
144+
]}
145+
required
146+
id={`order-${i}`}
147+
label={i === 0 ? 'Order' : undefined}
148+
bind:value={attribute.order}
149+
placeholder="Select Order" />
150+
137151
<Layout.Stack direction="row" alignItems="flex-end" gap="xs">
138-
<InputSelect
139-
options={[
140-
{ value: 'ASC', label: 'ASC' },
141-
{ value: 'DESC', label: 'DESC' }
142-
]}
143-
required
144-
id={`order-${i}`}
145-
label={i === 0 ? 'Order' : undefined}
146-
bind:value={attribute.order}
147-
placeholder="Select Order" />
152+
{#if selectedType === IndexType.Key}
153+
<InputNumber
154+
id={`length-${i}`}
155+
label={i === 0 ? 'Length' : undefined}
156+
placeholder="Enter Length"
157+
bind:value={attribute.length} />
158+
{/if}
148159
<Button
149160
icon
150161
compact

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
id={`value-${selectedIndex.orders[i]}`}
4040
value={selectedIndex.orders[i]}
4141
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 />
4248
</Layout.Stack>
4349
{/each}
4450
{/if}

0 commit comments

Comments
 (0)