Fix showing of example of queries

This commit is contained in:
Ivana Huckova 2022-06-10 15:03:09 +02:00
parent f6395eed7d
commit b1eb073fbe
3 changed files with 54 additions and 58 deletions

View File

@ -12,6 +12,8 @@ var (
ErrQueryAlreadyStarred = errors.New("query was already starred")
)
type Queries *simplejson.Json
// QueryHistory is the model for query history definitions
type QueryHistory struct {
ID int64 `xorm:"pk autoincr 'id'"`
@ -21,7 +23,7 @@ type QueryHistory struct {
CreatedBy int64
CreatedAt int64
Comment string
Queries *simplejson.Json
Queries Queries
}
// QueryHistory is the model for query history star definitions
@ -43,13 +45,13 @@ type SearchInQueryHistoryQuery struct {
}
type QueryHistoryDTO struct {
UID string `json:"uid" xorm:"uid"`
DatasourceUID string `json:"datasourceUid" xorm:"datasource_uid"`
CreatedBy int64 `json:"createdBy"`
CreatedAt int64 `json:"createdAt"`
Comment string `json:"comment"`
Queries *simplejson.Json `json:"queries"`
Starred bool `json:"starred"`
UID string `json:"uid" xorm:"uid"`
DatasourceUID string `json:"datasourceUid" xorm:"datasource_uid"`
CreatedBy int64 `json:"createdBy"`
CreatedAt int64 `json:"createdAt"`
Comment string `json:"comment"`
Queries Queries `json:"queries"`
Starred bool `json:"starred"`
}
// QueryHistoryResponse is a response struct for QueryHistoryDTO
@ -75,11 +77,11 @@ type QueryHistoryDeleteQueryResponse struct {
}
type QueryToMigrate struct {
DatasourceUID string `json:"datasourceUid"`
Queries *simplejson.Json `json:"queries"`
CreatedAt int64 `json:"createdAt"`
Comment string `json:"comment"`
Starred bool `json:"starred"`
DatasourceUID string `json:"datasourceUid"`
Queries Queries `json:"queries"`
CreatedAt int64 `json:"createdAt"`
Comment string `json:"comment"`
Starred bool `json:"starred"`
}
type QueryHistoryMigrationResponse struct {
@ -97,7 +99,7 @@ type CreateQueryInQueryHistoryCommand struct {
// The JSON model of queries.
// required: true
// example: [ { "datasourceUid": "PE1C5CBDA0504A6A3", "queries": [ { "refId": "A", "key": "Q-87fed8e3-62ba-4eb2-8d2a-4129979bb4de-0", "scenarioId": "csv_content", "datasource": { "type": "testdata", "uid": "PD8C576611E62080A" } } ], "starred": false, "createdAt": 1643630762, "comment": "debugging" } ]
Queries *simplejson.Json `json:"queries"`
Queries Queries `json:"queries"`
}
// PatchQueryCommentInQueryHistoryCommand is the command for updating comment for query in query history

View File

@ -489,6 +489,13 @@
"summary": "Add a user role assignment.",
"operationId": "addUserRole",
"parameters": [
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
@ -496,13 +503,6 @@
"schema": {
"$ref": "#/definitions/AddUserRoleCommand"
}
},
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
@ -528,6 +528,13 @@
"summary": "Remove a user role assignment.",
"operationId": "removeUserRole",
"parameters": [
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
},
{
"type": "string",
"name": "roleUID",
@ -539,13 +546,6 @@
"description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.",
"name": "global",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
@ -5837,7 +5837,7 @@
{
"type": "integer",
"format": "int64",
"description": "Limit the number of returned results ",
"description": "Limit the number of returned results",
"name": "limit",
"in": "query"
},
@ -9412,7 +9412,8 @@
"example": "PE1C5CBDA0504A6A3"
},
"queries": {
"$ref": "#/definitions/Json"
"description": "The JSON model of queries.",
"example": "[ { \"datasourceUid\": \"PE1C5CBDA0504A6A3\", \"queries\": [ { \"refId\": \"A\", \"key\": \"Q-87fed8e3-62ba-4eb2-8d2a-4129979bb4de-0\", \"scenarioId\": \"csv_content\", \"datasource\": { \"type\": \"testdata\", \"uid\": \"PD8C576611E62080A\" } } ], \"starred\": false, \"createdAt\": 1643630762, \"comment\": \"debugging\" } ]"
}
}
},
@ -13013,9 +13014,7 @@
"datasourceUid": {
"type": "string"
},
"queries": {
"$ref": "#/definitions/Json"
},
"queries": {},
"starred": {
"type": "boolean"
},
@ -13199,9 +13198,7 @@
"datasourceUid": {
"type": "string"
},
"queries": {
"$ref": "#/definitions/Json"
},
"queries": {},
"starred": {
"type": "boolean"
}

View File

@ -489,6 +489,13 @@
"summary": "Add a user role assignment.",
"operationId": "addUserRole",
"parameters": [
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
},
{
"name": "body",
"in": "body",
@ -496,13 +503,6 @@
"schema": {
"$ref": "#/definitions/AddUserRoleCommand"
}
},
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
@ -528,6 +528,13 @@
"summary": "Remove a user role assignment.",
"operationId": "removeUserRole",
"parameters": [
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
},
{
"type": "string",
"name": "roleUID",
@ -539,13 +546,6 @@
"description": "A flag indicating if the assignment is global or not. If set to false, the default org ID of the authenticated user will be used from the request to remove assignment.",
"name": "global",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"name": "user_id",
"in": "path",
"required": true
}
],
"responses": {
@ -5837,7 +5837,7 @@
{
"type": "integer",
"format": "int64",
"description": "Limit the number of returned results ",
"description": "Limit the number of returned results",
"name": "limit",
"in": "query"
},
@ -9157,7 +9157,8 @@
"example": "PE1C5CBDA0504A6A3"
},
"queries": {
"$ref": "#/definitions/Json"
"description": "The JSON model of queries.",
"example": "[ { \"datasourceUid\": \"PE1C5CBDA0504A6A3\", \"queries\": [ { \"refId\": \"A\", \"key\": \"Q-87fed8e3-62ba-4eb2-8d2a-4129979bb4de-0\", \"scenarioId\": \"csv_content\", \"datasource\": { \"type\": \"testdata\", \"uid\": \"PD8C576611E62080A\" } } ], \"starred\": false, \"createdAt\": 1643630762, \"comment\": \"debugging\" } ]"
}
}
},
@ -11174,9 +11175,7 @@
"datasourceUid": {
"type": "string"
},
"queries": {
"$ref": "#/definitions/Json"
},
"queries": {},
"starred": {
"type": "boolean"
},
@ -11360,9 +11359,7 @@
"datasourceUid": {
"type": "string"
},
"queries": {
"$ref": "#/definitions/Json"
},
"queries": {},
"starred": {
"type": "boolean"
}