Skip to content

Commit 9637be7

Browse files
Dan test 1 (#1577)
1 parent 5198d43 commit 9637be7

File tree

5 files changed

+77
-5
lines changed

5 files changed

+77
-5
lines changed

pgml-dashboard/src/api/cms.rs

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::{
33
path::{Path, PathBuf},
44
};
55

6+
use rocket::response::Redirect;
67
use std::str::FromStr;
78

89
use comrak::{format_html_with_plugins, parse_document, Arena, ComrakPlugins};
@@ -62,7 +63,10 @@ lazy_static! {
6263
("transformers/fine_tuning/", "api/sql-extension/pgml.tune"),
6364
("guides/predictions/overview", "api/sql-extension/pgml.predict/"),
6465
("machine-learning/supervised-learning/data-pre-processing", "api/sql-extension/pgml.train/data-pre-processing"),
65-
("api/client-sdk/getting-started", "api/client-sdk/"),
66+
("introduction/getting-started/import-your-data/", "introduction/import-your-data/"),
67+
("introduction/getting-started/import-your-data/foreign-data-wrapper", "introduction/import-your-data/foreign-data-wrappers"),
68+
("use-cases/embeddings/generating-llm-embeddings-with-open-source-models-in-postgresml", "open-source/pgml/guides/embeddings/in-database-generation"),
69+
("use-cases/natural-language-processing", "open-source/pgml/guides/natural-language-processing"),
6670
])
6771
);
6872
}
@@ -857,6 +861,50 @@ pub async fn careers_apply(title: PathBuf, cluster: &Cluster) -> Result<Response
857861
Ok(ResponseOk(layout.render(page)))
858862
}
859863

864+
/// Redirect api to open-source
865+
#[get("/docs/api/<path..>")]
866+
pub async fn api_redirect(path: PathBuf) -> Redirect {
867+
match path.to_str().unwrap() {
868+
"apis" => Redirect::permanent("/docs/open-source/korvus/"),
869+
"client-sdk/search" => {
870+
Redirect::permanent("/docs/open-source/korvus/guides/document-search")
871+
}
872+
"client-sdk/getting-started" => Redirect::permanent("/docs/open-source/korvus/"),
873+
"sql-extensions/pgml.predict/" => Redirect::permanent("/docs/open-source/pgml/api/pgml.predict/"),
874+
"sql-extensions/pgml.deploy" => Redirect::permanent("/docs/open-source/pgml/api/pgml.deploy"),
875+
_ => Redirect::permanent("/docs/open-source/".to_owned() + path.to_str().unwrap()),
876+
}
877+
}
878+
879+
/// Redirect our old sql-extension path.
880+
#[get("/docs/open-source/sql-extension/<path..>")]
881+
pub async fn sql_extension_redirect(path: PathBuf) -> Redirect {
882+
Redirect::permanent("/docs/open-source/pgml/api/".to_owned() + path.to_str().unwrap())
883+
}
884+
885+
/// Redirect our old pgcat path.
886+
#[get("/docs/product/pgcat/<path..>")]
887+
pub async fn pgcat_redirect(path: PathBuf) -> Redirect {
888+
Redirect::permanent("/docs/open-source/pgcat/".to_owned() + path.to_str().unwrap())
889+
}
890+
891+
/// Redirect our old cloud-database path.
892+
#[get("/docs/product/cloud-database/<path..>")]
893+
pub async fn cloud_database_redirect(path: PathBuf) -> Redirect {
894+
let path = path.to_str().unwrap();
895+
if path.is_empty() {
896+
Redirect::permanent("/docs/cloud/overview")
897+
} else {
898+
Redirect::permanent("/docs/cloud/".to_owned() + path)
899+
}
900+
}
901+
902+
/// Redirect our old pgml docs.
903+
#[get("/docs/open-source/client-sdk/<path..>")]
904+
pub async fn pgml_redirect(path: PathBuf) -> Redirect {
905+
Redirect::permanent("/docs/open-source/korvus/api/".to_owned() + path.to_str().unwrap())
906+
}
907+
860908
#[get("/docs/<path..>", rank = 5)]
861909
async fn get_docs(
862910
path: PathBuf,
@@ -936,6 +984,7 @@ async fn docs_landing_page(cluster: &Cluster) -> Result<ResponseOk, crate::respo
936984
Ok(ResponseOk(doc_layout.render(page)))
937985
}
938986

