File tree Expand file tree Collapse file tree 4 files changed +44
-24
lines changed
src/routes/(console)/project-[region]-[project]/databases/database-[database] Expand file tree Collapse file tree 4 files changed +44
-24
lines changed Original file line number Diff line number Diff line change 152152 }} />
153153
154154 {#if useSuggestions }
155- <SuggestionsInput />
155+ <SuggestionsInput showSampleCountPicker ={ terminology . type === ' documentsdb ' } />
156156 {/if }
157157
158158 <svelte:fragment slot =" footer" >
Original file line number Diff line number Diff line change 55 import { slide } from ' svelte/transition' ;
66 import { entityColumnSuggestions } from ' ./store' ;
77 import { getTerminologies } from ' $database/(entity)' ;
8- import { Button , InputTextarea } from ' $lib/elements/forms' ;
8+ import { randomDataModalState } from ' $database/store' ;
9+ import { Button , InputTextarea , Seekbar } from ' $lib/elements/forms' ;
910 import { Card , Layout , Selector , Typography } from ' @appwrite.io/pink-svelte' ;
1011
1112 const {
12- isModal = false
13+ isModal = false ,
14+ showSampleCountPicker = false
1315 }: {
1416 isModal? : boolean ;
17+ showSampleCountPicker? : boolean ;
1518 } = $props ();
1619
1720 onMount (() => {
9295 <!-- just being safe with extra guard! -->
9396 {#if $entityColumnSuggestions .enabled && featureActive }
9497 <div class ="context-input" transition:slide ={{ duration : 200 }}>
95- <InputTextarea
96- id =" context"
97- rows ={3 }
98- maxlength ={255 }
99- bind:value ={$entityColumnSuggestions .context }
100- placeholder =" Optional: Add context to improve suggestions" />
98+ <Layout .Stack gap =" xl" >
99+ <InputTextarea
100+ id =" context"
101+ rows ={3 }
102+ maxlength ={255 }
103+ bind:value ={$entityColumnSuggestions .context }
104+ placeholder =" Optional: Add context to improve suggestions" />
105+
106+ {#if showSampleCountPicker }
107+ <Layout .Stack gap =" m" style =" margin-block-end: var(--space-4, 8px);" >
108+ <Typography .Text >
109+ Select how many random documents to generate for testing.
110+ </Typography .Text >
111+
112+ <Seekbar
113+ max ={100 }
114+ breakpointCount ={5 }
115+ bind:value ={$randomDataModalState .value } />
116+ </Layout .Stack >
117+ {/if }
118+ </Layout .Stack >
101119 </div >
102120 {/if }
103121 </Layout .Stack >
Original file line number Diff line number Diff line change 11<script lang =" ts" context =" module" >
22 import { writable } from ' svelte/store' ;
3+ import { ID } from ' @appwrite.io/console' ;
4+ import { toLocaleDateTime } from ' $lib/helpers/date' ;
35
46 const showCreateIndex = writable (false );
57 export const initCreateIndex = () => {
68 showCreateIndex .set (true );
79 };
10+
11+ export function buildInitDoc() {
12+ const now = new Date ().toISOString ();
13+ return {
14+ $id: ID .unique (),
15+ $createdAt: toLocaleDateTime (now ),
16+ $updatedAt: toLocaleDateTime (now )
17+ };
18+ }
819 </script >
920
1021<script lang =" ts" >
3243 import { hash } from ' $lib/helpers/string' ;
3344 import {
3445 documentActivitySheet ,
35- documentPermissionSheet
46+ documentPermissionSheet ,
47+ noSqlDocument
3648 } from ' $database/collection-[collection]/store' ;
3749 import {
3850 SideSheet ,
94106 label: ' Create documents' ,
95107 keys: page .url .pathname .endsWith (collection ?.$id ) ? [' d' ] : [' d' , ' c' ],
96108 callback : () => {
97- // TODO: later
109+ noSqlDocument . create ( buildInitDoc ());
98110 },
99111 icon: IconPlus ,
100112 group: ' documents'
233245 status: ' available'
234246 })) as Field [];
235247
236- // TODO: @itznotabug - maybe we should show a seekbar
237- const { rows } = generateFakeRecords (100 , fields );
248+ const { rows } = generateFakeRecords ($randomDataModalState .value , fields );
238249
239250 await sdk
240251 .forProject (page .params .region , page .params .project )
Original file line number Diff line number Diff line change 1717 IconPlus ,
1818 IconViewBoards
1919 } from ' @appwrite.io/pink-icons-svelte' ;
20- import { ID , type Models } from ' @appwrite.io/console' ;
20+ import { type Models } from ' @appwrite.io/console' ;
2121 import { expandTabs , randomDataModalState } from ' $database/store' ;
2222 import { EmptySheet , EmptySheetCards } from ' $database/(entity)' ;
2323 import {
2727 } from ' $database/collection-[collection]/store' ;
2828 import { canWriteRows } from ' $lib/stores/roles' ;
2929 import SpreadSheet from ' $database/collection-[collection]/spreadsheet.svelte' ;
30- import { toLocaleDateTime } from ' $lib/helpers/date' ;
3130 import ColumnDisplayNameInput from ' $database/collection-[collection]/(components)/inputs/displayName.svelte' ;
3231 import { Modal } from ' $lib/components' ;
32+ import { buildInitDoc } from ' ./+layout.svelte' ;
3333
3434 const { data }: PageProps = $props ();
3535
4040 let spreadsheet: SpreadSheet | null = $state (null );
4141 let columnDisplayNameInput: ColumnDisplayNameInput | null = $state (null );
4242
43- function buildInitDoc() {
44- const now = new Date ().toISOString ();
45- return {
46- $id: ID .unique (),
47- $createdAt: toLocaleDateTime (now ),
48- $updatedAt: toLocaleDateTime (now )
49- };
50- }
51-
5243 async function onSelect(file : Models .File , localFile = false ) {
5344 $isCollectionsJsonImportInProgress = true ;
5445
You can’t perform that action at this time.
0 commit comments