From 8a11d6c58690585bd3939a3390cfe617ed8a8aef Mon Sep 17 00:00:00 2001 From: Dan <39170265+chillenberger@users.noreply.github.com> Date: Wed, 11 Oct 2023 12:59:37 -0600 Subject: [PATCH 1/4] center web app content, remove dead code, left nav boarder radius on button click --- pgml-dashboard/src/components/navbar/mod.rs | 2 +- .../src/components/navbar/template.html | 1 - .../components/navbar_web_app/template.html | 2 +- .../static/css/scss/components/_navs.scss | 1 + .../static/css/scss/layout/_containers.scss | 2 +- .../templates/layout/nav/left_web_app.html | 39 ----- pgml-dashboard/templates/layout/nav/top.html | 72 -------- .../templates/layout/nav/top_web_app.html | 161 ------------------ 8 files changed, 4 insertions(+), 276 deletions(-) delete mode 100644 pgml-dashboard/templates/layout/nav/left_web_app.html delete mode 100644 pgml-dashboard/templates/layout/nav/top.html delete mode 100644 pgml-dashboard/templates/layout/nav/top_web_app.html diff --git a/pgml-dashboard/src/components/navbar/mod.rs b/pgml-dashboard/src/components/navbar/mod.rs index 63b9cb351..3f279fd4a 100644 --- a/pgml-dashboard/src/components/navbar/mod.rs +++ b/pgml-dashboard/src/components/navbar/mod.rs @@ -4,7 +4,7 @@ use pgml_components::component; use sailfish::TemplateOnce; #[derive(TemplateOnce)] -#[template(path = "layout/nav/top.html")] +#[template(path = "navbar/template.html")] pub struct Navbar { pub current_user: Option, pub standalone_dashboard: bool, diff --git a/pgml-dashboard/src/components/navbar/template.html b/pgml-dashboard/src/components/navbar/template.html index 7f54386ae..bde4849ba 100644 --- a/pgml-dashboard/src/components/navbar/template.html +++ b/pgml-dashboard/src/components/navbar/template.html @@ -6,7 +6,6 @@
<%+ PostgresLogo::new("/") %> - diff --git a/pgml-dashboard/src/components/navbar_web_app/template.html b/pgml-dashboard/src/components/navbar_web_app/template.html index db1a5520f..640ca39af 100644 --- a/pgml-dashboard/src/components/navbar_web_app/template.html +++ b/pgml-dashboard/src/components/navbar_web_app/template.html @@ -19,7 +19,7 @@
diff --git a/pgml-dashboard/static/css/scss/components/_navs.scss b/pgml-dashboard/static/css/scss/components/_navs.scss index ca7c78394..162349641 100644 --- a/pgml-dashboard/static/css/scss/components/_navs.scss +++ b/pgml-dashboard/static/css/scss/components/_navs.scss @@ -257,6 +257,7 @@ &:active, :focus, :target, .active { background-color: #{$neon-tint-100}; color: #{$gray-100}; + border-radius: calc($border-radius / 2); span { color: #{$gray-100}; diff --git a/pgml-dashboard/static/css/scss/layout/_containers.scss b/pgml-dashboard/static/css/scss/layout/_containers.scss index f0ac22b21..e8226b6a3 100644 --- a/pgml-dashboard/static/css/scss/layout/_containers.scss +++ b/pgml-dashboard/static/css/scss/layout/_containers.scss @@ -148,6 +148,6 @@ .webapp-content-max-width-container { max-width: $webapp-content-max-width; - margin-left: 0px; + margin: 0px auto; min-height: calc(100vh - $navbar-height - $breadcrumb-height - 1px); } diff --git a/pgml-dashboard/templates/layout/nav/left_web_app.html b/pgml-dashboard/templates/layout/nav/left_web_app.html deleted file mode 100644 index 2305bc35a..000000000 --- a/pgml-dashboard/templates/layout/nav/left_web_app.html +++ /dev/null @@ -1,39 +0,0 @@ - diff --git a/pgml-dashboard/templates/layout/nav/top.html b/pgml-dashboard/templates/layout/nav/top.html deleted file mode 100644 index a1c8b5986..000000000 --- a/pgml-dashboard/templates/layout/nav/top.html +++ /dev/null @@ -1,72 +0,0 @@ -<% use crate::templates::components::GithubIcon; %> -<% use crate::templates::components::PostgresLogo; %> - -
- -
- - <% include!("../../components/search_modal.html");%> diff --git a/pgml-dashboard/templates/layout/nav/top_web_app.html b/pgml-dashboard/templates/layout/nav/top_web_app.html deleted file mode 100644 index 5d297cdde..000000000 --- a/pgml-dashboard/templates/layout/nav/top_web_app.html +++ /dev/null @@ -1,161 +0,0 @@ -<% use crate::templates::components::GithubIcon; %> -<% use crate::templates::components::PostgresLogo; %> - -
- -
- - <% include!("../../components/search_modal.html");%> From 26e878d9529bbdccfe21c68ca5ba3e88d0c4898c Mon Sep 17 00:00:00 2001 From: Dan <39170265+chillenberger@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:42:01 -0600 Subject: [PATCH 2/4] track left nave active tab, blog type fix, refactor, remove dead code. --- ...ve-search-results-with-machine-learning.md | 4 +- .../src/components/inputs/select/mod.rs | 2 +- .../components/left_nav_menu/template.html | 5 +- .../left_nav_web_app/left_nav_web_app.scss | 12 ----- .../src/components/left_nav_web_app/mod.rs | 26 ---------- pgml-dashboard/src/components/mod.rs | 12 ----- .../src/components/navbar/navbar.scss | 0 .../src/components/navigation/left_nav/mod.rs | 6 +++ .../navigation/left_nav/web_app/mod.rs | 23 +++++++++ .../left_nav/web_app}/template.html | 2 +- .../navigation/left_nav/web_app/web_app.scss | 26 ++++++++++ .../src/components/navigation/mod.rs | 6 +++ .../navbar/marketing/marketing.scss | 5 ++ .../navbar/marketing}/mod.rs | 16 +++--- .../navbar/marketing}/template.html | 6 +-- .../src/components/navigation/navbar/mod.rs | 10 ++++ .../navbar/web_app}/mod.rs | 16 +++--- .../navbar/web_app}/template.html | 14 ++--- .../navigation/navbar/web_app/web_app.scss | 24 +++++++++ .../static_nav/static_nav_controller.js | 14 +++++ pgml-dashboard/src/guards.rs | 41 ++++++++++++--- pgml-dashboard/src/lib.rs | 2 +- pgml-dashboard/src/main.rs | 2 +- pgml-dashboard/static/css/modules.scss | 5 +- .../static/css/scss/components/_navs.scss | 51 ------------------- .../content/dashboard/tabs/models_tab.html | 2 +- pgml-dashboard/templates/layout/base.html | 4 +- .../templates/layout/web_app_base.html | 10 ++-- 28 files changed, 192 insertions(+), 154 deletions(-) delete mode 100644 pgml-dashboard/src/components/left_nav_web_app/left_nav_web_app.scss delete mode 100644 pgml-dashboard/src/components/left_nav_web_app/mod.rs delete mode 100644 pgml-dashboard/src/components/navbar/navbar.scss create mode 100644 pgml-dashboard/src/components/navigation/left_nav/mod.rs create mode 100644 pgml-dashboard/src/components/navigation/left_nav/web_app/mod.rs rename pgml-dashboard/src/components/{left_nav_web_app => navigation/left_nav/web_app}/template.html (82%) create mode 100644 pgml-dashboard/src/components/navigation/left_nav/web_app/web_app.scss create mode 100644 pgml-dashboard/src/components/navigation/navbar/marketing/marketing.scss rename pgml-dashboard/src/components/{navbar => navigation/navbar/marketing}/mod.rs (56%) rename pgml-dashboard/src/components/{navbar => navigation/navbar/marketing}/template.html (92%) create mode 100644 pgml-dashboard/src/components/navigation/navbar/mod.rs rename pgml-dashboard/src/components/{navbar_web_app => navigation/navbar/web_app}/mod.rs (56%) rename pgml-dashboard/src/components/{navbar_web_app => navigation/navbar/web_app}/template.html (94%) create mode 100644 pgml-dashboard/src/components/navigation/navbar/web_app/web_app.scss create mode 100644 pgml-dashboard/src/components/static_nav/static_nav_controller.js diff --git a/pgml-dashboard/content/blog/how-to-improve-search-results-with-machine-learning.md b/pgml-dashboard/content/blog/how-to-improve-search-results-with-machine-learning.md index e78c1b615..f6ef9d029 100644 --- a/pgml-dashboard/content/blog/how-to-improve-search-results-with-machine-learning.md +++ b/pgml-dashboard/content/blog/how-to-improve-search-results-with-machine-learning.md @@ -316,11 +316,11 @@ The `pgml.train` function will return a table with some information about the tr !!! -PostgresML automatically deploys a model for online predictions after training, if the **key metric** is a better than the currently deployed model. We'll train many models over time for this project, and you can read more about deployments later. +PostgresML automatically deploys a model for online predictions after training, if the **key metric** is better than the currently deployed model. We'll train many models over time for this project, and you can read more about deployments later. ### Making Predictions -Once a model is trained, you can use `pgml.predict` to use it on new inputs. `pgml.predict` is a function that takes our project name, along with an array of features to predict on. In this case, our features are th `title_rank` and `body_rank`. We can use the `pgml.predict` function to make predictions on the training data, but in a real application, we'd want to make predictions on new data that the model hasn't seen before. Let's do a quick sanity check, and see what the model predicts for all the values of our training data. +Once a model is trained, you can use `pgml.predict` to use it on new inputs. `pgml.predict` is a function that takes our project name, along with an array of features to predict on. In this case, our features are `title_rank` and `body_rank`. We can use the `pgml.predict` function to make predictions on the training data, but in a real application, we'd want to make predictions on new data that the model hasn't seen before. Let's do a quick sanity check, and see what the model predicts for all the values of our training data. !!! generic diff --git a/pgml-dashboard/src/components/inputs/select/mod.rs b/pgml-dashboard/src/components/inputs/select/mod.rs index 30f2e5805..5bfbe3dc1 100644 --- a/pgml-dashboard/src/components/inputs/select/mod.rs +++ b/pgml-dashboard/src/components/inputs/select/mod.rs @@ -1,9 +1,9 @@ use crate::components::stimulus::stimulus_action::{StimulusAction, StimulusEvents}; use crate::components::stimulus::stimulus_target::StimulusTarget; +use crate::types::CustomOption; use pgml_components::component; use pgml_components::Component; use sailfish::TemplateOnce; -use crate::types::CustomOption; #[derive(TemplateOnce, Default)] #[template(path = "inputs/select/template.html")] diff --git a/pgml-dashboard/src/components/left_nav_menu/template.html b/pgml-dashboard/src/components/left_nav_menu/template.html index bcf2f54b1..84612e274 100644 --- a/pgml-dashboard/src/components/left_nav_menu/template.html +++ b/pgml-dashboard/src/components/left_nav_menu/template.html @@ -1,10 +1,11 @@ -