Merge feat-documentsdb into feat-vectordb

This commit is contained in:
Prem Palanisamy
2026-03-25 07:15:08 +00:00
8 changed files with 80 additions and 25 deletions
@@ -1,11 +1,12 @@
<script lang="ts">
import { initCreateColumn } from '$routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte';
import { columnOptions } from '$routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/store';
import { getSupportedColumns } from '$routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/store';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
import Template from './template.svelte';
let search = '';
let options = columnOptions.map((option) => {
$: options = getSupportedColumns($regionalConsoleVariables).map((option) => {
return {
label: option.name,
icon: option.icon,
@@ -24,6 +24,7 @@
import { type Entity, getTerminologies } from '$database/(entity)';
import { resolveRoute, withPath } from '$lib/stores/navigation';
import { columnOptions as baseColumnOptions } from '$database/table-[table]/columns/store';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
let {
entity,
@@ -66,12 +67,21 @@
length: number | null;
}> = $state([{ value: '', order: null, length: null }]);
const types = [
{ value: DatabasesIndexType.Key, label: 'Key' },
{ value: DatabasesIndexType.Unique, label: 'Unique' },
{ value: DatabasesIndexType.Fulltext, label: 'Fulltext' },
{ value: DatabasesIndexType.Spatial, label: 'Spatial' }
];
const types = $derived(
[
{ value: DatabasesIndexType.Key, label: 'Key' },
{ value: DatabasesIndexType.Unique, label: 'Unique' },
{ value: DatabasesIndexType.Fulltext, label: 'Fulltext' },
{ value: DatabasesIndexType.Spatial, label: 'Spatial' }
].filter((type) => {
if (
type.value === DatabasesIndexType.Spatial &&
!$regionalConsoleVariables?.supportForSpatials
)
return false;
return true;
})
);
// order options derived from selected type
let orderOptions = $derived.by(() =>
@@ -28,7 +28,6 @@
mapSuggestedColumns,
type SuggestedColumnSchema,
entityColumnSuggestions,
basicColumnOptions,
mockSuggestions,
showIndexesSuggestions
} from './store';
@@ -38,7 +37,7 @@
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { isWithinSafeRange } from '$lib/helpers/numbers';
import { columnOptions } from '../table-[table]/columns/store';
import { columnOptions, getSupportedColumns } from '../table-[table]/columns/store';
import Options from './options.svelte';
import { InputSelect, InputText } from '$lib/elements/forms';
import { isCloud, VARS } from '$lib/system';
@@ -46,6 +45,7 @@
import IconAINotification from './icon/aiNotification.svelte';
import type { Models } from '@appwrite.io/console';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
let {
userColumns = [],
@@ -56,6 +56,7 @@
} = $props();
const tableId = page.params.table;
const supportedColumns = $derived(getSupportedColumns($regionalConsoleVariables));
const minimumUserColumnWidth = 168;
function getUserColumnWidth(
@@ -1359,7 +1360,7 @@
</Spreadsheet.Header.Cell>
{:else}
{@const columnObj = getColumn(column.id)}
{@const columnIcon = basicColumnOptions.find(
{@const columnIcon = columnOptions.find(
(col) => col.type === columnObj?.type
)?.icon}
{@const columnIconColor = !columnObj?.type
@@ -1516,7 +1517,7 @@
});
}
}}
options={basicColumnOptions.map((col) => {
options={supportedColumns.map((col) => {
return {
label: col.name,
value: col.name,
@@ -1835,7 +1836,7 @@
gap="none"
direction="column"
class="filter-modal-actions-menu variant">
{#each basicColumnOptions as option}
{#each supportedColumns as option}
<ActionMenu.Item.Button
on:click={() => {
toggle();
@@ -10,6 +10,7 @@
import { capitalize } from '$lib/helpers/string';
import type { Columns } from '$database/store';
import { isRelationship } from '../table-[table]/rows/store';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
import { VARS } from '$lib/system';
import { sleep } from '$lib/helpers/promises';
import { sdk } from '$lib/stores/sdk';
@@ -291,10 +292,21 @@
return false; // close the sheet!
}
const typeOptions = Object.values(DatabasesIndexType).map((type) => ({
label: capitalize(type),
value: type
}));
const typeOptions = $derived(
Object.values(DatabasesIndexType)
.filter((type) => {
if (
type === DatabasesIndexType.Spatial &&
!$regionalConsoleVariables?.supportForSpatials
)
return false;
return true;
})
.map((type) => ({
label: capitalize(type),
value: type
}))
);
onMount(() => showIndexesSuggestions.set(false));
@@ -1,13 +1,16 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import { ActionMenu, Icon, Popover } from '@appwrite.io/pink-svelte';
import { columnOptions, type Option } from './store';
import { getSupportedColumns, type Option } from './store';
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
import { isTablesCsvImportInProgress } from '../store';
import { CsvDisabled } from '$database/(entity)';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
export let showCreate = false;
export let selectedOption: Option['name'] = null;
$: options = getSupportedColumns($regionalConsoleVariables);
</script>
{#if $isTablesCsvImportInProgress}
@@ -26,7 +29,7 @@
</Button>
</slot>
<ActionMenu.Root slot="tooltip">
{#each columnOptions as column}
{#each options as column}
<ActionMenu.Item.Button
leadingIcon={column.icon}
on:click={() => {
@@ -17,6 +17,7 @@ import Point, { submitPoint, updatePoint } from './point.svelte';
import Line, { submitLine, updateLine } from './line.svelte';
import Polygon, { submitPolygon, updatePolygon } from './polygon.svelte';
import type { Columns } from '$database/store';
import type { Models } from '@appwrite.io/console';
import Relationship, { submitRelationship, updateRelationship } from './relationship.svelte';
import {
IconCalendar,
@@ -248,3 +249,12 @@ export const columnOptions: Option[] = [
];
export const option = writable<Option>();
export function getSupportedColumns(consoleVariables: Models.ConsoleVariables): Option[] {
const spatialTypes: Set<Option['type']> = new Set(['point', 'linestring', 'polygon']);
return columnOptions.filter((col) => {
if (col.type === 'relationship' && !consoleVariables?.supportForRelationships) return false;
if (spatialTypes.has(col.type) && !consoleVariables?.supportForSpatials) return false;
return true;
});
}
@@ -6,8 +6,13 @@
import { InputSelect, InputText } from '$lib/elements/forms';
import { addNotification } from '$lib/stores/notifications';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { option, columnOptions, type Option } from '$database/table-[table]/columns/store';
import {
option,
getSupportedColumns,
type Option
} from '$database/table-[table]/columns/store';
import type { Column } from '$lib/helpers/types';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
import { preferences } from '$lib/stores/preferences';
import { onMount } from 'svelte';
@@ -52,8 +57,10 @@
...column
} as Partial<Columns>);
let availableOptions = $derived(getSupportedColumns($regionalConsoleVariables));
let ColumnComponent = $derived(
columnOptions.find((option) => option.name === selectedOption).component
(availableOptions.find((option) => option.name === selectedOption) ?? availableOptions[0])
.component
);
function init() {
@@ -68,7 +75,7 @@
/* default to text */
selectedOption = 'Text';
$option = columnOptions[0];
$option = availableOptions[0];
}
function insertColumnInOrder() {
@@ -184,7 +191,15 @@
// correct view
if (selectedOption) {
$option = columnOptions.find((option) => option.name === selectedOption);
const resolved =
availableOptions.find((option) => option.name === selectedOption) ??
availableOptions[0];
$option = resolved;
if (resolved && resolved.name !== selectedOption) {
selectedOption = resolved.name;
}
}
});
</script>
@@ -221,7 +236,7 @@
id="type"
label="Type"
bind:value={selectedOption}
options={columnOptions.map((attr) => {
options={availableOptions.map((attr) => {
return {
label: attr.name,
value: attr.name,
@@ -8,6 +8,7 @@
import { addNotification } from '$lib/stores/notifications';
import { preferences } from '$lib/stores/preferences';
import { sdk } from '$lib/stores/sdk';
import { regionalConsoleVariables } from '$routes/(console)/project-[region]-[project]/store';
import { type Models, Query } from '@appwrite.io/console';
import { type ComponentType, onDestroy, onMount } from 'svelte';
import type { PageData } from './$types';
@@ -967,7 +968,9 @@
select={rowSelection}
hoverEffect
showSelectOnHover
valueWithoutHover={row.$sequence}>
valueWithoutHover={$regionalConsoleVariables?.supportForIntegerIds
? row?.$sequence
: undefined}>
{#each $tableColumns as { id: columnId, isEditable, hide } (columnId)}
{@const rowColumn = $columns.find((col) => col.key === columnId)}
{#if columnId === '$id' && !hide}