mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-16 14:01:38 +00:00
feat: don't save log in memory; log level dropdown can only be interacted with when service is not running
This commit is contained in:
parent
ff3e408cf4
commit
afaed79a2f
2 changed files with 18 additions and 9 deletions
|
@ -191,6 +191,9 @@ impl App {
|
||||||
true,
|
true,
|
||||||
Some(self.get_selected_profile()),
|
Some(self.get_selected_profile()),
|
||||||
));
|
));
|
||||||
|
self.debug_view
|
||||||
|
.sender()
|
||||||
|
.emit(DebugViewMsg::XRServiceActiveChanged(true));
|
||||||
self.set_inhibit_session(true);
|
self.set_inhibit_session(true);
|
||||||
} else {
|
} else {
|
||||||
alert(
|
alert(
|
||||||
|
@ -231,6 +234,9 @@ impl App {
|
||||||
self.main_view
|
self.main_view
|
||||||
.sender()
|
.sender()
|
||||||
.emit(MainViewMsg::XRServiceActiveChanged(false, None));
|
.emit(MainViewMsg::XRServiceActiveChanged(false, None));
|
||||||
|
self.debug_view
|
||||||
|
.sender()
|
||||||
|
.emit(DebugViewMsg::XRServiceActiveChanged(false));
|
||||||
self.xr_devices = vec![];
|
self.xr_devices = vec![];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,6 +318,9 @@ impl SimpleComponent for App {
|
||||||
self.main_view
|
self.main_view
|
||||||
.sender()
|
.sender()
|
||||||
.emit(MainViewMsg::XRServiceActiveChanged(false, None));
|
.emit(MainViewMsg::XRServiceActiveChanged(false, None));
|
||||||
|
self.debug_view
|
||||||
|
.sender()
|
||||||
|
.emit(DebugViewMsg::XRServiceActiveChanged(false));
|
||||||
if let Some(worker) = self.xrservice_worker.as_ref() {
|
if let Some(worker) = self.xrservice_worker.as_ref() {
|
||||||
if let Some(code) = worker.exit_code() {
|
if let Some(code) = worker.exit_code() {
|
||||||
if code != 0 && code != 15 {
|
if code != 0 && code != 15 {
|
||||||
|
|
|
@ -18,12 +18,12 @@ pub enum DebugViewMsg {
|
||||||
ClearLog,
|
ClearLog,
|
||||||
FilterLog(SearchDirection),
|
FilterLog(SearchDirection),
|
||||||
LogLevelChanged(LogLevel),
|
LogLevelChanged(LogLevel),
|
||||||
|
XRServiceActiveChanged(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracker::track]
|
#[tracker::track]
|
||||||
pub struct DebugView {
|
pub struct DebugView {
|
||||||
#[tracker::do_not_track]
|
xrservice_active: bool,
|
||||||
log: Vec<String>,
|
|
||||||
#[tracker::do_not_track]
|
#[tracker::do_not_track]
|
||||||
textbuf: sourceview5::Buffer,
|
textbuf: sourceview5::Buffer,
|
||||||
#[tracker::do_not_track]
|
#[tracker::do_not_track]
|
||||||
|
@ -133,12 +133,14 @@ impl SimpleComponent for DebugView {
|
||||||
self.reset();
|
self.reset();
|
||||||
|
|
||||||
match message {
|
match message {
|
||||||
|
Self::Input::XRServiceActiveChanged(active) => {
|
||||||
|
self.set_xrservice_active(active);
|
||||||
|
if let Some(dropdown) = self.dropdown.as_ref() {
|
||||||
|
dropdown.set_sensitive(!active);
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::Input::LogLevelChanged(lvl) => {
|
Self::Input::LogLevelChanged(lvl) => {
|
||||||
self.log_level = lvl;
|
self.log_level = lvl;
|
||||||
let log = self.log.clone();
|
|
||||||
self.log = vec![];
|
|
||||||
self.textbuf.set_text("");
|
|
||||||
sender.input(Self::Input::LogUpdated(log));
|
|
||||||
}
|
}
|
||||||
Self::Input::FilterLog(direction) => {
|
Self::Input::FilterLog(direction) => {
|
||||||
let searchbar = self.searchbar.as_ref().unwrap().clone();
|
let searchbar = self.searchbar.as_ref().unwrap().clone();
|
||||||
|
@ -180,7 +182,6 @@ impl SimpleComponent for DebugView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::Input::LogUpdated(n_log) => {
|
Self::Input::LogUpdated(n_log) => {
|
||||||
self.log.extend(n_log.clone());
|
|
||||||
for row in n_log {
|
for row in n_log {
|
||||||
let txt = match MonadoLog::new_from_str(row.as_str()) {
|
let txt = match MonadoLog::new_from_str(row.as_str()) {
|
||||||
Some(o) => match o.level >= self.log_level {
|
Some(o) => match o.level >= self.log_level {
|
||||||
|
@ -210,7 +211,6 @@ impl SimpleComponent for DebugView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::Input::ClearLog => {
|
Self::Input::ClearLog => {
|
||||||
self.log = vec![];
|
|
||||||
self.textbuf.set_text("");
|
self.textbuf.set_text("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,8 +264,8 @@ impl SimpleComponent for DebugView {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut model = Self {
|
let mut model = Self {
|
||||||
|
xrservice_active: false,
|
||||||
tracker: 0,
|
tracker: 0,
|
||||||
log: vec![],
|
|
||||||
textbuf,
|
textbuf,
|
||||||
textview: None,
|
textview: None,
|
||||||
searchbar: None,
|
searchbar: None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue