From 19272db2a900cc52436e8b9dfffc65fcc3db0482 Mon Sep 17 00:00:00 2001 From: ojyrkinen Date: Mon, 27 Nov 2023 10:29:56 +0100 Subject: [PATCH] Organized axiom-profiler-GUI/src into modules --- axiom-profiler-GUI/src/main.rs | 21 +++++++++++-------- .../src/{ => results/filters}/filter_chain.rs | 6 ++---- .../{ => results/filters}/graph_filters.rs | 6 +++--- axiom-profiler-GUI/src/results/filters/mod.rs | 3 +++ .../{ => results/filters}/selected_node.rs | 2 +- .../src/{ => results/graph}/graph.rs | 0 .../{ => results/graph}/graph_container.rs | 2 +- axiom-profiler-GUI/src/results/graph/mod.rs | 2 ++ axiom-profiler-GUI/src/results/mod.rs | 4 ++++ .../src/{ => results}/svg_result.rs | 5 +++-- .../src/{ => utils}/input_state.rs | 0 axiom-profiler-GUI/src/utils/mod.rs | 2 ++ .../src/{ => utils}/select_dropdown.rs | 0 .../src/{ => utils}/toggle_switch.rs | 0 14 files changed, 33 insertions(+), 20 deletions(-) rename axiom-profiler-GUI/src/{ => results/filters}/filter_chain.rs (97%) rename axiom-profiler-GUI/src/{ => results/filters}/graph_filters.rs (96%) create mode 100644 axiom-profiler-GUI/src/results/filters/mod.rs rename axiom-profiler-GUI/src/{ => results/filters}/selected_node.rs (98%) rename axiom-profiler-GUI/src/{ => results/graph}/graph.rs (100%) rename axiom-profiler-GUI/src/{ => results/graph}/graph_container.rs (99%) create mode 100644 axiom-profiler-GUI/src/results/graph/mod.rs create mode 100644 axiom-profiler-GUI/src/results/mod.rs rename axiom-profiler-GUI/src/{ => results}/svg_result.rs (99%) rename axiom-profiler-GUI/src/{ => utils}/input_state.rs (100%) create mode 100644 axiom-profiler-GUI/src/utils/mod.rs rename axiom-profiler-GUI/src/{ => utils}/select_dropdown.rs (100%) rename axiom-profiler-GUI/src/{ => utils}/toggle_switch.rs (100%) diff --git a/axiom-profiler-GUI/src/main.rs b/axiom-profiler-GUI/src/main.rs index 74c732c8..b3856422 100644 --- a/axiom-profiler-GUI/src/main.rs +++ b/axiom-profiler-GUI/src/main.rs @@ -6,17 +6,20 @@ use wasm_streams::ReadableStream; use web_sys::{Event, HtmlInputElement}; use yew::prelude::*; use yew_router::prelude::*; +use results::svg_result::SVGResult; -use crate::svg_result::SVGResult; +// use crate::svg_result::SVGResult; -mod filter_chain; -mod graph; -mod graph_filters; -mod input_state; -mod selected_node; -mod svg_result; -mod toggle_switch; -mod graph_container; +// mod filter_chain; +// mod graph; +// mod graph_filters; +// mod input_state; +// mod selected_node; +// mod svg_result; +// mod toggle_switch; +// mod graph_container; +mod results; +mod utils; // mod select_dropdown; pub enum Msg { LoadedBytes(String, Vec), diff --git a/axiom-profiler-GUI/src/filter_chain.rs b/axiom-profiler-GUI/src/results/filters/filter_chain.rs similarity index 97% rename from axiom-profiler-GUI/src/filter_chain.rs rename to axiom-profiler-GUI/src/results/filters/filter_chain.rs index 6963b86c..048697a2 100644 --- a/axiom-profiler-GUI/src/filter_chain.rs +++ b/axiom-profiler-GUI/src/results/filters/filter_chain.rs @@ -1,7 +1,5 @@ -use crate::{ - graph_filters::{Filter, GraphFilter}, - svg_result::{UserPermission, NODE_LIMIT}, -}; +use super::graph_filters::{Filter, GraphFilter}; +use super::super::svg_result::{UserPermission, NODE_LIMIT}; use gloo::console::log; use yew::prelude::*; // use gloo_console::log; diff --git a/axiom-profiler-GUI/src/graph_filters.rs b/axiom-profiler-GUI/src/results/filters/graph_filters.rs similarity index 96% rename from axiom-profiler-GUI/src/graph_filters.rs rename to axiom-profiler-GUI/src/results/filters/graph_filters.rs index 8afed645..bc54af27 100644 --- a/axiom-profiler-GUI/src/graph_filters.rs +++ b/axiom-profiler-GUI/src/results/filters/graph_filters.rs @@ -1,7 +1,7 @@ use crate::{ - input_state::{InputValue, UsizeInput}, - selected_node::SelectedNode, + utils::input_state::{InputValue, UsizeInput}, }; +use super::selected_node::SelectedNode; use petgraph::{stable_graph::NodeIndex, Direction}; use smt_log_parser::{ items::QuantIdx, @@ -110,7 +110,7 @@ pub fn graph_filter(props: &GraphFilterProps) -> Html { label={"Render the n most expensive instantiations where n = "} dependency={props.dependency.clone()} input_value={max_instantiations} - default_value={crate::svg_result::NODE_LIMIT} + default_value={super::super::svg_result::NODE_LIMIT} placeholder={""} /> diff --git a/axiom-profiler-GUI/src/results/filters/mod.rs b/axiom-profiler-GUI/src/results/filters/mod.rs new file mode 100644 index 00000000..37ce8ad3 --- /dev/null +++ b/axiom-profiler-GUI/src/results/filters/mod.rs @@ -0,0 +1,3 @@ +pub mod filter_chain; +pub mod graph_filters; +pub mod selected_node; \ No newline at end of file diff --git a/axiom-profiler-GUI/src/selected_node.rs b/axiom-profiler-GUI/src/results/filters/selected_node.rs similarity index 98% rename from axiom-profiler-GUI/src/selected_node.rs rename to axiom-profiler-GUI/src/results/filters/selected_node.rs index b1485cba..06bc2f2c 100644 --- a/axiom-profiler-GUI/src/selected_node.rs +++ b/axiom-profiler-GUI/src/results/filters/selected_node.rs @@ -2,7 +2,7 @@ use petgraph::Direction::{Incoming, Outgoing}; use smt_log_parser::parsers::z3::inst_graph::InstInfo; use yew::prelude::*; -use crate::graph_filters::Filter; +use super::graph_filters::Filter; #[derive(Properties, PartialEq)] pub struct SelectedNodeProps { diff --git a/axiom-profiler-GUI/src/graph.rs b/axiom-profiler-GUI/src/results/graph/graph.rs similarity index 100% rename from axiom-profiler-GUI/src/graph.rs rename to axiom-profiler-GUI/src/results/graph/graph.rs diff --git a/axiom-profiler-GUI/src/graph_container.rs b/axiom-profiler-GUI/src/results/graph/graph_container.rs similarity index 99% rename from axiom-profiler-GUI/src/graph_container.rs rename to axiom-profiler-GUI/src/results/graph/graph_container.rs index a7b78662..2ca624f4 100644 --- a/axiom-profiler-GUI/src/graph_container.rs +++ b/axiom-profiler-GUI/src/results/graph/graph_container.rs @@ -3,7 +3,7 @@ use web_sys::Event; use web_sys::HtmlInputElement; use wasm_bindgen::{JsCast, UnwrapThrowExt}; -use crate::graph::Graph; +use super::graph::Graph; pub enum Msg { SetValueTo(f32), diff --git a/axiom-profiler-GUI/src/results/graph/mod.rs b/axiom-profiler-GUI/src/results/graph/mod.rs new file mode 100644 index 00000000..06b6f4bd --- /dev/null +++ b/axiom-profiler-GUI/src/results/graph/mod.rs @@ -0,0 +1,2 @@ +pub mod graph_container; +pub mod graph; \ No newline at end of file diff --git a/axiom-profiler-GUI/src/results/mod.rs b/axiom-profiler-GUI/src/results/mod.rs new file mode 100644 index 00000000..ebaa6f27 --- /dev/null +++ b/axiom-profiler-GUI/src/results/mod.rs @@ -0,0 +1,4 @@ +pub mod svg_result; +pub mod filters; +pub mod graph; + diff --git a/axiom-profiler-GUI/src/svg_result.rs b/axiom-profiler-GUI/src/results/svg_result.rs similarity index 99% rename from axiom-profiler-GUI/src/svg_result.rs rename to axiom-profiler-GUI/src/results/svg_result.rs index 35f04714..67efcbb9 100644 --- a/axiom-profiler-GUI/src/svg_result.rs +++ b/axiom-profiler-GUI/src/results/svg_result.rs @@ -1,8 +1,9 @@ use self::colors::HSVColour; -use crate::{ +use super::filters::{ filter_chain::{FilterChain, Msg as FilterChainMsg}, - graph_filters::Filter, graph_container::GraphContainer, + graph_filters::Filter, }; +use super::graph::graph_container::GraphContainer; use material_yew::WeakComponentLink; use num_format::{Locale, ToFormattedString}; use petgraph::dot::{Config, Dot}; diff --git a/axiom-profiler-GUI/src/input_state.rs b/axiom-profiler-GUI/src/utils/input_state.rs similarity index 100% rename from axiom-profiler-GUI/src/input_state.rs rename to axiom-profiler-GUI/src/utils/input_state.rs diff --git a/axiom-profiler-GUI/src/utils/mod.rs b/axiom-profiler-GUI/src/utils/mod.rs new file mode 100644 index 00000000..ce503f0b --- /dev/null +++ b/axiom-profiler-GUI/src/utils/mod.rs @@ -0,0 +1,2 @@ +pub mod input_state; +pub mod toggle_switch; \ No newline at end of file diff --git a/axiom-profiler-GUI/src/select_dropdown.rs b/axiom-profiler-GUI/src/utils/select_dropdown.rs similarity index 100% rename from axiom-profiler-GUI/src/select_dropdown.rs rename to axiom-profiler-GUI/src/utils/select_dropdown.rs diff --git a/axiom-profiler-GUI/src/toggle_switch.rs b/axiom-profiler-GUI/src/utils/toggle_switch.rs similarity index 100% rename from axiom-profiler-GUI/src/toggle_switch.rs rename to axiom-profiler-GUI/src/utils/toggle_switch.rs