Skip to content

Commit

Permalink
Merge branch 'master' into issue-890
Browse files Browse the repository at this point in the history
  • Loading branch information
unbyte authored May 12, 2021
2 parents 9cd2138 + 5db7d54 commit 6e033ac
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 178 deletions.
10 changes: 5 additions & 5 deletions pkg/apiserver/statement/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ type testConfig struct {
}

func (t *testConfigSuite) Test_buildConfigQuerySQL_struct_success(c *C) {
testConfigStmt := "SELECT @@GLOBAL.tidb_enable_stmt_summary as tidb_enable_stmt_summary,@@GLOBAL.tidb_stmt_summary_refresh_interval as tidb_stmt_summary_refresh_interval"
testConfigStmt := "SELECT @@GLOBAL.tidb_enable_stmt_summary AS tidb_enable_stmt_summary, @@GLOBAL.tidb_stmt_summary_refresh_interval AS tidb_stmt_summary_refresh_interval"
c.Assert(buildConfigQuerySQL(testConfig{}), Equals, testConfigStmt)
}

func (t *testConfigSuite) Test_buildConfigQuerySQL_ptr_success(c *C) {
testConfigStmt := "SELECT @@GLOBAL.tidb_enable_stmt_summary as tidb_enable_stmt_summary,@@GLOBAL.tidb_stmt_summary_refresh_interval as tidb_stmt_summary_refresh_interval"
testConfigStmt := "SELECT @@GLOBAL.tidb_enable_stmt_summary AS tidb_enable_stmt_summary, @@GLOBAL.tidb_stmt_summary_refresh_interval AS tidb_stmt_summary_refresh_interval"
c.Assert(buildConfigQuerySQL(&testConfig{}), Equals, testConfigStmt)
}

Expand All @@ -49,17 +49,17 @@ type testConfig2 struct {
}

func (t *testConfigSuite) Test_buildConfigQuerySQL_without_gorm_tag(c *C) {
testConfigStmt := "SELECT @@GLOBAL.tidb_enable_stmt_summary as tidb_enable_stmt_summary"
testConfigStmt := "SELECT @@GLOBAL.tidb_enable_stmt_summary AS tidb_enable_stmt_summary"
c.Assert(buildConfigQuerySQL(&testConfig2{}), Equals, testConfigStmt)
}

func (t *testConfigSuite) Test_buildConfigUpdateSQL_struct_success(c *C) {
testConfigStmt := "SET @@GLOBAL.tidb_enable_stmt_summary = true,@@GLOBAL.tidb_stmt_summary_refresh_interval = 1800"
testConfigStmt := "SET @@GLOBAL.tidb_enable_stmt_summary = true, @@GLOBAL.tidb_stmt_summary_refresh_interval = 1800"
c.Assert(buildConfigUpdateSQL(testConfig{Enable: true, RefreshInterval: 1800}), Equals, testConfigStmt)
}

func (t *testConfigSuite) Test_buildConfigUpdateSQL_ptr_success(c *C) {
testConfigStmt := "SET @@GLOBAL.tidb_enable_stmt_summary = true,@@GLOBAL.tidb_stmt_summary_refresh_interval = 1800"
testConfigStmt := "SET @@GLOBAL.tidb_enable_stmt_summary = true, @@GLOBAL.tidb_stmt_summary_refresh_interval = 1800"
c.Assert(buildConfigUpdateSQL(&testConfig{Enable: true, RefreshInterval: 1800}), Equals, testConfigStmt)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/apiserver/statement/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type EditableConfig struct {
RefreshInterval int `json:"refresh_interval" gorm:"column:tidb_stmt_summary_refresh_interval"`
HistorySize int `json:"history_size" gorm:"column:tidb_stmt_summary_history_size"`
MaxSize int `json:"max_size" gorm:"column:tidb_stmt_summary_max_stmt_count"`
InternalQuery bool `json:"internal_query" gorm:"column:tidb_stmt_summary_internal_query"`
}

// @Summary Get statement configurations
Expand Down
22 changes: 14 additions & 8 deletions ui/lib/apps/DebugAPI/apilist/ApiList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react'
import { Collapse, Space, Input, Empty } from 'antd'
import { Collapse, Space, Input, Empty, Alert } from 'antd'
import { useTranslation } from 'react-i18next'
import { TFunction } from 'i18next'
import { SearchOutlined } from '@ant-design/icons'
Expand Down Expand Up @@ -101,13 +101,19 @@ export default function Page() {
return (
<AnimatedSkeleton showSkeleton={isEndpointLoading || isTopologyLoading}>
<Card>
<Space>
<Input
placeholder={t(`debug_api.keyword_search`)}
prefix={<SearchOutlined />}
onChange={(e) => filterBy(e.target.value)}
/>
</Space>
<Alert
message={t(`debug_api.warning_header.title`)}
description={t(`debug_api.warning_header.body`)}
type="warning"
showIcon
/>
</Card>
<Card>
<Input
placeholder={t(`debug_api.keyword_search`)}
prefix={<SearchOutlined />}
onChange={(e) => filterBy(e.target.value)}
/>
</Card>
<EndpointGroups />
</AnimatedSkeleton>
Expand Down
7 changes: 5 additions & 2 deletions ui/lib/apps/DebugAPI/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
debug_api:
nav_title: Debugging API
keyword_search: Keyword Search
nav_title: Debug Data
keyword_search: Filter by keyword
endpoints_not_found: Endpoints not found
warning_header:
title: Warning
body: These debug endpoints and data are largely internal and intended for use by TiDB developers. Please use this feature under the guidance of TiDB technical support.
form:
download: Download
widgets:
Expand Down
7 changes: 5 additions & 2 deletions ui/lib/apps/DebugAPI/translations/zh.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
debug_api:
nav_title: 信息查询接口
keyword_search: 关键词搜索
nav_title: 内部调试数据
keyword_search: 按关键字过滤接口
endpoints_not_found: 找不到对应接口
warning_header:
title: 警告
body: 本页面提供的调试接口主要面向 TiDB 开发者、提供数据库内部运行数据。请在 TiDB 技术支持的指导下使用本功能。
form:
download: 下载
widgets:
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/apps/KeyViz/components/KeyVizSettingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function KeyVizSettingForm({ onClose, onConfigUpdated }: Props) {
<Form.Item
name="auto_collection_disabled"
label={t('keyviz.settings.switch')}
tooltip={t('keyviz.settings.switch_tooltip')}
extra={t('keyviz.settings.switch_tooltip')}
{...negateSwitchProps}
>
<Switch />
Expand Down
2 changes: 1 addition & 1 deletion ui/lib/apps/KeyViz/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ keyviz:
open_setting: Open Settings
close_keyviz: Disable Key Visualizer Feature
close_keyviz_warning: Are you sure want to disable this feature? Current visual reports will be cleared.
switch: Enable
switch: Enable Feature
switch_tooltip: Whether Key Visualizer feature is enabled. When enabled, there will be small overhead.
policy: Policy
policy_db: TiDB
Expand Down
4 changes: 2 additions & 2 deletions ui/lib/apps/KeyViz/translations/zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ keyviz:
open_setting: 打开设置
close_keyviz: 关闭流量可视化功能
close_keyviz_warning: 确认要关闭该功能吗?关闭后现有历史记录也将被清空!
switch: 总开关
switch_tooltip: 是否开启流量可视化,流量可视化启用时将会增加少量资源开销
switch: 启用功能
switch_tooltip: 是否启用流量可视化功能,关闭后将不能使用流量可视化功能,但能减少一些 PD 的 CPU 资源开销。
policy: 模式
policy_db: TiDB
policy_kv: 原生 KV
Expand Down
Loading

0 comments on commit 6e033ac

Please sign in to comment.