From 2a407bf3550eaee2f7445fae601654bcf4ed6774 Mon Sep 17 00:00:00 2001 From: Mikhail Malyshev Date: Wed, 6 Nov 2024 17:17:19 +0100 Subject: [PATCH] Keep Home tab in debug build only - this tab is useful for debugging only - cleanup some warnings Signed-off-by: Mikhail Malyshev --- src/application.rs | 2 -- src/model/device/network.rs | 1 - src/ui/mod.rs | 1 + src/ui/ui.rs | 13 ++++++++----- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/application.rs b/src/application.rs index db3582b..5d28fd8 100644 --- a/src/application.rs +++ b/src/application.rs @@ -3,9 +3,7 @@ use crate::events::Event; use crate::model::model::Model; use crate::model::model::MonitorModel; use crate::ui::ipdialog::InterfaceState; -use crate::ui::message_box::create_message_box; use crate::ui::ui::Ui; -use core::fmt::Debug; use std::cell::RefCell; use std::collections::HashMap; diff --git a/src/model/device/network.rs b/src/model/device/network.rs index 98ffc0d..6ca48ff 100644 --- a/src/model/device/network.rs +++ b/src/model/device/network.rs @@ -284,7 +284,6 @@ impl From<&NetworkPortStatus> for NetworkInterfaceStatus { }) .unwrap(), }), - _ => NetworkType::Ethernet, }; let is_dhcp = port.dhcp == DhcpType::Client; diff --git a/src/ui/mod.rs b/src/ui/mod.rs index cb2d5e5..8902ebe 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -3,6 +3,7 @@ pub mod activity; pub mod app_page; pub mod dialog; pub mod focus_tracker; +#[cfg(debug_assertions)] pub mod homepage; pub mod input_dialog; pub mod ipdialog; diff --git a/src/ui/ui.rs b/src/ui/ui.rs index 8f2a37c..ada19c7 100644 --- a/src/ui/ui.rs +++ b/src/ui/ui.rs @@ -30,7 +30,6 @@ use crate::{ use super::{ action::Action, app_page::ApplicationsPage, - homepage::HomePage, layer_stack::LayerStack, networkpage::create_network_page, statusbar::{create_status_bar, StatusBarState}, @@ -38,6 +37,9 @@ use super::{ window::Window, }; +#[cfg(debug_assertions)] +use super::homepage::HomePage; + use std::result::Result::Ok; use anyhow::Result; @@ -54,8 +56,8 @@ pub struct Ui { #[derive(Default, Copy, Clone, Display, EnumIter, Debug, FromRepr, EnumCount)] pub enum UiTabs { #[default] - //Debug, Summary, + #[cfg(debug_assertions)] Home, Network, Applications, @@ -92,9 +94,10 @@ impl Ui { pub fn init(&mut self) { self.views[UiTabs::Summary as usize].push(Box::new(SummaryPage::new())); - self.views[UiTabs::Home as usize].push(Box::new(HomePage::new())); - - // self.views[UiTabs::Home as usize].push(Box::new(d)); + #[cfg(debug_assertions)] + { + self.views[UiTabs::Home as usize].push(Box::new(HomePage::new())); + } self.views[UiTabs::Network as usize].push(Box::new(create_network_page()));