Skip to main content

header_action_buttons

Function header_action_buttons 

Source
pub fn header_action_buttons<P>(cx: &Cx) -> Pin<Box<dyn View + '_>>
where P: Page,
Expand description

The header buttons of the page P the request may run, for its page_actions:

struct MaintenancePage;

impl Page for MaintenancePage {
    fn declare() -> PageDef {
        PageDef::new().header_action::<ClearCache>()
    }

    async fn render(cx: &Cx) -> Result<impl View> {
        Ok(view! {
            tablo_ui::page(
                tablo_ui::page_header(
                    tablo_ui::page_title("Maintenance")
                    tablo_ui::page_actions((tablo_core::header_action_buttons::<Self>(cx)))
                )
            )
        })
    }
}

It renders nothing outside a request to P’s panel, for a request the panel’s sign-in or PageDef::access refuses, and no button for an action whose can_run refuses the request.