replay: add shortcuts for seeking to the next info, warning, and critical alerts (#25576)

This commit is contained in:
Dean Lee
2022-09-06 05:11:32 +08:00
committed by GitHub
parent a3bc906b11
commit 75c434bde7
3 changed files with 18 additions and 3 deletions
+10 -1
View File
@@ -18,7 +18,10 @@ const std::initializer_list<std::pair<std::string, std::string>> keyboard_shortc
{"space", "Pause/Resume"},
{"e", "Next Engagement"},
{"d", "Next Disengagement"},
{"t", "Next User Tag"}
{"t", "Next User Tag"},
{"i", "Next Info"},
{"w", "Next Warning"},
{"c", "Next Critical"},
},
{
{"enter", "Enter seek request"},
@@ -344,6 +347,12 @@ void ConsoleUI::handleKey(char c) {
replay->seekToFlag(FindFlag::nextDisEngagement);
} else if (c == 't') {
replay->seekToFlag(FindFlag::nextUserFlag);
} else if (c == 'i') {
replay->seekToFlag(FindFlag::nextInfo);
} else if (c == 'w') {
replay->seekToFlag(FindFlag::nextWarning);
} else if (c == 'c') {
replay->seekToFlag(FindFlag::nextCritical);
} else if (c == 'm') {
replay->seekTo(+60, true);
} else if (c == 'M') {
+5 -2
View File
@@ -166,8 +166,11 @@ std::optional<uint64_t> Replay::find(FindFlag flag) {
} else if (flag == FindFlag::nextDisEngagement && end_ts > cur_ts) {
return end_ts;
}
} else if (type == TimelineType::UserFlag) {
if (flag == FindFlag::nextUserFlag && start_ts > cur_ts) {
} else if (start_ts > cur_ts) {
if ((flag == FindFlag::nextUserFlag && type == TimelineType::UserFlag) ||
(flag == FindFlag::nextInfo && type == TimelineType::AlertInfo) ||
(flag == FindFlag::nextWarning && type == TimelineType::AlertWarning) ||
(flag == FindFlag::nextCritical && type == TimelineType::AlertCritical)) {
return start_ts;
}
}
+3
View File
@@ -26,6 +26,9 @@ enum class FindFlag {
nextEngagement,
nextDisEngagement,
nextUserFlag,
nextInfo,
nextWarning,
nextCritical
};
enum class TimelineType { None, Engaged, AlertInfo, AlertWarning, AlertCritical, UserFlag };