Skip to content

feat: 资源图的时间范围按 hub 的保留天数生成 - #18

Merged
stqfdyr merged 4 commits into
mainfrom
feat/history-windows
Oct 2, 2026
Merged

stqfdyr merged 4 commits into
mainfrom
feat/history-windows

Conversation

@stqfdyr

@stqfdyr stqfdyr commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

资源图的时间范围原来固定为 1 小时到 7 天,hub 保留 30 天、90 天时更早的历史看不到。

  • 档位取保留期以内的 1、6 小时和 1、7、30、90 天,再加上保留期本身;保留期比某个整档位多不到四分之一时不单列那一档(保留 92 天时没有 90 天);保留期来自 /api/me 的 history_days,hub 没有这个字段时按 7 天
  • 刻度间距增加两周一档,更宽的窗口落在每月 1 日;按天以上的刻度取本地零点,跨夏令时也不偏;刻度全在零点时只写日期
  • 「24 小时」改称「1 天」;手机上档位按钮收窄,保留一年的 7 个档位在 360 宽的屏幕上排成一行
  • 展开行的延迟图仍固定 24 小时

npm test(新增档位、按月刻度、日期标签、纽约时区跨夏令时的用例,UTC、上海、纽约、伦敦、豪勋爵岛时区下均通过)、lint、build 通过;预览环境写入 90 天历史,1280、390、375、360、320 宽与深浅色下实测 7 天、30 天、90 天、1 年窗口;圣地亚哥时区下 30 天窗跨 9 月 6 日夏令时,刻度仍是整日日期。

需要 hub monitor-probe/monitor#81 提供 history_days;文档 monitor-probe/monitor-document#33。

- 档位取保留期以内的 1、6 小时和 1、7、30、90 天,再加上保留期本身;hub 没有 history_days 时按 7 天
- 刻度间距增加 14 天一档,更宽的窗口落在每月 1 日;刻度全在零点时只写日期
- 手机上档位按钮收窄,保留一年的 7 个档位在 360 宽的屏幕上排成一行
保留 92 天时不再同时出现 90 天和 92 天两个几乎一样的档位;用例补上默认 30 天
- 窗口跨过夏令时切换时,之后的刻度不再偏到 23:00 或 01:00,整根轴仍只写日期
- 纽约时区的 30、90 天窗用例覆盖春秋两次切换
@stqfdyr
stqfdyr merged commit eec5ac1 into main Oct 2, 2026
1 check passed
@stqfdyr
stqfdyr deleted the feat/history-windows branch October 2, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant