phlow_server/
extensions.rs

1use phlow::{phlow, phlow_all, PhlowView};
2
3use crate::PhlowServer;
4
5#[phlow::extensions(PhlowServerExtensions, PhlowServer)]
6impl ServerExtensions {
7    #[phlow::view]
8    fn info_for(_this: &PhlowServer, view: impl PhlowView) -> impl PhlowView {
9        view.columned_list()
10            .title("Info")
11            .priority(5)
12            .items::<PhlowServer>(|server| {
13                phlow_all!(vec![
14                    ("Session", phlow!(server.session())),
15                    ("ObjectId", phlow!(server.id())),
16                ])
17            })
18            .column_item::<(&str, phlow::PhlowObject)>("Property", |each| {
19                phlow!(each.0.to_string())
20            })
21            .column_item::<(&str, phlow::PhlowObject)>("Value", |each| phlow!(each.1.clone()))
22            .send::<(&str, phlow::PhlowObject)>(|each| each.1.clone())
23    }
24
25    #[phlow::view]
26    fn routes_for(_this: &PhlowServer, view: impl PhlowView) -> impl PhlowView {
27        view.columned_list()
28            .title("Routes")
29            .priority(6)
30            .items::<PhlowServer>(|server| phlow_all!(server.get_routes()))
31            .column_item::<(String, String)>("Mode", |each| phlow!(each.0.clone()))
32            .column_item::<(String, String)>("Path", |each| phlow!(each.1.clone()))
33    }
34}