11<script setup lang="ts">
22import { ref , watch } from ' vue'
33import { API } from ' ./net'
4+ import type { QueryObject } from ' ./net'
45import type { Store } from ' ./store'
56import type { Pair } from ' ./types'
67import { ElMessage } from ' element-plus'
@@ -12,6 +13,10 @@ import { Refresh, Document } from '@element-plus/icons-vue'
1213const stores: Ref <Store []> = ref ([])
1314const kind = ref (' ' )
1415const store = ref (' ' )
16+ const query = ref ({
17+ offset: 0 ,
18+ limit: 10
19+ } as QueryObject )
1520const sqlQuery = ref (' ' )
1621const queryResult = ref ([] as any [])
1722const queryResultAsJSON = ref (' ' )
@@ -175,8 +180,12 @@ const executeQuery = async () => {
175180}
176181const executeWithQuery = async (sql : string ) => {
177182 let success = false
183+ query .value .store = store .value
184+ query .value .key = queryDataMeta .value .currentDatabase
185+ query .value .sql = sql
186+
178187 try {
179- const data = await API .DataQueryAsync (store .value , kind . value , queryDataMeta . value . currentDatabase , sql );
188+ const data = await API .DataQueryAsync (query .value );
180189 switch (kind .value ) {
181190 case ' atest-store-orm' :
182191 case ' atest-store-cassandra' :
@@ -207,6 +216,10 @@ const executeWithQuery = async (sql: string) => {
207216 }
208217 return success
209218}
219+ const nextPage = () => {
220+ query .value .offset += query .value .limit
221+ executeQuery ()
222+ }
210223 </script >
211224
212225<template >
@@ -234,7 +247,7 @@ const executeWithQuery = async (sql: string) => {
234247 </el-scrollbar >
235248 </el-aside >
236249 <el-container >
237- <el-header >
250+ <el-header style = " height : auto " >
238251 <el-form @submit.prevent =" executeQuery" >
239252 <el-row :gutter =" 10" >
240253 <el-col :span =" 4" >
@@ -264,6 +277,21 @@ const executeWithQuery = async (sql: string) => {
264277 </el-select >
265278 </el-col >
266279 </el-row >
280+ <el-row :gutter =" 10" v-if =" kind === 'atest-store-elasticsearch'" >
281+ <el-col :span =" 10" >
282+ <el-input type =" number" v-model =" query.offset" >
283+ <template #prepend >Offset</template >
284+ </el-input >
285+ </el-col >
286+ <el-col :span =" 10" >
287+ <el-input type =" number" v-model =" query.limit" >
288+ <template #prepend >Limit</template >
289+ </el-input >
290+ </el-col >
291+ <el-col :span =" 2" >
292+ <el-button type =" primary" @click =" nextPage" >Next</el-button >
293+ </el-col >
294+ </el-row >
267295 </el-form >
268296 </el-header >
269297 <el-main >
0 commit comments