File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 7777 <q-select
7878 v-model =" currentCollection"
7979 borderless
80- :options =" store.data.collections"
80+ :options =" filteredCollections"
81+ use-input
82+ fill-input
83+ hide-selected
84+ input-debounce =" 0"
8185 label =" Collection"
8286 option-label =" name"
8387 color =" white"
8488 label-color =" white"
8589 dark
90+ @filter =" collectionFilterFn"
8691 />
8792 </q-item-section >
8893 </q-item >
161166
162167<script setup lang="ts">
163168import type { CollectionSchema } from ' typesense/lib/Typesense/Collection' ;
164- import { computed } from ' vue' ;
169+ import { computed , ref } from ' vue' ;
165170import { useNodeStore } from ' src/stores/node' ;
166171
167172const store = useNodeStore ();
168173
174+ const sortedCollections = computed (() =>
175+ store .data .collections .slice (0 ).sort ((a , b ) => a .name .localeCompare (b .name )),
176+ );
177+
178+ const filteredCollections = ref <CollectionSchema []>([]);
179+
180+ function collectionFilterFn(val : string , update : (fn : () => void ) => void ) {
181+ if (val === ' ' ) {
182+ update (() => {
183+ filteredCollections .value = sortedCollections .value ;
184+ });
185+ return ;
186+ }
187+
188+ update (() => {
189+ const needle = val .toLowerCase ();
190+ filteredCollections .value = sortedCollections .value .filter ((v ) =>
191+ v .name .toLowerCase ().includes (needle ),
192+ );
193+ });
194+ }
195+
169196const currentCollection = computed ({
170197 get() {
171198 return store .currentCollection ;
Original file line number Diff line number Diff line change @@ -109,7 +109,9 @@ const state = reactive({
109109 ] as QTableProps [' columns' ],
110110});
111111
112- const collectionNames = computed (() => store .data .collections .map ((collection ) => collection .name ));
112+ const collectionNames = computed (() =>
113+ store .data .collections .map ((collection ) => collection .name ).sort (),
114+ );
113115const isUpdate = computed (() => store .data .aliases .map ((a ) => a .name ).includes (state .alias .name ));
114116async function createAlias() {
115117 await store .createAlias ({
You can’t perform that action at this time.
0 commit comments