mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 17:41:56 +08:00
feat: add support for ForcePeakCutEnabled configuration in NetworkChart
This commit is contained in:
parent
579b4f8ef4
commit
674d348ed7
@ -94,8 +94,10 @@ export const NetworkChartClient = React.memo(function NetworkChart({
|
|||||||
|
|
||||||
const customBackgroundImage = (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
|
const customBackgroundImage = (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
|
||||||
|
|
||||||
|
const forcePeakCutEnabled = (window.ForcePeakCutEnabled as boolean) ?? false
|
||||||
|
|
||||||
const [activeChart, setActiveChart] = React.useState(defaultChart)
|
const [activeChart, setActiveChart] = React.useState(defaultChart)
|
||||||
const [isPeakEnabled, setIsPeakEnabled] = React.useState(false)
|
const [isPeakEnabled, setIsPeakEnabled] = React.useState(forcePeakCutEnabled)
|
||||||
|
|
||||||
const handleButtonClick = useCallback(
|
const handleButtonClick = useCallback(
|
||||||
(chart: string) => {
|
(chart: string) => {
|
||||||
@ -281,11 +283,7 @@ export const NetworkChartClient = React.memo(function NetworkChart({
|
|||||||
// 根据时间跨度调整显示间隔
|
// 根据时间跨度调整显示间隔
|
||||||
if (hours <= 12) {
|
if (hours <= 12) {
|
||||||
// 12小时内,每60分钟显示一个刻度
|
// 12小时内,每60分钟显示一个刻度
|
||||||
return (
|
return index === 0 || index === array.length - 1 || new Date(item.created_at).getMinutes() % 60 === 0
|
||||||
index === 0 ||
|
|
||||||
index === array.length - 1 ||
|
|
||||||
new Date(item.created_at).getMinutes() % 60 === 0
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
// 超过12小时,每2小时显示一个刻度
|
// 超过12小时,每2小时显示一个刻度
|
||||||
const date = new Date(item.created_at)
|
const date = new Date(item.created_at)
|
||||||
|
@ -7,6 +7,7 @@ declare global {
|
|||||||
ForceShowServices: boolean
|
ForceShowServices: boolean
|
||||||
ForceCardInline: boolean
|
ForceCardInline: boolean
|
||||||
ForceShowMap: boolean
|
ForceShowMap: boolean
|
||||||
|
ForcePeakCutEnabled: boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user