Skip to content

Commit

Permalink
feat(slow-query): show org and cluster info in clinic (#1621)
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine authored Dec 5, 2023
1 parent b14203d commit 706489f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
17 changes: 15 additions & 2 deletions ui/packages/tidb-dashboard-for-clinic-cloud/public/ngm.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,27 @@
slowQuery: {
enableExport: false,
showDBFilter: false,
listApiReturnDetail: false // so we can use the result returned by list api in the detail page, avoid reqeust detail api
listApiReturnDetail: false, // so we can use the result returned by list api in the detail page, avoid request detail api

orgName,
clusterName,
timeRangeSelector: {
recentSeconds: [
5 * 60,
15 * 60,
30 * 60,
60 * 60,
2 * 60 * 60,
3 * 60 * 60
],
customAbsoluteRangePicker: true
}
},
topSQL: {
checkNgm: false,
showSetting: false,
orgName,
clusterName,
userName,

timeRangeSelector: {
recentSeconds: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export interface ISlowQueryConfig extends IContextConfig {
recentSeconds: number[]
customAbsoluteRangePicker: boolean
}

// for clinic
orgName?: string
clusterName?: string
}

export interface ISlowQueryContext {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, useState } from 'react'
import React, { useContext, useState, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import {
Select,
Expand Down Expand Up @@ -182,9 +182,27 @@ function List() {
}
})

// only for clinic
const clusterInfo = useMemo(() => {
const infos: string[] = []
if (ctx?.cfg.orgName) {
infos.push(`Org: ${ctx?.cfg.orgName}`)
}
if (ctx?.cfg.clusterName) {
infos.push(`Cluster: ${ctx?.cfg.clusterName}`)
}
return infos.join(' | ')
}, [ctx?.cfg.orgName, ctx?.cfg.clusterName])

return (
<div className={styles.list_container}>
<Card noMarginBottom>
{clusterInfo && (
<div style={{ marginBottom: 8, textAlign: 'right' }}>
{clusterInfo}
</div>
)}

<Toolbar className={styles.list_toolbar} data-e2e="slow_query_toolbar">
<Space>
{ctx?.cfg.timeRangeSelector !== undefined ? (
Expand Down

0 comments on commit 706489f

Please sign in to comment.