mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: index and duplicates not working on the headers.
This commit is contained in:
+1
-1
@@ -26,7 +26,7 @@
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "^2.0.0-RC.1",
|
||||
"@appwrite.io/pink-legacy": "^1.0.3",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@cc69c76",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@3d31cea",
|
||||
"@faker-js/faker": "^9.9.0",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/sveltekit": "^8.38.0",
|
||||
|
||||
Generated
+5
-5
@@ -24,8 +24,8 @@ importers:
|
||||
specifier: ^1.0.3
|
||||
version: 1.0.3
|
||||
'@appwrite.io/pink-svelte':
|
||||
specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@cc69c76
|
||||
version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@cc69c76(svelte@5.25.3)
|
||||
specifier: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@3d31cea
|
||||
version: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@3d31cea(svelte@5.25.3)
|
||||
'@faker-js/faker':
|
||||
specifier: ^9.9.0
|
||||
version: 9.9.0
|
||||
@@ -284,8 +284,8 @@ packages:
|
||||
'@appwrite.io/pink-legacy@1.0.3':
|
||||
resolution: {integrity: sha512-GGde5fmPhs+s6/3aFeMPc/kKADG/gTFkYQSy6oBN8pK0y0XNCLrZZgBv+EBbdhwdtqVEWXa0X85Mv9w7jcIlwQ==}
|
||||
|
||||
'@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@cc69c76':
|
||||
resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@cc69c76}
|
||||
'@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@3d31cea':
|
||||
resolution: {tarball: https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@3d31cea}
|
||||
version: 2.0.0-RC.2
|
||||
peerDependencies:
|
||||
svelte: ^4.0.0
|
||||
@@ -3686,7 +3686,7 @@ snapshots:
|
||||
'@appwrite.io/pink-icons': 1.0.0
|
||||
the-new-css-reset: 1.11.3
|
||||
|
||||
'@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@cc69c76(svelte@5.25.3)':
|
||||
'@appwrite.io/pink-svelte@https://pkg.vc/-/@appwrite/@appwrite.io/pink-svelte@3d31cea(svelte@5.25.3)':
|
||||
dependencies:
|
||||
'@appwrite.io/pink-icons-svelte': 2.0.0-RC.1(svelte@5.25.3)
|
||||
'@floating-ui/dom': 1.6.13
|
||||
|
||||
+17
@@ -30,6 +30,7 @@
|
||||
randomDataModalState,
|
||||
reorderItems,
|
||||
showCreateAttributeSheet,
|
||||
showCreateIndexSheet,
|
||||
spreadsheetLoading
|
||||
} from './store';
|
||||
import { addSubPanel, registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
|
||||
@@ -50,7 +51,9 @@
|
||||
import { generateFakeDocuments, generateAttributes } from '$lib/helpers/faker';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sleep } from '$lib/helpers/promises';
|
||||
import CreateIndex from './indexes/createIndex.svelte';
|
||||
|
||||
let createIndex: CreateIndex;
|
||||
let editDocument: EditDocument;
|
||||
let createAttribute: CreateAttribute;
|
||||
let selectedOption: Option['name'] = 'String';
|
||||
@@ -288,6 +291,7 @@
|
||||
<CreateAttribute
|
||||
bind:selectedOption
|
||||
bind:this={createAttribute}
|
||||
column={$showCreateAttributeSheet.column}
|
||||
showCreate={$showCreateAttributeSheet.show}
|
||||
direction={$showCreateAttributeSheet.direction}
|
||||
columns={$showCreateAttributeSheet.columns}
|
||||
@@ -323,6 +327,19 @@
|
||||
<EditDocument bind:document={$databaseRowSheetOptions.document} bind:this={editDocument} />
|
||||
</SideSheet>
|
||||
|
||||
<SideSheet
|
||||
title="Create index"
|
||||
bind:show={$showCreateIndexSheet.show}
|
||||
submit={{
|
||||
text: 'Create',
|
||||
onClick: async () => await createIndex.create()
|
||||
}}>
|
||||
<CreateIndex
|
||||
bind:this={createIndex}
|
||||
bind:showCreateIndex={$showCreateIndexSheet.show}
|
||||
externalAttributeKey={$showCreateIndexSheet.column} />
|
||||
</SideSheet>
|
||||
|
||||
<Dialog title="Generate random data" bind:open={$randomDataModalState.show}>
|
||||
<Layout.Stack style="gap: 28px;">
|
||||
<Typography.Text>
|
||||
|
||||
+4
-19
@@ -17,13 +17,13 @@
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { isRelationship, isString } from '../document-[document]/attributes/store';
|
||||
import FailedModal from '../failedModal.svelte';
|
||||
import CreateIndex from '../indexes/createIndex.svelte';
|
||||
import {
|
||||
attributes,
|
||||
type Attributes,
|
||||
indexes,
|
||||
isCsvImportInProgress,
|
||||
reorderItems
|
||||
reorderItems,
|
||||
showCreateIndexSheet
|
||||
} from '../store';
|
||||
import Delete from './deleteAttribute.svelte';
|
||||
import EditAttribute from './edit.svelte';
|
||||
@@ -101,14 +101,12 @@
|
||||
let showFailed = $state(false);
|
||||
let showDelete = $state(false);
|
||||
let selectedAttributes = $state([]);
|
||||
let showCreateIndex = $state(false);
|
||||
let selectedAttribute: Attributes = $state(null);
|
||||
|
||||
let columnsOrder = $state([]);
|
||||
const collectionId = page.params.collection;
|
||||
|
||||
let showEdit = $state(false);
|
||||
let createIndex: CreateIndex;
|
||||
let editAttribute: EditAttribute;
|
||||
|
||||
const attributeFormatIcon = {
|
||||
@@ -300,9 +298,9 @@
|
||||
leadingIcon={IconPlus}
|
||||
on:click={(event) => {
|
||||
toggle(event);
|
||||
selectedAttribute = attribute;
|
||||
showCreateIndex = true;
|
||||
showDropdown[index] = false;
|
||||
$showCreateIndexSheet.show = true;
|
||||
$showCreateIndexSheet.column = attribute.key;
|
||||
}}>
|
||||
Create index
|
||||
</ActionMenu.Item.Button>
|
||||
@@ -381,19 +379,6 @@
|
||||
<EditAttribute showEdit isModal={false} {selectedAttribute} bind:this={editAttribute} />
|
||||
</SideSheet>
|
||||
|
||||
<SideSheet
|
||||
title="Create index"
|
||||
bind:show={showCreateIndex}
|
||||
submit={{
|
||||
text: 'Create',
|
||||
onClick: async () => await createIndex.create()
|
||||
}}>
|
||||
<CreateIndex
|
||||
bind:showCreateIndex
|
||||
externalAttribute={selectedAttribute}
|
||||
bind:this={createIndex} />
|
||||
</SideSheet>
|
||||
|
||||
{#if showFailed}
|
||||
<FailedModal bind:show={showFailed} title="Create attribute" header="Creation failed" {error} />
|
||||
{/if}
|
||||
|
||||
+7
-4
@@ -14,6 +14,7 @@
|
||||
let {
|
||||
direction = null,
|
||||
showCreate = false,
|
||||
column = null,
|
||||
columns = $bindable(null),
|
||||
columnId = $bindable(null),
|
||||
columnsOrder = $bindable(null),
|
||||
@@ -21,6 +22,7 @@
|
||||
onColumnsReorder = null
|
||||
}: {
|
||||
showCreate: boolean;
|
||||
column?: Attributes;
|
||||
columnId?: string;
|
||||
columns?: Column[];
|
||||
columnsOrder?: string[];
|
||||
@@ -32,11 +34,12 @@
|
||||
const databaseId = page.params.database;
|
||||
const collectionId = page.params.collection;
|
||||
|
||||
let key: string = $state(null);
|
||||
let key: string = $state(column?.key ?? null);
|
||||
let data: Partial<Attributes> = $state({
|
||||
required: false,
|
||||
array: false,
|
||||
default: null
|
||||
required: column?.required ?? false,
|
||||
array: column?.array ?? false,
|
||||
default: column?.default ?? null,
|
||||
...column
|
||||
});
|
||||
|
||||
let AttributeComponent = $derived(
|
||||
|
||||
+4
-4
@@ -10,13 +10,13 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { IndexType } from '@appwrite.io/console';
|
||||
import { isRelationship } from '../document-[document]/attributes/store';
|
||||
import { type Attributes, collection, indexes } from '../store';
|
||||
import { collection, indexes } from '../store';
|
||||
import { Icon, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus, IconX } from '@appwrite.io/pink-icons-svelte';
|
||||
import { flags } from '$lib/flags';
|
||||
|
||||
export let showCreateIndex = false;
|
||||
export let externalAttribute: Attributes = null;
|
||||
export let externalAttributeKey: string = null;
|
||||
|
||||
const databaseId = page.params.database;
|
||||
|
||||
@@ -52,8 +52,8 @@
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
attributeList = externalAttribute
|
||||
? [{ value: externalAttribute.key, order: 'ASC', length: null }]
|
||||
attributeList = externalAttributeKey
|
||||
? [{ value: externalAttributeKey, order: 'ASC', length: null }]
|
||||
: [{ value: '', order: 'ASC', length: null }];
|
||||
selectedType = IndexType.Key;
|
||||
key = `index_${$indexes.length + 1}`;
|
||||
|
||||
+19
-1
@@ -29,7 +29,8 @@
|
||||
columnsOrder,
|
||||
columnsWidth,
|
||||
randomDataModalState,
|
||||
spreadsheetLoading
|
||||
spreadsheetLoading,
|
||||
showCreateIndexSheet
|
||||
} from './store';
|
||||
import RelationshipsModal from './relationshipsModal.svelte';
|
||||
import type { Column, ColumnType } from '$lib/helpers/types';
|
||||
@@ -383,6 +384,21 @@
|
||||
sortState.set({ column: columnId, direction: 'desc' });
|
||||
await sort([Query.orderDesc(columnId)]);
|
||||
}
|
||||
|
||||
if (action === 'create-index') {
|
||||
$showCreateIndexSheet.show = true;
|
||||
$showCreateIndexSheet.column = columnId;
|
||||
}
|
||||
|
||||
if (action === 'duplicate-header') {
|
||||
$showCreateAttributeSheet.title = `Duplicate column`;
|
||||
$showCreateAttributeSheet.column = $attributes.find(
|
||||
(attr) => attr.key === columnId
|
||||
);
|
||||
$showCreateAttributeSheet.columns = $columns;
|
||||
$showCreateAttributeSheet.columnsOrder = $columnsOrder;
|
||||
$showCreateAttributeSheet.show = true;
|
||||
}
|
||||
} else if (type === 'row') {
|
||||
if (action === 'update') {
|
||||
$databaseRowSheetOptions.show = true;
|
||||
@@ -464,7 +480,9 @@
|
||||
variant="extra-compact"
|
||||
on:click={() => {
|
||||
$showCreateAttributeSheet.show = true;
|
||||
$showCreateAttributeSheet.column = null;
|
||||
$showCreateAttributeSheet.columns = $columns;
|
||||
$showCreateAttributeSheet.title = 'Insert column';
|
||||
$showCreateAttributeSheet.columnsOrder = $columnsOrder;
|
||||
}}>
|
||||
<Icon icon={IconPlus} color="--fgcolor-neutral-primary" />
|
||||
|
||||
+9
-1
@@ -81,7 +81,7 @@ export type ColumnDirection = {
|
||||
|
||||
export type CreateAttribute = {
|
||||
show: boolean;
|
||||
column?: string;
|
||||
column?: Attributes;
|
||||
title: string;
|
||||
direction?: ColumnDirection;
|
||||
onDone?: () => void;
|
||||
@@ -99,6 +99,14 @@ export const showCreateAttributeSheet = writable<CreateAttribute>({
|
||||
columnsOrder: null
|
||||
});
|
||||
|
||||
export const showCreateIndexSheet = writable<{
|
||||
show: boolean;
|
||||
column?: string;
|
||||
}>({
|
||||
show: false,
|
||||
column: null
|
||||
});
|
||||
|
||||
export function reorderItems<T extends { id: string } | { key: string }>(
|
||||
items: T[],
|
||||
order: string[] = []
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@ export default defineConfig({
|
||||
]
|
||||
},
|
||||
server: {
|
||||
port: 3000
|
||||
port: 3000,
|
||||
allowedHosts: ['exchange-irc-incorporate-drilling.trycloudflare.com']
|
||||
},
|
||||
test: {
|
||||
workspace: [
|
||||
|
||||
Reference in New Issue
Block a user