From 721973fd525217a2a6d1e658958a3b7bad7c776f Mon Sep 17 00:00:00 2001 From: YiniXu9506 Date: Fri, 30 Dec 2022 14:40:55 +0800 Subject: [PATCH 1/4] chore: update time limit level --- ui/packages/tidb-dashboard-for-dbaas/package.json | 2 +- .../src/components/TimeRangeSelector/index.tsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/packages/tidb-dashboard-for-dbaas/package.json b/ui/packages/tidb-dashboard-for-dbaas/package.json index 37a6b93577..dce50af1eb 100644 --- a/ui/packages/tidb-dashboard-for-dbaas/package.json +++ b/ui/packages/tidb-dashboard-for-dbaas/package.json @@ -1,6 +1,6 @@ { "name": "@pingcap/tidb-dashboard-for-dbaas", - "version": "0.0.51", + "version": "0.0.53", "main": "dist/main.js", "module": "dist/main.js", "files": [ diff --git a/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx b/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx index 33031ffd20..b4bb77c512 100644 --- a/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx +++ b/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx @@ -170,7 +170,8 @@ const customValueFormat = ( } // array of 24 numbers, start from 0 -const hours = [...Array(24).keys()] +const hoursRange = [...Array(24).keys()] +const minutesRange = [...Array(60).keys()] function TimeRangeSelector({ value, @@ -230,13 +231,16 @@ function TimeRangeSelector({ return current && (tooEarly || tooLate) } + // control avaliable time on Minute level const disabledTime = (current) => { // current hour const hour = dayjs().hour() + const minute = dayjs().minute() // is current day if (current && current.isSame(dayjs(), 'day')) { return { - disabledHours: () => hours.slice(hour) + disabledHours: () => hoursRange.slice(hour + 1), + disabledMinutes: () => minutesRange.slice(minute) } } @@ -246,7 +250,8 @@ function TimeRangeSelector({ current.isSame(dayjs().subtract(selectableHours / 24, 'day'), 'day') ) { return { - disabledHours: () => hours.slice(0, hour) + disabledHours: () => hoursRange.slice(0, hour), + disabledMinutes: () => minutesRange.slice(0, minute) } } From 90e1dc296844e4709d5aabf0e11d7104a055f7fb Mon Sep 17 00:00:00 2001 From: YiniXu9506 Date: Fri, 30 Dec 2022 14:52:23 +0800 Subject: [PATCH 2/4] chore: update time limit level --- ui/packages/tidb-dashboard-for-dbaas/package.json | 2 +- .../src/components/TimeRangeSelector/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/packages/tidb-dashboard-for-dbaas/package.json b/ui/packages/tidb-dashboard-for-dbaas/package.json index dce50af1eb..a3bd8e4e51 100644 --- a/ui/packages/tidb-dashboard-for-dbaas/package.json +++ b/ui/packages/tidb-dashboard-for-dbaas/package.json @@ -1,6 +1,6 @@ { "name": "@pingcap/tidb-dashboard-for-dbaas", - "version": "0.0.53", + "version": "0.0.54", "main": "dist/main.js", "module": "dist/main.js", "files": [ diff --git a/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx b/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx index b4bb77c512..a61be78de0 100644 --- a/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx +++ b/ui/packages/tidb-dashboard-lib/src/components/TimeRangeSelector/index.tsx @@ -240,7 +240,7 @@ function TimeRangeSelector({ if (current && current.isSame(dayjs(), 'day')) { return { disabledHours: () => hoursRange.slice(hour + 1), - disabledMinutes: () => minutesRange.slice(minute) + disabledMinutes: () => minutesRange.slice(minute + 1) } } From ef1ec7363638e93949ecd013ac2331dff8f4f80b Mon Sep 17 00:00:00 2001 From: YiniXu9506 Date: Fri, 30 Dec 2022 14:52:23 +0800 Subject: [PATCH 3/4] chore: update time range selector no overview page --- .../package.json | 2 +- .../src/apps/Overview/components/Metrics.tsx | 38 ++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ui/packages/tidb-dashboard-for-clinic-cloud/package.json b/ui/packages/tidb-dashboard-for-clinic-cloud/package.json index 8a0c51f447..caa2514019 100644 --- a/ui/packages/tidb-dashboard-for-clinic-cloud/package.json +++ b/ui/packages/tidb-dashboard-for-clinic-cloud/package.json @@ -1,6 +1,6 @@ { "name": "@pingcap/tidb-dashboard-for-clinic-cloud", - "version": "0.0.40", + "version": "0.0.44", "main": "dist/dashboardApp.js", "module": "dist/dashboardApp.js", "files": [ diff --git a/ui/packages/tidb-dashboard-lib/src/apps/Overview/components/Metrics.tsx b/ui/packages/tidb-dashboard-lib/src/apps/Overview/components/Metrics.tsx index d1ae848057..44c79a872c 100644 --- a/ui/packages/tidb-dashboard-lib/src/apps/Overview/components/Metrics.tsx +++ b/ui/packages/tidb-dashboard-lib/src/apps/Overview/components/Metrics.tsx @@ -69,20 +69,30 @@ export default function Metrics() { - { - setTimeRange(v) - telemetry.selectTimeRange(v) - }} - recent_seconds={ctx?.cfg.timeRangeSelector?.recent_seconds} - customAbsoluteRangePicker={ - ctx?.cfg.timeRangeSelector?.customAbsoluteRangePicker - } - onZoomOutClick={(start, end) => - telemetry.clickZoomOut([start, end]) - } - /> + {ctx?.cfg.timeRangeSelector?.customAbsoluteRangePicker ? ( + { + setTimeRange(v) + telemetry.selectTimeRange(v) + }} + recent_seconds={ctx?.cfg.timeRangeSelector?.recent_seconds} + customAbsoluteRangePicker={true} + /> + ) : ( + { + setTimeRange(v) + telemetry.selectTimeRange(v) + }} + recent_seconds={ctx?.cfg.timeRangeSelector?.recent_seconds} + customAbsoluteRangePicker={false} + onZoomOutClick={(start, end) => + telemetry.clickZoomOut([start, end]) + } + /> + )} Date: Wed, 4 Jan 2023 17:03:31 +0800 Subject: [PATCH 4/4] chore: update tidb dashboard for clinic cloud version --- ui/packages/tidb-dashboard-for-clinic-cloud/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/tidb-dashboard-for-clinic-cloud/package.json b/ui/packages/tidb-dashboard-for-clinic-cloud/package.json index caa2514019..138ed96641 100644 --- a/ui/packages/tidb-dashboard-for-clinic-cloud/package.json +++ b/ui/packages/tidb-dashboard-for-clinic-cloud/package.json @@ -1,6 +1,6 @@ { "name": "@pingcap/tidb-dashboard-for-clinic-cloud", - "version": "0.0.44", + "version": "0.0.45", "main": "dist/dashboardApp.js", "module": "dist/dashboardApp.js", "files": [