Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7bb5956

Browse files
committed
make work after merge in master
1 parent9741028 commit7bb5956

File tree

2 files changed

+60
-148
lines changed
  • pgml-dashboard/src

2 files changed

+60
-148
lines changed

‎pgml-dashboard/src/components/layouts/product/index/mod.rs

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ use components::notifications::product::ProductBanner;
99

1010
usecrate::components::layouts::Head;
1111
usecrate::models::Cluster;
12+
usecrate::components::breadcrumbs::Breadcrumbs;
1213

1314
#[derive(TemplateOnce,Default,Clone)]
1415
#[template(path ="layouts/product/index/template.html")]
1516
pubstructIndex<'a>{
1617
pubcontent:Option<String>,
17-
pubbreadcrumbs:Vec<NavLink<'a>>,
18+
pubbreadcrumbs:Breadcrumbs<'a>,
1819
pubhead:Head,
1920
pubdropdown_nav:StaticNav,
20-
pubproduct_left_nav:StaticNav,
21+
pubproduct_left_nav:crate::components::navigation::left_nav::web_app::Menu,
2122
pubbody_components:Vec<Component>,
2223
pubcluster:Cluster,
2324
pubproduct_banners_high:Vec<ProductBanner>,
@@ -43,7 +44,7 @@ impl<'a> Index<'a> {
4344
Index{
4445
head,
4546
cluster,
46-
dropdown_nav: context.context.dropdown_nav.clone(),
47+
dropdown_nav: context.context.deployment_dropdown.clone(),
4748
product_left_nav: context.context.product_left_nav.clone(),
4849
product_banners_high: all_product_high_level,
4950
product_banner_medium:ProductBanner::from_notification(Notification::next_product_of_level(
@@ -60,18 +61,22 @@ impl<'a> Index<'a> {
6061
}
6162

6263
pubfnbreadcrumbs(&mutself,breadcrumbs:Vec<NavLink<'a>>) ->&mutSelf{
63-
self.breadcrumbs = breadcrumbs.to_owned();
64+
self.breadcrumbs.path = breadcrumbs.clone();
6465
self
6566
}
6667

6768
pubfndisable_upper_nav(&mutself) ->&mutSelf{
6869
let links:Vec<StaticNavLink> =self
6970
.product_left_nav
71+
.items
7072
.links
7173
.iter()
7274
.map(|item| item.to_owned().disabled(true))
7375
.collect();
74-
self.product_left_nav =StaticNav{ links};
76+
self.product_left_nav =crate::components::navigation::left_nav::web_app::Menu{
77+
back:self.product_left_nav.back.clone(),
78+
items:StaticNav{ links},
79+
};
7580
self
7681
}
7782

@@ -85,6 +90,56 @@ impl<'a> Index<'a> {
8590
self
8691
}
8792

93+
pubfnbreadcrumbs_from_uri(
94+
&mutself,
95+
org_dropdown:Vec<StaticNavLink>,
96+
database_dropdown:Vec<StaticNavLink>,
97+
uri:&str,
98+
) ->&mutSelf{
99+
let uri =if uri.starts_with("/"){
100+
uri.chars().skip(1).collect::<String>()
101+
}else{
102+
uri.to_string()
103+
};
104+
105+
let start_index =match(org_dropdown.is_empty(), database_dropdown.is_empty()){
106+
(true,true) =>0,
107+
(false,true) =>1,
108+
_ =>2,
109+
};
110+
111+
letmut uris = uri
112+
.split("/")
113+
.skip(start_index)
114+
.enumerate()
115+
.map(|(i, part)|{
116+
let path = uri
117+
.split("/")
118+
.into_iter()
119+
.take(1 + i + start_index)
120+
.collect::<Vec<&str>>()
121+
.join("/");
122+
letmut out ="/".to_owned();
123+
out.push_str(&path);
124+
125+
NavLink::new(part,&out)
126+
})
127+
.collect::<Vec<NavLink>>();
128+
129+
ifletSome(last) = uris.clone().into_iter().next_back(){
130+
uris.pop();
131+
uris.push(last.active());
132+
}
133+
134+
self.breadcrumbs =Breadcrumbs{
135+
organizations: org_dropdown,
136+
databases: database_dropdown,
137+
path: uris,
138+
};
139+
140+
self
141+
}
142+
88143
pubfnrender<T>(&mutself,template:T) ->String
89144
where
90145
T: sailfish::TemplateOnce,

‎pgml-dashboard/src/templates/mod.rs

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -114,149 +114,6 @@ impl From<Layout> for String {
114114
}
115115
}
116116

117-
// #[derive(TemplateOnce, Clone, Default)]
118-
// #[template(path = "layout/web_app_base.html")]
119-
// pub struct WebAppBase<'a> {
120-
// pub content: Option<String>,
121-
// pub breadcrumbs: Breadcrumbs<'a>,
122-
// pub head: Head,
123-
// pub dropdown_nav: StaticNav,
124-
// pub product_left_nav: crate::components::navigation::left_nav::web_app::Menu,
125-
// pub body_components: Vec<Component>,
126-
// pub cluster: Cluster,
127-
// pub product_banners_high: Vec<ProductBanner>,
128-
// pub product_banner_medium: ProductBanner,
129-
// pub product_banner_marketing: ProductBanner,
130-
// }
131-
132-
// impl<'a> WebAppBase<'a> {
133-
// pub fn new(title: &str, context: &crate::guards::Cluster) -> Self {
134-
// let head = Head::new().title(title).context(&context.context.head_items);
135-
// let cluster = context.context.cluster.clone();
136-
137-
// let all_product_high_level = context
138-
// .notifications
139-
// .clone()
140-
// .unwrap_or_else(|| vec![])
141-
// .into_iter()
142-
// .filter(|n: &Notification| n.level == NotificationLevel::ProductHigh)
143-
// .enumerate()
144-
// .map(|(i, n)| ProductBanner::from_notification(Some(&n)).set_show_modal_on_load(i == 0))
145-
// .collect::<Vec<ProductBanner>>();
146-
147-
// WebAppBase {
148-
// head,
149-
// cluster,
150-
// dropdown_nav: context.context.deployment_dropdown.clone(),
151-
// product_left_nav: context.context.product_left_nav.clone(),
152-
// product_banners_high: all_product_high_level,
153-
// product_banner_medium: ProductBanner::from_notification(Notification::next_product_of_level(
154-
// context,
155-
// NotificationLevel::ProductMedium,
156-
// )),
157-
// product_banner_marketing: ProductBanner::from_notification(Notification::next_product_of_level(
158-
// context,
159-
// NotificationLevel::ProductMarketing,
160-
// )),
161-
// ..Default::default()
162-
// }
163-
// }
164-
165-
// pub fn breadcrumbs(&mut self, breadcrumbs: Vec<NavLink<'a>>) -> &mut Self {
166-
// self.breadcrumbs.path = breadcrumbs.clone();
167-
// self
168-
// }
169-
170-
// pub fn disable_upper_nav(&mut self) -> &mut Self {
171-
// let links: Vec<StaticNavLink> = self
172-
// .product_left_nav
173-
// .items
174-
// .links
175-
// .iter()
176-
// .map(|item| item.to_owned().disabled(true))
177-
// .collect();
178-
// self.product_left_nav = crate::components::navigation::left_nav::web_app::Menu {
179-
// back: self.product_left_nav.back.clone(),
180-
// items: StaticNav { links },
181-
// };
182-
// self
183-
// }
184-
185-
// pub fn content(&mut self, content: &str) -> &mut Self {
186-
// self.content = Some(content.to_owned());
187-
// self
188-
// }
189-
190-
// pub fn body_components(&mut self, components: Vec<Component>) -> &mut Self {
191-
// self.body_components = components;
192-
// self
193-
// }
194-
195-
// pub fn breadcrumbs_from_uri(
196-
// &mut self,
197-
// org_dropdown: Vec<StaticNavLink>,
198-
// database_dropdown: Vec<StaticNavLink>,
199-
// uri: &str,
200-
// ) -> &mut Self {
201-
// let uri = if uri.starts_with("/") {
202-
// uri.chars().skip(1).collect::<String>()
203-
// } else {
204-
// uri.to_string()
205-
// };
206-
207-
// let start_index = match (org_dropdown.is_empty(), database_dropdown.is_empty()) {
208-
// (true, true) => 0,
209-
// (false, true) => 1,
210-
// _ => 2,
211-
// };
212-
213-
// let mut uris = uri
214-
// .split("/")
215-
// .skip(start_index)
216-
// .enumerate()
217-
// .map(|(i, part)| {
218-
// let path = uri
219-
// .split("/")
220-
// .into_iter()
221-
// .take(1 + i + start_index)
222-
// .collect::<Vec<&str>>()
223-
// .join("/");
224-
// let mut out = "/".to_owned();
225-
// out.push_str(&path);
226-
227-
// NavLink::new(part, &out)
228-
// })
229-
// .collect::<Vec<NavLink>>();
230-
231-
// if let Some(last) = uris.clone().into_iter().next_back() {
232-
// uris.pop();
233-
// uris.push(last.active());
234-
// }
235-
236-
// self.breadcrumbs = Breadcrumbs {
237-
// organizations: org_dropdown,
238-
// databases: database_dropdown,
239-
// path: uris,
240-
// };
241-
242-
// self
243-
// }
244-
245-
// pub fn render<T>(&mut self, template: T) -> String
246-
// where
247-
// T: sailfish::TemplateOnce,
248-
// {
249-
// self.content = Some(template.render_once().unwrap());
250-
// (*self).clone().into()
251-
// }
252-
// }
253-
254-
// impl<'a> From<WebAppBase<'a>> for String {
255-
// fn from(layout: WebAppBase) -> String {
256-
// layout.render_once().unwrap()
257-
// }
258-
// }
259-
260117
#[derive(TemplateOnce)]
261118
#[template(path ="content/article.html")]
262119
pubstructArticle{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp