Skip to content

Commit 93edc75

Browse files
committed
feat(DataManager): add support for multiple databases
- Add currentDatabase parameter to DataQuery function - Update API request to include X-Database header - Modify query object for atest-store-orm to include database key
1 parent d04519d commit 93edc75

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const keyValueDataHandler = (data) => {
9090
}
9191
9292
const executeQuery = async () => {
93-
API.DataQuery(store.value, kind.value, sqlQuery.value, (data) => {
93+
API.DataQuery(store.value, kind.value, currentDatabase.value, sqlQuery.value, (data) => {
9494
switch (kind.value) {
9595
case 'atest-store-orm':
9696
ormDataHandler(data)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,12 @@ var SBOM = (callback: (d: any) => void) => {
773773
.then(callback)
774774
}
775775

776-
var DataQuery = (store: string, kind: string, query: string, callback: (d: any) => void, errHandler: (d: any) => void) => {
776+
var DataQuery = (store: string, kind: string, currentDatabase: string, query: string, callback: (d: any) => void, errHandler: (d: any) => void) => {
777777
const queryObj = {}
778778
switch (kind) {
779779
case 'atest-store-orm':
780780
queryObj['sql'] = query;
781+
queryObj['key'] = currentDatabase;
781782
break;
782783
case 'atest-store-etcd':
783784
queryObj['key'] = query;
@@ -786,7 +787,8 @@ var DataQuery = (store: string, kind: string, query: string, callback: (d: any)
786787
const requestOptions = {
787788
method: 'POST',
788789
headers: {
789-
'X-Store-Name': store
790+
'X-Store-Name': store,
791+
'X-Database': currentDatabase
790792
},
791793
body: JSON.stringify(queryObj)
792794
}

0 commit comments

Comments
 (0)