|
6 | 6 | import { Modal } from '$lib/components'; |
7 | 7 | import { type Entity, SideSheet } from '$database/(entity)'; |
8 | 8 | import { isSmallViewport } from '$lib/stores/viewport'; |
9 | | - import { IndexType, OrderBy } from '@appwrite.io/console'; |
| 9 | + import { DatabasesIndexType, OrderBy } from '@appwrite.io/console'; |
10 | 10 | import { capitalize } from '$lib/helpers/string'; |
11 | 11 | import { type Columns } from '../table-[table]/store'; |
12 | 12 | import { isRelationship } from '../table-[table]/rows/store'; |
|
68 | 68 |
|
69 | 69 | indexes = mockSuggestions.columns.slice(0, 3).map((column, index) => ({ |
70 | 70 | key: column.name, |
71 | | - type: IndexType.Key, |
| 71 | + type: DatabasesIndexType.Key, |
72 | 72 | fields: [column.name], |
73 | 73 | orders: index === 2 ? OrderBy.Desc : OrderBy.Asc, |
74 | 74 | lengths: [] |
|
85 | 85 | indexes = suggestions.indexes.map((index) => { |
86 | 86 | return { |
87 | 87 | key: index.columns[0], |
88 | | - type: index.type as IndexType, |
| 88 | + type: index.type as DatabasesIndexType, |
89 | 89 | orders: (index.orders?.[0] as OrderBy) || OrderBy.Asc, |
90 | 90 | fields: index.columns, |
91 | 91 | lengths: index.lengths ?? [] |
|
113 | 113 | if (indexes.length < MAX_INDEXES) { |
114 | 114 | indexes.push({ |
115 | 115 | key: '', |
116 | | - type: IndexType.Key, |
| 116 | + type: DatabasesIndexType.Key, |
117 | 117 | orders: OrderBy.Asc, |
118 | 118 | fields: [], |
119 | 119 | lengths: null |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 |
|
137 | | - function getOrderOptions(selectedType: IndexType) { |
| 137 | + function getOrderOptions(selectedType: DatabasesIndexType) { |
138 | 138 | const base = [OrderBy.Asc, OrderBy.Desc]; |
139 | | - const values = selectedType === IndexType.Spatial ? [...base, null] : base; |
| 139 | + const values = selectedType === DatabasesIndexType.Spatial ? [...base, null] : base; |
140 | 140 |
|
141 | 141 | return values.map((order) => ({ |
142 | 142 | label: order ? capitalize(String(order)) : 'None', |
|
166 | 166 |
|
167 | 167 | // prepare lengths array |
168 | 168 | let lengths: (number | null)[]; |
169 | | - if (index.type === IndexType.Key) { |
| 169 | + if (index.type === DatabasesIndexType.Key) { |
170 | 170 | // only validate if it's a key index |
171 | 171 | lengths = index.fields.map((columnKey, i) => { |
172 | 172 | const maxSize = columnMap.get(columnKey); |
|
293 | 293 | } |
294 | 294 |
|
295 | 295 | const typeOptions = $derived( |
296 | | - Object.values(IndexType) |
| 296 | + Object.values(DatabasesIndexType) |
297 | 297 | .filter((type) => { |
298 | | - if (type === IndexType.Spatial && !$regionalConsoleVariables?.supportForSpatials) |
| 298 | + if ( |
| 299 | + type === DatabasesIndexType.Spatial && |
| 300 | + !$regionalConsoleVariables?.supportForSpatials |
| 301 | + ) |
299 | 302 | return false; |
300 | 303 | return true; |
301 | 304 | }) |
|
0 commit comments