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

old-commit-hash: 75c434bde7
taco
Dean Lee 3 years ago committed by GitHub
parent c43ce9a606
commit ec96bc52d6
  1. 11
      tools/replay/consoleui.cc
  2. 7
      tools/replay/replay.cc
  3. 3
      tools/replay/replay.h

@ -18,7 +18,10 @@ const std::initializer_list<std::pair<std::string, std::string>> keyboard_shortc
{"space", "Pause/Resume"}, {"space", "Pause/Resume"},
{"e", "Next Engagement"}, {"e", "Next Engagement"},
{"d", "Next Disengagement"}, {"d", "Next Disengagement"},
{"t", "Next User Tag"} {"t", "Next User Tag"},
{"i", "Next Info"},
{"w", "Next Warning"},
{"c", "Next Critical"},
}, },
{ {
{"enter", "Enter seek request"}, {"enter", "Enter seek request"},
@ -344,6 +347,12 @@ void ConsoleUI::handleKey(char c) {
replay->seekToFlag(FindFlag::nextDisEngagement); replay->seekToFlag(FindFlag::nextDisEngagement);
} else if (c == 't') { } else if (c == 't') {
replay->seekToFlag(FindFlag::nextUserFlag); 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') { } else if (c == 'm') {
replay->seekTo(+60, true); replay->seekTo(+60, true);
} else if (c == 'M') { } else if (c == 'M') {

@ -166,8 +166,11 @@ std::optional<uint64_t> Replay::find(FindFlag flag) {
} else if (flag == FindFlag::nextDisEngagement && end_ts > cur_ts) { } else if (flag == FindFlag::nextDisEngagement && end_ts > cur_ts) {
return end_ts; return end_ts;
} }
} else if (type == TimelineType::UserFlag) { } else if (start_ts > cur_ts) {
if (flag == FindFlag::nextUserFlag && 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; return start_ts;
} }
} }

@ -26,6 +26,9 @@ enum class FindFlag {
nextEngagement, nextEngagement,
nextDisEngagement, nextDisEngagement,
nextUserFlag, nextUserFlag,
nextInfo,
nextWarning,
nextCritical
}; };
enum class TimelineType { None, Engaged, AlertInfo, AlertWarning, AlertCritical, UserFlag }; enum class TimelineType { None, Engaged, AlertInfo, AlertWarning, AlertCritical, UserFlag };

Loading…
Cancel
Save