feat(engine): add show logs entry in context menu

This commit is contained in:
Federico Terzi 2021-11-16 22:27:14 +01:00
parent e2b6dcba38
commit 8909ccdb4d

View File

@ -32,6 +32,7 @@ const CONTEXT_ITEM_DISABLE: u32 = 3;
const CONTEXT_ITEM_SECURE_INPUT_EXPLAIN: u32 = 4;
const CONTEXT_ITEM_SECURE_INPUT_TRIGGER_WORKAROUND: u32 = 5;
const CONTEXT_ITEM_OPEN_SEARCH: u32 = 6;
const CONTEXT_ITEM_SHOW_LOGS: u32 = 7;
pub struct ContextMenuMiddleware {
is_enabled: RefCell<bool>,
@ -82,6 +83,10 @@ impl Middleware for ContextMenuMiddleware {
id: CONTEXT_ITEM_RELOAD,
label: "Reload config".to_string(),
}),
MenuItem::Simple(SimpleMenuItem {
id: CONTEXT_ITEM_SHOW_LOGS,
label: "Show logs".to_string(),
}),
MenuItem::Separator,
MenuItem::Simple(SimpleMenuItem {
id: CONTEXT_ITEM_EXIT,
@ -155,6 +160,10 @@ impl Middleware for ContextMenuMiddleware {
dispatch(Event::caused_by(event.source_id, EventType::ShowSearchBar));
Event::caused_by(event.source_id, EventType::NOOP)
}
CONTEXT_ITEM_SHOW_LOGS => {
dispatch(Event::caused_by(event.source_id, EventType::ShowLogs));
Event::caused_by(event.source_id, EventType::NOOP)
}
_ => {
// TODO: handle dynamic items
todo!()