Skip to content

Commit

Permalink
chore(topsql): show cluster name and disable auto-refresh for clinic (#…
Browse files Browse the repository at this point in the history
baurine authored Oct 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent c6ca8cf commit 58f855e
Showing 3 changed files with 26 additions and 5 deletions.
9 changes: 7 additions & 2 deletions ui/packages/tidb-dashboard-for-clinic-cloud/public/ngm.html
Original file line number Diff line number Diff line change
@@ -121,11 +121,14 @@
const provider = searchParams.get('provider') || ''
const region = searchParams.get('region') || ''
const orgId = searchParams.get('orgId') || ''
const orgName = searchParams.get('orgName') || ''
const projectId = searchParams.get('projectId') || ''
const clusterId = searchParams.get('clusterId') || ''
const deployType = searchParams.get('deployType') || ''

const orgName = searchParams.get('orgName') || ''
const clusterName = searchParams.get('clusterName') || ''
const userName = searchParams.get('userName') || ''

if (
apiToken === '' ||
provider === '' ||
@@ -170,6 +173,7 @@
checkNgm: false,
showSetting: false,
orgName,
clusterName,
userName,

timeRangeSelector: {
@@ -183,7 +187,8 @@
24 * 60 * 60
],
customAbsoluteRangePicker: true
}
},
autoRefresh: false
}
}
})
Original file line number Diff line number Diff line change
@@ -44,9 +44,11 @@ export interface ITopSQLConfig {
recentSeconds: number[]
customAbsoluteRangePicker: boolean
}
autoRefresh?: boolean

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

20 changes: 17 additions & 3 deletions ui/packages/tidb-dashboard-lib/src/apps/TopSQL/pages/List/List.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@ import React, {
useContext,
useEffect,
useRef,
useState
useState,
useMemo
} from 'react'
import { Space, Button, Spin, Alert, Tooltip, Drawer, Result } from 'antd'
import {
@@ -126,6 +127,18 @@ export function TopSQLList() {

const chartRef = useRef<any>(null)

// 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.container} ref={containerRef}>
@@ -156,9 +169,9 @@ export function TopSQLList() {
)}

<Card noMarginBottom>
{ctx?.cfg.orgName && (
{clusterInfo && (
<div style={{ marginBottom: 8, textAlign: 'right' }}>
Org: {ctx?.cfg.orgName}
{clusterInfo}
</div>
)}

@@ -194,6 +207,7 @@ export function TopSQLList() {
disabled={isLoading}
/>
<AutoRefreshButton
defaultValue={ctx?.cfg.autoRefresh === false ? 0 : undefined}
disabled={isLoading}
onRefresh={async () => {
await fetchInstancesAndSelectInstance()

0 comments on commit 58f855e

Please sign in to comment.