mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-13 08:22:18 +08:00
Guard dashboard profile switches and tighten chart axis padding
This commit is contained in:
@@ -134,6 +134,8 @@ let dashboardGridContentResizeFrame: number | null = null
|
||||
let dashboardGridResizeRefreshFrame: number | null = null
|
||||
let dashboardRevealFrame: number | null = null
|
||||
let isDashboardRevealPending = false
|
||||
// 标记最近一次响应式档位切换,避免快速缩放时较早的异步配置覆盖最新档位。
|
||||
let dashboardLayoutProfileSwitchId = 0
|
||||
|
||||
// 是否正在手动缩放组件,避免自动测高抢回用户拖动中的高度。
|
||||
const isDashboardGridResizing = ref(false)
|
||||
@@ -1337,13 +1339,15 @@ watch(
|
||||
const nextProfile = resolveDashboardLayoutProfile()
|
||||
if (nextProfile === dashboardLayoutProfile.value) return
|
||||
|
||||
if (dashboardGrid.value && !isSyncingDashboardGrid.value && !isDashboardGridLayoutResetPending.value) {
|
||||
persistDashboardGridLayout(false)
|
||||
}
|
||||
|
||||
// GridStack 可能已先完成列数压缩;档位切换只读取目标配置,不能保存当前自动重排结果。
|
||||
const profileSwitchId = ++dashboardLayoutProfileSwitchId
|
||||
dashboardLayoutProfile.value = nextProfile
|
||||
const profileConfig = await loadDashboardProfileConfig(nextProfile)
|
||||
if (profileSwitchId !== dashboardLayoutProfileSwitchId || dashboardLayoutProfile.value !== nextProfile) return
|
||||
|
||||
const legacyEnable = profileConfig?.enabled === undefined ? await loadLegacyDashboardEnableConfig() : undefined
|
||||
if (profileSwitchId !== dashboardLayoutProfileSwitchId || dashboardLayoutProfile.value !== nextProfile) return
|
||||
|
||||
dashboardGridLayout.value = profileConfig?.items ?? {}
|
||||
enableConfig.value = mergeDashboardEnableConfig(profileConfig?.enabled ?? legacyEnable)
|
||||
if (profileConfig?.enabled === undefined && legacyEnable !== undefined) {
|
||||
|
||||
@@ -94,7 +94,7 @@ const chartOptions = controlledComputed(
|
||||
},
|
||||
padding: {
|
||||
top: -10,
|
||||
left: 8,
|
||||
left: 0,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
},
|
||||
@@ -136,7 +136,6 @@ const chartOptions = controlledComputed(
|
||||
yaxis: {
|
||||
labels: {
|
||||
show: true,
|
||||
minWidth: 32,
|
||||
formatter: (value: number) => `${Math.round(value)}%`,
|
||||
style: {
|
||||
colors: axisLabelColor,
|
||||
|
||||
@@ -101,7 +101,7 @@ const chartOptions = controlledComputed(
|
||||
},
|
||||
padding: {
|
||||
top: -10,
|
||||
left: 8,
|
||||
left: 0,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
},
|
||||
@@ -143,7 +143,6 @@ const chartOptions = controlledComputed(
|
||||
yaxis: {
|
||||
labels: {
|
||||
show: true,
|
||||
minWidth: 40,
|
||||
formatter: (value: number) => formatDashboardFileSize(value, 0, totalMemory.value || value),
|
||||
style: {
|
||||
colors: axisLabelColor,
|
||||
|
||||
@@ -97,7 +97,7 @@ const chartOptions = controlledComputed(
|
||||
},
|
||||
padding: {
|
||||
top: -10,
|
||||
left: 8,
|
||||
left: 0,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
},
|
||||
@@ -145,7 +145,6 @@ const chartOptions = controlledComputed(
|
||||
yaxis: {
|
||||
labels: {
|
||||
show: true,
|
||||
minWidth: 52,
|
||||
formatter: (value: number) =>
|
||||
`${formatDashboardFileSize(value, value >= 1024 ** 2 ? 1 : 0, networkChartMax.value)}/s`,
|
||||
style: {
|
||||
|
||||
Reference in New Issue
Block a user