From 4ada671bfdef0ac84a700e991bdd363b4c9d6748 Mon Sep 17 00:00:00 2001 From: nolouch Date: Fri, 2 Feb 2024 03:30:31 +0800 Subject: [PATCH] feat(slow-query): support slow query search by resource group Signed-off-by: nolouch --- pkg/apiserver/resource_manager/service.go | 27 ++++++ pkg/apiserver/slowquery/queries.go | 19 ++-- .../src/client/api/api/default-api.ts | 89 +++++++++++++++++-- .../api/models/slowquery-get-list-request.ts | 6 ++ .../tidb-dashboard-client/swagger/spec.json | 42 +++++++++ .../src/apps/SlowQuery/context.ts | 7 ++ .../src/apps/Statement/context.ts | 6 ++ .../src/apps/SlowQuery/context.ts | 15 +++- .../src/apps/SlowQuery/context.ts | 9 +- .../src/apps/Statement/context.ts | 6 ++ .../src/apps/SlowQuery/context/index.ts | 4 + .../src/apps/SlowQuery/pages/List/index.tsx | 32 ++++++- .../src/apps/SlowQuery/translations/en.yaml | 4 + .../src/apps/SlowQuery/translations/zh.yaml | 4 + .../utils/useSlowQueryTableController.ts | 22 ++++- .../tidb-dashboard-lib/src/client/models.ts | 6 ++ 16 files changed, 279 insertions(+), 19 deletions(-) diff --git a/pkg/apiserver/resource_manager/service.go b/pkg/apiserver/resource_manager/service.go index aa33b042c3..fb41c1c536 100644 --- a/pkg/apiserver/resource_manager/service.go +++ b/pkg/apiserver/resource_manager/service.go @@ -7,6 +7,8 @@ import ( "fmt" "net/http" "regexp" + "sort" + "strings" "time" "github.com/gin-gonic/gin" @@ -46,6 +48,7 @@ func registerRouter(r *gin.RouterGroup, auth *user.AuthService, s *Service) { { endpoint.GET("/config", s.GetConfig) endpoint.GET("/information", s.GetInformation) + endpoint.GET("/information/group_names", s.resourceGroupNamesHandler) endpoint.GET("/calibrate/hardware", s.GetCalibrateByHardware) endpoint.GET("/calibrate/actual", s.GetCalibrateByActual) } @@ -96,6 +99,30 @@ func (s *Service) GetInformation(c *gin.Context) { c.JSON(http.StatusOK, cfg) } +// @Summary List all resource groups +// @Router /resource_manager/information/group_names [get] +// @Security JwtAuth +// @Success 200 {object} []string +// @Failure 401 {object} rest.ErrorResponse +func (s *Service) resourceGroupNamesHandler(c *gin.Context) { + type groupSchemas struct { + Groups string `gorm:"column:NAME"` + } + var result []groupSchemas + db := utils.GetTiDBConnection(c) + err := db.Raw("SELECT NAME FROM INFORMATION_SCHEMA.RESOURCE_GROUPS").Scan(&result).Error + if err != nil { + rest.Error(c, err) + return + } + strs := []string{} + for _, v := range result { + strs = append(strs, strings.ToLower(v.Groups)) + } + sort.Strings(strs) + c.JSON(http.StatusOK, strs) +} + type CalibrateResponse struct { EstimatedCapacity int `json:"estimated_capacity" gorm:"column:QUOTA"` } diff --git a/pkg/apiserver/slowquery/queries.go b/pkg/apiserver/slowquery/queries.go index 19cc2d6d0b..a964c4a688 100644 --- a/pkg/apiserver/slowquery/queries.go +++ b/pkg/apiserver/slowquery/queries.go @@ -15,13 +15,14 @@ const ( ) type GetListRequest struct { - BeginTime int `json:"begin_time" form:"begin_time"` - EndTime int `json:"end_time" form:"end_time"` - DB []string `json:"db" form:"db"` - Limit int `json:"limit" form:"limit"` - Text string `json:"text" form:"text"` - OrderBy string `json:"orderBy" form:"orderBy"` - IsDesc bool `json:"desc" form:"desc"` + BeginTime int `json:"begin_time" form:"begin_time"` + EndTime int `json:"end_time" form:"end_time"` + DB []string `json:"db" form:"db"` + ResourceGroup []string `json:"resource_group" form:"resource_group"` + Limit int `json:"limit" form:"limit"` + Text string `json:"text" form:"text"` + OrderBy string `json:"orderBy" form:"orderBy"` + IsDesc bool `json:"desc" form:"desc"` // for showing slow queries in the statement detail page Plans []string `json:"plans" form:"plans"` @@ -79,6 +80,10 @@ func QuerySlowLogList(req *GetListRequest, sysSchema *utils.SysSchema, db *gorm. tx = tx.Where("DB IN (?)", req.DB) } + if len(req.ResourceGroup) > 0 { + tx = tx.Where("RESOURCE_GROUP IN (?)", req.ResourceGroup) + } + // more robust if req.OrderBy == "" { req.OrderBy = "timestamp" diff --git a/ui/packages/tidb-dashboard-client/src/client/api/api/default-api.ts b/ui/packages/tidb-dashboard-client/src/client/api/api/default-api.ts index b7b71423d6..ec429bee4f 100644 --- a/ui/packages/tidb-dashboard-client/src/client/api/api/default-api.ts +++ b/ui/packages/tidb-dashboard-client/src/client/api/api/default-api.ts @@ -2631,6 +2631,39 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List all resource groups + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceManagerInformationGroupNamesGet: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/resource_manager/information/group_names`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication JwtAuth required + await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration) + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -2809,11 +2842,12 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati * @param {number} [limit] * @param {string} [orderBy] * @param {Array} [plans] for showing slow queries in the statement detail page + * @param {Array} [resourceGroup] * @param {string} [text] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - slowQueryListGet: async (beginTime?: number, db?: Array, desc?: boolean, digest?: string, endTime?: number, fields?: string, limit?: number, orderBy?: string, plans?: Array, text?: string, options: AxiosRequestConfig = {}): Promise => { + slowQueryListGet: async (beginTime?: number, db?: Array, desc?: boolean, digest?: string, endTime?: number, fields?: string, limit?: number, orderBy?: string, plans?: Array, resourceGroup?: Array, text?: string, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/slow_query/list`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -2865,6 +2899,10 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati localVarQueryParameter['plans'] = plans; } + if (resourceGroup) { + localVarQueryParameter['resource_group'] = resourceGroup; + } + if (text !== undefined) { localVarQueryParameter['text'] = text; } @@ -4761,6 +4799,16 @@ export const DefaultApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.resourceManagerInformationGet(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @summary List all resource groups + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async resourceManagerInformationGroupNamesGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.resourceManagerInformationGroupNamesGet(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * Get available field names by slowquery table columns * @summary Get available field names @@ -4818,12 +4866,13 @@ export const DefaultApiFp = function(configuration?: Configuration) { * @param {number} [limit] * @param {string} [orderBy] * @param {Array} [plans] for showing slow queries in the statement detail page + * @param {Array} [resourceGroup] * @param {string} [text] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async slowQueryListGet(beginTime?: number, db?: Array, desc?: boolean, digest?: string, endTime?: number, fields?: string, limit?: number, orderBy?: string, plans?: Array, text?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.slowQueryListGet(beginTime, db, desc, digest, endTime, fields, limit, orderBy, plans, text, options); + async slowQueryListGet(beginTime?: number, db?: Array, desc?: boolean, digest?: string, endTime?: number, fields?: string, limit?: number, orderBy?: string, plans?: Array, resourceGroup?: Array, text?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.slowQueryListGet(beginTime, db, desc, digest, endTime, fields, limit, orderBy, plans, resourceGroup, text, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -5815,6 +5864,15 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa resourceManagerInformationGet(options?: any): AxiosPromise> { return localVarFp.resourceManagerInformationGet(options).then((request) => request(axios, basePath)); }, + /** + * + * @summary List all resource groups + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceManagerInformationGroupNamesGet(options?: any): AxiosPromise> { + return localVarFp.resourceManagerInformationGroupNamesGet(options).then((request) => request(axios, basePath)); + }, /** * Get available field names by slowquery table columns * @summary Get available field names @@ -5868,12 +5926,13 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa * @param {number} [limit] * @param {string} [orderBy] * @param {Array} [plans] for showing slow queries in the statement detail page + * @param {Array} [resourceGroup] * @param {string} [text] * @param {*} [options] Override http request option. * @throws {RequiredError} */ - slowQueryListGet(beginTime?: number, db?: Array, desc?: boolean, digest?: string, endTime?: number, fields?: string, limit?: number, orderBy?: string, plans?: Array, text?: string, options?: any): AxiosPromise> { - return localVarFp.slowQueryListGet(beginTime, db, desc, digest, endTime, fields, limit, orderBy, plans, text, options).then((request) => request(axios, basePath)); + slowQueryListGet(beginTime?: number, db?: Array, desc?: boolean, digest?: string, endTime?: number, fields?: string, limit?: number, orderBy?: string, plans?: Array, resourceGroup?: Array, text?: string, options?: any): AxiosPromise> { + return localVarFp.slowQueryListGet(beginTime, db, desc, digest, endTime, fields, limit, orderBy, plans, resourceGroup, text, options).then((request) => request(axios, basePath)); }, /** * Start a profiling task group @@ -6949,6 +7008,13 @@ export interface DefaultApiSlowQueryListGetRequest { */ readonly plans?: Array + /** + * + * @type {Array} + * @memberof DefaultApiSlowQueryListGet + */ + readonly resourceGroup?: Array + /** * * @type {string} @@ -8189,6 +8255,17 @@ export class DefaultApi extends BaseAPI { return DefaultApiFp(this.configuration).resourceManagerInformationGet(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @summary List all resource groups + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public resourceManagerInformationGroupNamesGet(options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).resourceManagerInformationGroupNamesGet(options).then((request) => request(this.axios, this.basePath)); + } + /** * Get available field names by slowquery table columns * @summary Get available field names @@ -8245,7 +8322,7 @@ export class DefaultApi extends BaseAPI { * @memberof DefaultApi */ public slowQueryListGet(requestParameters: DefaultApiSlowQueryListGetRequest = {}, options?: AxiosRequestConfig) { - return DefaultApiFp(this.configuration).slowQueryListGet(requestParameters.beginTime, requestParameters.db, requestParameters.desc, requestParameters.digest, requestParameters.endTime, requestParameters.fields, requestParameters.limit, requestParameters.orderBy, requestParameters.plans, requestParameters.text, options).then((request) => request(this.axios, this.basePath)); + return DefaultApiFp(this.configuration).slowQueryListGet(requestParameters.beginTime, requestParameters.db, requestParameters.desc, requestParameters.digest, requestParameters.endTime, requestParameters.fields, requestParameters.limit, requestParameters.orderBy, requestParameters.plans, requestParameters.resourceGroup, requestParameters.text, options).then((request) => request(this.axios, this.basePath)); } /** diff --git a/ui/packages/tidb-dashboard-client/src/client/api/models/slowquery-get-list-request.ts b/ui/packages/tidb-dashboard-client/src/client/api/models/slowquery-get-list-request.ts index 87a16ce292..c76921ad3a 100644 --- a/ui/packages/tidb-dashboard-client/src/client/api/models/slowquery-get-list-request.ts +++ b/ui/packages/tidb-dashboard-client/src/client/api/models/slowquery-get-list-request.ts @@ -74,6 +74,12 @@ export interface SlowqueryGetListRequest { * @memberof SlowqueryGetListRequest */ 'plans'?: Array; + /** + * + * @type {Array} + * @memberof SlowqueryGetListRequest + */ + 'resource_group'?: Array; /** * * @type {string} diff --git a/ui/packages/tidb-dashboard-client/swagger/spec.json b/ui/packages/tidb-dashboard-client/swagger/spec.json index bb5e5b19f7..be088ed271 100644 --- a/ui/packages/tidb-dashboard-client/swagger/spec.json +++ b/ui/packages/tidb-dashboard-client/swagger/spec.json @@ -2287,6 +2287,33 @@ } } }, + "/resource_manager/information/group_names": { + "get": { + "security": [ + { + "JwtAuth": [] + } + ], + "summary": "List all resource groups", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/rest.ErrorResponse" + } + } + } + } + }, "/slow_query/available_fields": { "get": { "security": [ @@ -2502,6 +2529,15 @@ "name": "plans", "in": "query" }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi", + "name": "resource_group", + "in": "query" + }, { "type": "string", "name": "text", @@ -4960,6 +4996,12 @@ "type": "string" } }, + "resource_group": { + "type": "array", + "items": { + "type": "string" + } + }, "text": { "type": "string" } diff --git a/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/SlowQuery/context.ts b/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/SlowQuery/context.ts index 6300ec8915..449d74b829 100644 --- a/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/SlowQuery/context.ts +++ b/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/SlowQuery/context.ts @@ -15,6 +15,10 @@ class DataSource implements ISlowQueryDataSource { return client.getInstance().infoListDatabases(options) } + infoListResourceGroupNames(options?: ReqConfig) { + return client.getInstance().resourceManagerInformationGroupNamesGet(options) + } + slowQueryAvailableFieldsGet(options?: ReqConfig) { return client.getInstance().slowQueryAvailableFieldsGet(options) } @@ -29,6 +33,7 @@ class DataSource implements ISlowQueryDataSource { limit?: number, orderBy?: string, plans?: Array, + resourceGroup?: Array, text?: string, options?: ReqConfig ) { @@ -43,6 +48,7 @@ class DataSource implements ISlowQueryDataSource { limit, orderBy, plans, + resourceGroup, text }, options @@ -132,6 +138,7 @@ export const ctx: (cfg: Partial) => ISlowQueryContext = ( enableExport: true, showDBFilter: true, showDigestFilter: false, + showResourceGroupFilter: true, ...cfg } } diff --git a/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/Statement/context.ts b/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/Statement/context.ts index b356db45d9..2afa64756c 100644 --- a/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/Statement/context.ts +++ b/ui/packages/tidb-dashboard-for-clinic-cloud/src/apps/Statement/context.ts @@ -15,6 +15,10 @@ class DataSource implements IStatementDataSource { return client.getInstance().infoListDatabases(options) } + infoListResourceGroupNames(options?: ReqConfig) { + return client.getInstance().resourceManagerInformationGroupNamesGet(options) + } + statementsAvailableFieldsGet(options?: ReqConfig) { return client.getInstance().statementsAvailableFieldsGet(options) } @@ -123,6 +127,7 @@ class DataSource implements IStatementDataSource { limit?: number, orderBy?: string, plans?: Array, + resourceGroup?: Array, text?: string, options?: ReqConfig ) { @@ -137,6 +142,7 @@ class DataSource implements IStatementDataSource { limit, orderBy, plans, + resourceGroup, text }, options diff --git a/ui/packages/tidb-dashboard-for-clinic-op/src/apps/SlowQuery/context.ts b/ui/packages/tidb-dashboard-for-clinic-op/src/apps/SlowQuery/context.ts index 53a13ec79d..6d485b1b1a 100644 --- a/ui/packages/tidb-dashboard-for-clinic-op/src/apps/SlowQuery/context.ts +++ b/ui/packages/tidb-dashboard-for-clinic-op/src/apps/SlowQuery/context.ts @@ -30,6 +30,17 @@ class DataSource implements ISlowQueryDataSource { } as any) } + infoListResourceGroupNames(options?: ReqConfig) { + // return Promise.reject(new Error('no need to implemented')) + return Promise.resolve({ + data: [], + status: 200, + statusText: 'ok', + headers: {}, + config: {} + } as any) + } + slowQueryAvailableFieldsGet(options?: ReqConfig) { // return Promise.reject(new Error('no need to implemented')) return Promise.resolve({ @@ -51,6 +62,7 @@ class DataSource implements ISlowQueryDataSource { limit?: number, orderBy?: string, plans?: Array, + resourceGroup?: Array, text?: string, options?: ReqConfig ) { @@ -119,6 +131,7 @@ export const ctx: (extra: DsExtra) => ISlowQueryContext = (extra) => ({ apiPathBase: client.getBasePath(), enableExport: false, showDBFilter: false, - showDigestFilter: false + showDigestFilter: false, + showResourceGroupFilter: true } }) diff --git a/ui/packages/tidb-dashboard-for-op/src/apps/SlowQuery/context.ts b/ui/packages/tidb-dashboard-for-op/src/apps/SlowQuery/context.ts index 76647db20a..b55091c0d3 100644 --- a/ui/packages/tidb-dashboard-for-op/src/apps/SlowQuery/context.ts +++ b/ui/packages/tidb-dashboard-for-op/src/apps/SlowQuery/context.ts @@ -11,6 +11,10 @@ class DataSource implements ISlowQueryDataSource { return client.getInstance().infoListDatabases(options) } + infoListResourceGroupNames(options?: ReqConfig) { + return client.getInstance().resourceManagerInformationGroupNamesGet(options) + } + slowQueryAvailableFieldsGet(options?: ReqConfig) { return client.getInstance().slowQueryAvailableFieldsGet(options) } @@ -25,6 +29,7 @@ class DataSource implements ISlowQueryDataSource { limit?: number, orderBy?: string, plans?: Array, + resourceGroup?: Array, text?: string, options?: ReqConfig ) { @@ -39,6 +44,7 @@ class DataSource implements ISlowQueryDataSource { limit, orderBy, plans, + resourceGroup, text }, options @@ -74,7 +80,8 @@ export const ctx: ISlowQueryContext = { apiPathBase: client.getBasePath(), enableExport: true, showDBFilter: true, - showDigestFilter: false + showDigestFilter: false, + showResourceGroupFilter: true // instantQuery: false, // timeRangeSelector: { // recentSeconds: [3 * 24 * 60 * 60], diff --git a/ui/packages/tidb-dashboard-for-op/src/apps/Statement/context.ts b/ui/packages/tidb-dashboard-for-op/src/apps/Statement/context.ts index 8db77b5291..ff46c15b61 100644 --- a/ui/packages/tidb-dashboard-for-op/src/apps/Statement/context.ts +++ b/ui/packages/tidb-dashboard-for-op/src/apps/Statement/context.ts @@ -15,6 +15,10 @@ class DataSource implements IStatementDataSource { return client.getInstance().infoListDatabases(options) } + infoListResourceGroupNames(options?: ReqConfig) { + return client.getInstance().resourceManagerInformationGroupNamesGet(options) + } + statementsAvailableFieldsGet(options?: ReqConfig) { return client.getInstance().statementsAvailableFieldsGet(options) } @@ -163,6 +167,7 @@ class DataSource implements IStatementDataSource { limit?: number, orderBy?: string, plans?: Array, + resourceGroup?: Array, text?: string, options?: ReqConfig ) { @@ -177,6 +182,7 @@ class DataSource implements IStatementDataSource { limit, orderBy, plans, + resourceGroup, text }, options diff --git a/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/context/index.ts b/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/context/index.ts index 1423ec7d7b..018f7e17fa 100644 --- a/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/context/index.ts +++ b/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/context/index.ts @@ -10,6 +10,8 @@ import { PromDataSuccessResponse } from '@lib/utils' export interface ISlowQueryDataSource { infoListDatabases(options?: ReqConfig): AxiosPromise> + infoListResourceGroupNames(options?: ReqConfig): AxiosPromise> + slowQueryAvailableFieldsGet(options?: ReqConfig): AxiosPromise> slowQueryListGet( @@ -22,6 +24,7 @@ export interface ISlowQueryDataSource { limit?: number, orderBy?: string, plans?: Array, + resourceGroup?: Array, text?: string, options?: ReqConfig ): AxiosPromise> @@ -61,6 +64,7 @@ export interface ISlowQueryEvent { export interface ISlowQueryConfig extends IContextConfig { enableExport: boolean showDBFilter: boolean + showResourceGroupFilter: boolean showDigestFilter: boolean showHelp?: boolean diff --git a/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/pages/List/index.tsx b/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/pages/List/index.tsx index 71d6034969..1dc0b48aff 100644 --- a/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/pages/List/index.tsx +++ b/ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/pages/List/index.tsx @@ -127,6 +127,9 @@ function List() { const [filterText, setFilterText] = useState( controller.queryOptions.searchText ) + const [filterGroup, setFilterGroup] = useState( + controller.queryOptions.groups + ) const sendQueryNow = useMemoizedFn(() => { cacheMgr?.clear() @@ -137,7 +140,8 @@ function List() { searchText: filterText, visibleColumnKeys, digest: filterDigest, - plans: [] + plans: [], + groups: filterGroup }) }) @@ -155,7 +159,14 @@ function List() { return } sendQueryDebounced() - }, [timeRange, filterSchema, filterLimit, filterText, visibleColumnKeys]) + }, [ + timeRange, + filterSchema, + filterLimit, + filterText, + filterGroup, + visibleColumnKeys + ]) const downloadCSV = useMemoizedFn(async () => { // use last effective query options @@ -231,6 +242,23 @@ function List() { data-e2e="execution_database_name" /> )} + {ctx!.cfg.showResourceGroupFilter && + controller.allGroups.length > 1 && ( + + )}