987+
/// Redirect our old MkDocs paths to the new ones under `/docs`.
939988
#[get("/user_guides/<path..>", rank = 5)]
940989
async fn get_user_guides(path: PathBuf) -> Result<Response, crate::responses::NotFound> {
941990
Ok(Response::redirect(format!("/docs/{}", path.display().to_string())))
@@ -1003,6 +1052,11 @@ pub fn routes() -> Vec<Route> {
10031052
search,
10041053
search_blog,
10051054
demo,
1055+
sql_extension_redirect,
1056+
api_redirect,
1057+
pgcat_redirect,
1058+
pgml_redirect,
1059+
cloud_database_redirect
10061060
]
10071061
}
10081062

pgml-dashboard/src/components/cms/index_link/index_link.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ div[data-controller="cms-index-link"] {
1313
text-decoration: underline;
1414
text-underline-offset: 2px;
1515
}
16+
17+
.material-symbols-outlined {
18+
user-select: none;
19+
}
1620
}

pgml-dashboard/src/components/navigation/left_nav/docs/docs.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ div[data-controller="navigation-left-nav-docs"] {
3535
box-sizing: border-box;
3636
width: 100%;
3737
}
38+
39+
.doc-leftnav-inner {
40+
width: 100%;
41+
}
3842

3943
.show-scroll {
4044
padding-right: 25px;

pgml-dashboard/src/components/navigation/left_nav/docs/template.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"guides" => "menu_book",
77
"resources" => "school",
88
"introduction" => "list_alt",
9+
"cloud" => "cloud",
910
_ => "dashboard",
1011
}
1112
}
@@ -26,7 +27,7 @@
2627
<% if !mobile { %>
2728
<div class="doc-leftnav-container" id="doc-leftnav-container" data-controller="navigation-left-nav-docs" data-turbo-permanent>
2829
<nav class="doc-leftnav" data-scroll="0" data-navigation-left-nav-docs-target="leftNav">
29-
<div class="d-flex flex-column justify-content-between">
30+
<div class="d-flex flex-column justify-content-between doc-leftnav-inner">
3031
<div class="d-xl-flex flex-column py-4">
3132
<div class="pt-2 ps-2 d-flex flex-column gap-4_5">
3233
<% for doc_link in index.clone().into_iter() { %>

pgml-dashboard/src/components/sections/footers/marketing_footer/mod.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@ impl MarketingFooter {
2222
StaticNavLink::new("VPC".into(), "/docs/cloud/enterprise/vpc".into()),
2323
],
2424
solutions: vec![
25-
StaticNavLink::new("NLP".into(), "/docs/open-source/pgml/guides/natural-language-processing".into()),
26-
StaticNavLink::new("Supervised Learning".into(), "/docs/open-source/pgml/guides/supervised-learning".into()),
25+
StaticNavLink::new(
26+
"NLP".into(),
27+
"/docs/open-source/pgml/guides/natural-language-processing".into(),
28+
),
29+
StaticNavLink::new(
30+
"Supervised Learning".into(),
31+
"/docs/open-source/pgml/guides/supervised-learning".into(),
32+
),
2733
StaticNavLink::new("Embedding".into(), "/docs/open-source/pgml/guides/embeddings/".into()),
28-
StaticNavLink::new("Vector Database".into(), "/docs/open-source/pgml/guides/vector-database".into()),
34+
StaticNavLink::new(
35+
"Vector Database".into(),
36+
"/docs/open-source/pgml/guides/vector-database".into(),
37+
),
2938
StaticNavLink::new(
3039
"Search".into(),
3140
"/docs/open-source/pgml/guides/improve-search-results-with-machine-learning".into(),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy