pub struct HeaderActionDef { /* private fields */ }Expand description
What a HeaderAction declares besides its name, input and body: how
its button reads, whether it asks first, and who it runs for beyond the policy or the page’s
access. Every setting has a default, so HeaderActionDef::new alone is a gray button
labelled after the action’s NAME.
let def = HeaderActionDef::new()
.icon(tablo_ui::icons::CHECK)
.color(Color::Warning)
.confirm();Implementations§
Source§impl HeaderActionDef
impl HeaderActionDef
Sourcepub fn new() -> Self
pub fn new() -> Self
Every default: a gray button labelled after the action’s NAME, running without
confirmation for whoever the policy or the page’s access admits.
Sourcepub fn confirm(self) -> Self
pub fn confirm(self) -> Self
Asks first, through a confirmation dialog with destructive wording.
An action with input confirms in its input dialog, or on its input page, instead. An unconfirmed POST that would write answers 400.
Sourcepub fn confirmation(self, question: impl Into<Text>) -> Self
pub fn confirmation(self, question: impl Into<Text>) -> Self
Asks first, as confirm does, with question in place of the message
tablo-confirm-run, “Run this action?”. An action with input confirms in its input
dialog instead, which its label titles.
Sourcepub fn icon(self, icon: IconData) -> Self
pub fn icon(self, icon: IconData) -> Self
The icon before the button’s label. Defaults to none.
Sourcepub fn color(self, color: Color) -> Self
pub fn color(self, color: Color) -> Self
The colour the button is tinted in, as Delete’s is in Color::Danger. Defaults to
Color::Gray, the untinted button.
It changes how the button looks, not what it asks: confirm asks first.
Sourcepub fn label(self, label: impl Into<Text>) -> Self
pub fn label(self, label: impl Into<Text>) -> Self
The button text. Defaults to the message action-{NAME} of the panel’s catalogs, else
NAME in sentence case: "recount-tags" reads “Recount tags”.