diff --git a/pgml-dashboard/src/api/cms.rs b/pgml-dashboard/src/api/cms.rs index ddb3904a7..4fd1690bd 100644 --- a/pgml-dashboard/src/api/cms.rs +++ b/pgml-dashboard/src/api/cms.rs @@ -3,6 +3,7 @@ use std::{ path::{Path, PathBuf}, }; +use rocket::response::Redirect; use std::str::FromStr; use comrak::{format_html_with_plugins, parse_document, Arena, ComrakPlugins}; @@ -62,7 +63,10 @@ lazy_static! { ("transformers/fine_tuning/", "api/sql-extension/pgml.tune"), ("guides/predictions/overview", "api/sql-extension/pgml.predict/"), ("machine-learning/supervised-learning/data-pre-processing", "api/sql-extension/pgml.train/data-pre-processing"), - ("api/client-sdk/getting-started", "api/client-sdk/"), + ("introduction/getting-started/import-your-data/", "introduction/import-your-data/"), + ("introduction/getting-started/import-your-data/foreign-data-wrapper", "introduction/import-your-data/foreign-data-wrappers"), + ("use-cases/embeddings/generating-llm-embeddings-with-open-source-models-in-postgresml", "open-source/pgml/guides/embeddings/in-database-generation"), + ("use-cases/natural-language-processing", "open-source/pgml/guides/natural-language-processing"), ]) ); } @@ -857,6 +861,50 @@ pub async fn careers_apply(title: PathBuf, cluster: &Cluster) -> Result")] +pub async fn api_redirect(path: PathBuf) -> Redirect { + match path.to_str().unwrap() { + "apis" => Redirect::permanent("/docs/open-source/korvus/"), + "client-sdk/search" => { + Redirect::permanent("/docs/open-source/korvus/guides/document-search") + } + "client-sdk/getting-started" => Redirect::permanent("/docs/open-source/korvus/"), + "sql-extensions/pgml.predict/" => Redirect::permanent("/docs/open-source/pgml/api/pgml.predict/"), + "sql-extensions/pgml.deploy" => Redirect::permanent("/docs/open-source/pgml/api/pgml.deploy"), + _ => Redirect::permanent("/docs/open-source/".to_owned() + path.to_str().unwrap()), + } +} + +/// Redirect our old sql-extension path. +#[get("/docs/open-source/sql-extension/")] +pub async fn sql_extension_redirect(path: PathBuf) -> Redirect { + Redirect::permanent("/docs/open-source/pgml/api/".to_owned() + path.to_str().unwrap()) +} + +/// Redirect our old pgcat path. +#[get("/docs/product/pgcat/")] +pub async fn pgcat_redirect(path: PathBuf) -> Redirect { + Redirect::permanent("/docs/open-source/pgcat/".to_owned() + path.to_str().unwrap()) +} + +/// Redirect our old cloud-database path. +#[get("/docs/product/cloud-database/")] +pub async fn cloud_database_redirect(path: PathBuf) -> Redirect { + let path = path.to_str().unwrap(); + if path.is_empty() { + Redirect::permanent("/docs/cloud/overview") + } else { + Redirect::permanent("/docs/cloud/".to_owned() + path) + } +} + +/// Redirect our old pgml docs. +#[get("/docs/open-source/client-sdk/")] +pub async fn pgml_redirect(path: PathBuf) -> Redirect { + Redirect::permanent("/docs/open-source/korvus/api/".to_owned() + path.to_str().unwrap()) +} + #[get("/docs/", rank = 5)] async fn get_docs( path: PathBuf, @@ -936,6 +984,7 @@ async fn docs_landing_page(cluster: &Cluster) -> Result", rank = 5)] async fn get_user_guides(path: PathBuf) -> Result { Ok(Response::redirect(format!("/docs/{}", path.display().to_string()))) @@ -1003,6 +1052,11 @@ pub fn routes() -> Vec { search, search_blog, demo, + sql_extension_redirect, + api_redirect, + pgcat_redirect, + pgml_redirect, + cloud_database_redirect ] } diff --git a/pgml-dashboard/src/components/cms/index_link/index_link.scss b/pgml-dashboard/src/components/cms/index_link/index_link.scss index aad00b859..c3f6a3dc6 100644 --- a/pgml-dashboard/src/components/cms/index_link/index_link.scss +++ b/pgml-dashboard/src/components/cms/index_link/index_link.scss @@ -13,4 +13,8 @@ div[data-controller="cms-index-link"] { text-decoration: underline; text-underline-offset: 2px; } + + .material-symbols-outlined { + user-select: none; + } } diff --git a/pgml-dashboard/src/components/navigation/left_nav/docs/docs.scss b/pgml-dashboard/src/components/navigation/left_nav/docs/docs.scss index 2b3976150..ad3b22233 100644 --- a/pgml-dashboard/src/components/navigation/left_nav/docs/docs.scss +++ b/pgml-dashboard/src/components/navigation/left_nav/docs/docs.scss @@ -35,6 +35,10 @@ div[data-controller="navigation-left-nav-docs"] { box-sizing: border-box; width: 100%; } + + .doc-leftnav-inner { + width: 100%; + } .show-scroll { padding-right: 25px; diff --git a/pgml-dashboard/src/components/navigation/left_nav/docs/template.html b/pgml-dashboard/src/components/navigation/left_nav/docs/template.html index 06459e291..84a109c0b 100644 --- a/pgml-dashboard/src/components/navigation/left_nav/docs/template.html +++ b/pgml-dashboard/src/components/navigation/left_nav/docs/template.html @@ -6,6 +6,7 @@ "guides" => "menu_book", "resources" => "school", "introduction" => "list_alt", + "cloud" => "cloud", _ => "dashboard", } } @@ -26,7 +27,7 @@ <% if !mobile { %>