From 4ae5b2e9e9d3a3e99414508fca172cae3820e53b Mon Sep 17 00:00:00 2001 From: baurine <2008.hbl@gmail.com> Date: Tue, 22 Aug 2023 16:56:12 +0800 Subject: [PATCH] feat(conprof): show conprof download link for TiCDC --- pkg/apiserver/conprof/service.go | 1 + .../api/models/conprof-component-num.ts | 6 ++++++ .../tidb-dashboard-client/swagger/spec.json | 3 +++ .../src/utils/distro/strings_res.json | 8 +++++++- .../src/utils/distro/strings_res.json | 2 +- .../apps/ClusterInfo/components/DiskTable.tsx | 6 ++++-- .../apps/ClusterInfo/components/HostTable.tsx | 3 ++- .../apps/ContinuousProfiling/pages/List.tsx | 19 ++++++++++++------- .../tidb-dashboard-lib/src/client/models.ts | 6 ++++++ .../InstanceSelect/ValueDisplay.tsx | 3 ++- .../src/utils/instanceTable.ts | 5 ++--- util/distro/distro.go | 2 ++ 12 files changed, 48 insertions(+), 16 deletions(-) diff --git a/pkg/apiserver/conprof/service.go b/pkg/apiserver/conprof/service.go index 2d878833ce..5c72e37fc3 100644 --- a/pkg/apiserver/conprof/service.go +++ b/pkg/apiserver/conprof/service.go @@ -144,6 +144,7 @@ type ComponentNum struct { PD int `json:"pd"` TiKV int `json:"tikv"` TiFlash int `json:"tiflash"` + TiCDC int `json:"ticdc"` } type GroupProfiles struct { diff --git a/ui/packages/tidb-dashboard-client/src/client/api/models/conprof-component-num.ts b/ui/packages/tidb-dashboard-client/src/client/api/models/conprof-component-num.ts index 7b5dcdbdc1..7976de9de0 100644 --- a/ui/packages/tidb-dashboard-client/src/client/api/models/conprof-component-num.ts +++ b/ui/packages/tidb-dashboard-client/src/client/api/models/conprof-component-num.ts @@ -26,6 +26,12 @@ export interface ConprofComponentNum { * @memberof ConprofComponentNum */ 'pd'?: number; + /** + * + * @type {number} + * @memberof ConprofComponentNum + */ + 'ticdc'?: number; /** * * @type {number} diff --git a/ui/packages/tidb-dashboard-client/swagger/spec.json b/ui/packages/tidb-dashboard-client/swagger/spec.json index b5460c621b..2e988d6a54 100644 --- a/ui/packages/tidb-dashboard-client/swagger/spec.json +++ b/ui/packages/tidb-dashboard-client/swagger/spec.json @@ -3923,6 +3923,9 @@ "pd": { "type": "integer" }, + "ticdc": { + "type": "integer" + }, "tidb": { "type": "integer" }, diff --git a/ui/packages/tidb-dashboard-for-clinic-cloud/src/utils/distro/strings_res.json b/ui/packages/tidb-dashboard-for-clinic-cloud/src/utils/distro/strings_res.json index 722c282408..ab075ffcf6 100644 --- a/ui/packages/tidb-dashboard-for-clinic-cloud/src/utils/distro/strings_res.json +++ b/ui/packages/tidb-dashboard-for-clinic-cloud/src/utils/distro/strings_res.json @@ -1 +1,7 @@ -{ "tidb": "TiDB", "tikv": "TiKV", "pd": "PD", "tiflash": "TiFlash" } +{ + "tidb": "TiDB", + "tikv": "TiKV", + "pd": "PD", + "tiflash": "TiFlash", + "ticdc": "TiCDC" +} diff --git a/ui/packages/tidb-dashboard-for-op/src/utils/distro/strings_res.json b/ui/packages/tidb-dashboard-for-op/src/utils/distro/strings_res.json index 153485ad90..50381b2716 100644 --- a/ui/packages/tidb-dashboard-for-op/src/utils/distro/strings_res.json +++ b/ui/packages/tidb-dashboard-for-op/src/utils/distro/strings_res.json @@ -1 +1 @@ -{"tidb":"TiDB","tikv":"TiKV","pd":"PD","tiflash":"TiFlash"} \ No newline at end of file +{"tidb":"TiDB","tikv":"TiKV","pd":"PD","tiflash":"TiFlash","ticdc":"TiCDC"} \ No newline at end of file diff --git a/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/DiskTable.tsx b/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/DiskTable.tsx index 4956a605c4..0d37ebbeb7 100644 --- a/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/DiskTable.tsx +++ b/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/DiskTable.tsx @@ -41,7 +41,8 @@ function expandDisksItems(rows: HostinfoInfo[]): IExpandedDiskItem[] { pd: 0, tidb: 0, tikv: 0, - tiflash: 0 + tiflash: 0, + ticdc: 0 } } instancesPerPartition[i.partition_path_lower!][i.type!]++ @@ -72,7 +73,8 @@ function expandDisksItems(rows: HostinfoInfo[]): IExpandedDiskItem[] { pd: 0, tidb: 0, tikv: 0, - tiflash: 0 + tiflash: 0, + ticdc: 0 } }) } diff --git a/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/HostTable.tsx b/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/HostTable.tsx index f4d4fc9390..37c77dfd24 100644 --- a/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/HostTable.tsx +++ b/ui/packages/tidb-dashboard-lib/src/apps/ClusterInfo/components/HostTable.tsx @@ -27,7 +27,8 @@ function expandHostItems(rows: HostinfoInfo[]): IExpandedHostItem[] { pd: 0, tidb: 0, tikv: 0, - tiflash: 0 + tiflash: 0, + ticdc: 0 } Object.values(row.instances ?? {}).forEach((i) => { diff --git a/ui/packages/tidb-dashboard-lib/src/apps/ContinuousProfiling/pages/List.tsx b/ui/packages/tidb-dashboard-lib/src/apps/ContinuousProfiling/pages/List.tsx index 0ec496426b..fe089b3f8c 100644 --- a/ui/packages/tidb-dashboard-lib/src/apps/ContinuousProfiling/pages/List.tsx +++ b/ui/packages/tidb-dashboard-lib/src/apps/ContinuousProfiling/pages/List.tsx @@ -104,16 +104,21 @@ export default function Page() { { name: t('conprof.list.table.columns.targets'), key: 'targets', - minWidth: 150, - maxWidth: 250, + minWidth: 250, + maxWidth: 300, onRender: (rec) => { - const { tikv, tidb, pd, tiflash } = rec.component_num - const s = `${tikv} ${instanceKindName( + const { tikv, tidb, pd, tiflash, ticdc } = rec.component_num + let s = `${tikv} ${instanceKindName( 'tikv' )}, ${tidb} ${instanceKindName('tidb')}, ${pd} ${instanceKindName( 'pd' )}, ${tiflash} ${instanceKindName('tiflash')}` - return {s} + // to be compatible with old version + // this field doesn't not exist in the old version + if (ticdc !== undefined) { + s = `${s}, ${ticdc} ${instanceKindName('ticdc')}` + } + return s } }, { @@ -166,8 +171,8 @@ export default function Page() { { name: t('conprof.list.table.columns.start_at'), key: 'ts', - minWidth: 160, - maxWidth: 220, + minWidth: 200, + maxWidth: 250, onRender: (rec) => { return } diff --git a/ui/packages/tidb-dashboard-lib/src/client/models.ts b/ui/packages/tidb-dashboard-lib/src/client/models.ts index d6e2ea9994..20f9f39ee1 100644 --- a/ui/packages/tidb-dashboard-lib/src/client/models.ts +++ b/ui/packages/tidb-dashboard-lib/src/client/models.ts @@ -375,6 +375,12 @@ export interface ConprofComponentNum { * @memberof ConprofComponentNum */ 'pd'?: number; + /** + * + * @type {number} + * @memberof ConprofComponentNum + */ + 'ticdc'?: number; /** * * @type {number} diff --git a/ui/packages/tidb-dashboard-lib/src/components/InstanceSelect/ValueDisplay.tsx b/ui/packages/tidb-dashboard-lib/src/components/InstanceSelect/ValueDisplay.tsx index 74134d1d14..a7237c7b13 100644 --- a/ui/packages/tidb-dashboard-lib/src/components/InstanceSelect/ValueDisplay.tsx +++ b/ui/packages/tidb-dashboard-lib/src/components/InstanceSelect/ValueDisplay.tsx @@ -36,7 +36,8 @@ export default function ValueDisplay({ pd: newInstanceStat(), tidb: newInstanceStat(), tikv: newInstanceStat(), - tiflash: newInstanceStat() + tiflash: newInstanceStat(), + ticdc: newInstanceStat() } items.forEach((item) => { instanceStats[item.instanceKind].all++ diff --git a/ui/packages/tidb-dashboard-lib/src/utils/instanceTable.ts b/ui/packages/tidb-dashboard-lib/src/utils/instanceTable.ts index 047f4ab2e7..bf45d1a21d 100644 --- a/ui/packages/tidb-dashboard-lib/src/utils/instanceTable.ts +++ b/ui/packages/tidb-dashboard-lib/src/utils/instanceTable.ts @@ -8,9 +8,8 @@ import { TopologyStoreInfo } from '@lib/client' -export type InstanceKind = 'pd' | 'tidb' | 'tikv' | 'tiflash' - -export const InstanceKinds: InstanceKind[] = ['pd', 'tidb', 'tikv', 'tiflash'] +export const InstanceKinds = ['pd', 'tidb', 'tikv', 'tiflash', 'ticdc'] as const +export type InstanceKind = typeof InstanceKinds[number] export const InstanceStatus = { Unreachable: 0, diff --git a/util/distro/distro.go b/util/distro/distro.go index 638fa592cc..b427ac3b53 100644 --- a/util/distro/distro.go +++ b/util/distro/distro.go @@ -22,6 +22,7 @@ type DistributionResource struct { TiKV string `json:"tikv,omitempty"` PD string `json:"pd,omitempty"` TiFlash string `json:"tiflash,omitempty"` + TiCDC string `json:"ticdc,omitempty"` } var defaultDistroRes = DistributionResource{ @@ -30,6 +31,7 @@ var defaultDistroRes = DistributionResource{ TiKV: "TiKV", PD: "PD", TiFlash: "TiFlash", + TiCDC: "TiCDC", } var (