Skip to content

Commit 41c9b16

Browse files
committed
feat: add more data as lables for the data query
1 parent 9c243c2 commit 41c9b16

File tree

7 files changed

+449
-425
lines changed

7 files changed

+449
-425
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ watch(store, (s) => {
2929
return
3030
}
3131
})
32-
queryDataMeta.currentDatabase = ''
32+
queryDataMeta.value.currentDatabase = ''
3333
sqlQuery.value = ''
3434
executeQuery()
3535
})
@@ -38,7 +38,8 @@ interface QueryDataMeta {
3838
databases: string[]
3939
tables: string[]
4040
currentDatabase: string
41-
duration: string
41+
duration: string
42+
labels: Pair[]
4243
}
4344
4445
interface QueryData {
@@ -208,6 +209,7 @@ const executeQuery = async () => {
208209
<div style="display: flex; gap: 8px;">
209210
<el-tag type="primary" v-if="queryResult.length > 0">{{ queryResult.length }} rows</el-tag>
210211
<el-tag type="primary" v-if="queryDataMeta.duration">{{ queryDataMeta.duration }}</el-tag>
212+
<el-tag type="primary" v-for="label in queryDataMeta.labels">{{ label.value }}</el-tag>
211213
</div>
212214
<el-table :data="queryResult" stripe v-if="dataFormat === 'table'">
213215
<el-table-column v-for="col in columns" :key="col" :prop="col" :label="col" sortable/>

pkg/server/remote_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,7 @@ func (s *server) Query(ctx context.Context, query *DataQuery) (result *DataQuery
12621262
Databases: dataResult.Databases,
12631263
Tables: dataResult.Tables,
12641264
Duration: dataResult.Duration,
1265+
Labels: mapToPair(dataResult.Labels),
12651266
}
12661267
}
12671268
return

pkg/server/server.pb.go

Lines changed: 434 additions & 423 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/server.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,5 @@ message DataMeta {
671671
repeated string tables = 2;
672672
string currentDatabase = 3;
673673
string duration = 4;
674+
repeated Pair labels = 5;
674675
}

pkg/server/server.swagger.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,6 +2839,13 @@
28392839
},
28402840
"duration": {
28412841
"type": "string"
2842+
},
2843+
"labels": {
2844+
"type": "array",
2845+
"items": {
2846+
"type": "object",
2847+
"$ref": "#/definitions/serverPair"
2848+
}
28422849
}
28432850
}
28442851
},

pkg/testing/loader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type DataResult struct {
3737
Tables []string
3838
CurrentDatabase string
3939
Duration string
40+
Labels map[string]string
4041
}
4142

4243
type Writer interface {

pkg/testing/remote/grpc_store.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ func (g *gRPCLoader) Query(query map[string]string) (result testing.DataResult,
322322
result.Tables = dataResult.Meta.Tables
323323
result.CurrentDatabase = dataResult.Meta.CurrentDatabase
324324
result.Duration = dataResult.Meta.Duration
325+
result.Labels = pairToMap(dataResult.Meta.Labels)
325326
}
326327
}
327328
return

0 commit comments

Comments
 (0)