Skip to content

Commit 4a7fed9

Browse files
committed
fix the conflicts
2 parents c1630d3 + 9abb703 commit 4a7fed9

File tree

16 files changed

+644
-550
lines changed

16 files changed

+644
-550
lines changed

.github/workflows/license-check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
Test:
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-22.04
99
steps:
1010
- name: Check License Header
1111
uses: apache/[email protected]

cmd/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2023-2024 API Testing Authors.
2+
Copyright 2023-2025 API Testing Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -424,7 +424,7 @@ func startPlugins(storeExtMgr server.ExtManager, kinds *server.StoreKinds) (err
424424
const socketPrefix = "unix://"
425425

426426
for _, kind := range kinds.Data {
427-
if kind.Enabled && strings.HasPrefix(kind.Url, socketPrefix) {
427+
if kind.Enabled && (strings.HasPrefix(kind.Url, socketPrefix) || strings.Contains(kind.Url, ":")) {
428428
err = errors.Join(err, storeExtMgr.Start(kind.Name, kind.Url))
429429
}
430430
}

console/atest-ui/src/views/DataManager.vue

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { ref, watch } from 'vue'
33
import { API } from './net'
4+
import type { QueryObject } from './net'
45
import type { Store } from './store'
56
import type { Pair } from './types'
67
import { ElMessage } from 'element-plus'
@@ -12,6 +13,10 @@ import { Refresh, Document } from '@element-plus/icons-vue'
1213
const stores: Ref<Store[]> = ref([])
1314
const kind = ref('')
1415
const store = ref('')
16+
const query = ref({
17+
offset: 0,
18+
limit: 10
19+
} as QueryObject)
1520
const sqlQuery = ref('')
1621
const queryResult = ref([] as any[])
1722
const queryResultAsJSON = ref('')
@@ -34,8 +39,17 @@ watch(store, (s) => {
3439
return
3540
}
3641
})
37-
queryDataMeta.value.currentDatabase = ''
38-
sqlQuery.value = ''
42+
43+
switch (kind.value) {
44+
case 'atest-store-elasticsearch':
45+
case 'atest-store-etcd':
46+
sqlQuery.value = '*'
47+
break
48+
default:
49+
queryDataMeta.value.currentDatabase = ''
50+
sqlQuery.value = ''
51+
}
52+
3953
executeQuery()
4054
})
4155
@@ -63,13 +77,22 @@ const describeTable = (data: QueryData) => {
6377
case 'atest-store-cassandra':
6478
sqlQuery.value = `@describeTable_${queryDataMeta.value.currentDatabase}:${data.label}`
6579
break
80+
break
6681
default:
6782
sqlQuery.value = `@describeTable_${data.label}`
6883
}
6984
executeQuery()
7085
}
7186
const queryTables = () => {
72-
sqlQuery.value = ``
87+
switch (kind.value) {
88+
case 'atest-store-elasticsearch':
89+
if (sqlQuery.value === '') {
90+
sqlQuery.value = '*'
91+
}
92+
break
93+
default:
94+
sqlQuery.value = ``
95+
}
7396
executeQuery()
7497
}
7598
watch(kind, (k) => {
@@ -84,6 +107,9 @@ watch(kind, (k) => {
84107
case 'atest-store-redis':
85108
queryTip.value = 'Enter key'
86109
break;
110+
case 'atest-store-elasticsearch':
111+
queryTip.value = 'field:value OR field:other'
112+
break;
87113
}
88114
})
89115
@@ -162,12 +188,18 @@ const executeWithQuery = async (sql: string) => {
162188
}
163189
164190
let success = false
191+
query.value.store = store.value
192+
query.value.key = queryDataMeta.value.currentDatabase
193+
query.value.sql = sql
194+
165195
try {
166-
const data = await API.DataQueryAsync(store.value, kind.value, queryDataMeta.value.currentDatabase, sql);
196+
const data = await API.DataQueryAsync(query.value);
167197
switch (kind.value) {
168198
case 'atest-store-orm':
169199
case 'atest-store-cassandra':
170200
case 'atest-store-iotdb':
201+
case 'atest-store-opengemini':
202+
case 'atest-store-elasticsearch':
171203
ormDataHandler(data)
172204
success = true
173205
break;
@@ -193,12 +225,16 @@ const executeWithQuery = async (sql: string) => {
193225
}
194226
return success
195227
}
228+
const nextPage = () => {
229+
query.value.offset += query.value.limit
230+
executeQuery()
231+
}
196232
</script>
197233

198234
<template>
199235
<div>
200236
<el-container style="height: calc(100vh - 50px);">
201-
<el-aside v-if="kind === 'atest-store-orm' || kind === 'atest-store-iotdb' || kind === 'atest-store-cassandra'">
237+
<el-aside v-if="kind === 'atest-store-orm' || kind === 'atest-store-iotdb' || kind === 'atest-store-cassandra' || kind === 'atest-store-elasticsearch' || kind === 'atest-store-opengemini'">
202238
<el-scrollbar>
203239
<el-select v-model="queryDataMeta.currentDatabase" placeholder="Select database"
204240
@change="queryTables" filterable>
@@ -220,7 +256,7 @@ const executeWithQuery = async (sql: string) => {
220256
</el-scrollbar>
221257
</el-aside>
222258
<el-container>
223-
<el-header>
259+
<el-header style="height: auto">
224260
<el-form @submit.prevent="executeQuery">
225261
<el-row :gutter="10">
226262
<el-col :span="4">
@@ -250,6 +286,21 @@ const executeWithQuery = async (sql: string) => {
250286
</el-select>
251287
</el-col>
252288
</el-row>
289+
<el-row :gutter="10" v-if="kind === 'atest-store-elasticsearch'">
290+
<el-col :span="10">
291+
<el-input type="number" v-model="query.offset">
292+
<template #prepend>Offset</template>
293+
</el-input>
294+
</el-col>
295+
<el-col :span="10">
296+
<el-input type="number" v-model="query.limit">
297+
<template #prepend>Limit</template>
298+
</el-input>
299+
</el-col>
300+
<el-col :span="2">
301+
<el-button type="primary" @click="nextPage">Next</el-button>
302+
</el-col>
303+
</el-row>
253304
</el-form>
254305
</el-header>
255306
<el-main>

console/atest-ui/src/views/__test__/store.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { SupportedExtension, SupportedExtensions } from "../store";
1919
describe("SupportedExtensions", () => {
2020
test('length check', () => {
2121
const extensions = SupportedExtensions()
22-
expect(extensions.length).toBe(8)
22+
expect(extensions.length).toBe(10)
2323
})
2424

2525
for (const extension of SupportedExtensions()) {

console/atest-ui/src/views/net.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2023-2024 API Testing Authors.
2+
Copyright 2023-2025 API Testing Authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import { ca } from 'element-plus/es/locales.mjs'
1716
import { Cache } from './cache'
1817

1918
async function DefaultResponseProcess(response: any) {
@@ -780,33 +779,23 @@ var SBOM = (callback: (d: any) => void) => {
780779
.then(callback)
781780
}
782781

783-
interface QueryObject {
782+
export interface QueryObject {
783+
store: string
784784
sql: string
785785
key: string
786+
offset: number
787+
limit: number
786788
}
787-
var DataQueryAsync = (store: string, kind: string, currentDatabase: string, query: string) => {
788-
const queryObj = {} as QueryObject;
789-
switch (kind) {
790-
case 'atest-store-orm':
791-
case 'atest-store-cassandra':
792-
case 'atest-store-iotdb':
793-
queryObj['sql'] = query;
794-
queryObj['key'] = currentDatabase;
795-
break;
796-
case 'atest-store-etcd':
797-
queryObj['key'] = query;
798-
break;
799-
case 'atest-store-redis':
800-
queryObj['key'] = query;
801-
break;
802-
}
789+
const DataQueryAsync = (query: QueryObject) => {
803790
const requestOptions = {
804791
method: 'POST',
805792
headers: {
806-
'X-Store-Name': store,
807-
'X-Database': currentDatabase
793+
'X-Store-Name': query.store,
794+
'X-Database': query.key,
795+
'X-Offset': `${query.offset}`,
796+
'X-Limit': `${query.limit}`
808797
},
809-
body: JSON.stringify(queryObj)
798+
body: JSON.stringify(query)
810799
}
811800
return fetch(`/api/v1/data/query`, requestOptions)
812801
.then(DefaultResponseProcess)

console/atest-ui/src/views/store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ const storeExtensions = [
115115
defaultValue: 'atest'
116116
}],
117117
link: 'https://github.com/LinuxSuRen/atest-ext-store-mongodb'
118+
},
119+
{
120+
name: 'atest-store-elasticsearch',
121+
params: [],
122+
link: 'https://github.com/LinuxSuRen/atest-ext-store-elasticsearch'
123+
},
124+
{
125+
name: 'atest-store-opengemini',
126+
params: [],
127+
link: 'https://github.com/LinuxSuRen/atest-ext-store-opengemini'
118128
}
119129
] as Store[]
120130

extensions/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Ports in extensions:
1010
| Store | [redis](https://github.com/LinuxSuRen/atest-ext-store-redis) | |
1111
| Store | [iotdb](https://github.com/LinuxSuRen/atest-ext-store-iotdb) | |
1212
| Store | [Cassandra](https://github.com/LinuxSuRen/atest-ext-store-cassandra) | |
13+
| Store | [Elasticsearch](https://github.com/LinuxSuRen/atest-ext-store-elasticsearch) | |
1314
| Monitor | [docker-monitor](https://github.com/LinuxSuRen/atest-ext-monitor-docker) | |
1415
| Agent | [collector](https://github.com/LinuxSuRen/atest-ext-collector) | |
1516
| Secret | [Vault](https://github.com/LinuxSuRen/api-testing-vault-extension) | |

pkg/server/gateway.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
package server
1717

1818
import (
19-
context "context"
19+
"context"
2020
"net/http"
2121

2222
"google.golang.org/grpc/metadata"

pkg/server/remote_server.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,10 @@ func (s *server) Query(ctx context.Context, query *DataQuery) (result *DataQuery
12601260
defer loader.Close()
12611261
var dataResult testing.DataResult
12621262
if dataResult, err = loader.Query(map[string]string{
1263-
"sql": query.Sql,
1264-
"key": query.Key,
1263+
"sql": query.Sql,
1264+
"key": query.Key,
1265+
"offset": fmt.Sprintf("%d", query.Offset),
1266+
"limit": fmt.Sprintf("%d", query.Limit),
12651267
}); err == nil {
12661268
result = &DataQueryResult{
12671269
Data: mapToPair(dataResult.Pairs),

0 commit comments

Comments
 (0)