Skip to main content

HeaderActionDef

Struct HeaderActionDef 

Source
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

Source

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.

Source

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.

Source

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.

Source

pub fn icon(self, icon: IconData) -> Self

The icon before the button’s label. Defaults to none.

Source

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.

Source

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”.

Source

pub fn can_run( self, check: impl Fn(&Cx) -> bool + Send + Sync + 'static, ) -> Self

Whether the request may run the action, beyond the policy or the page’s access: a feature flag, a role the policy does not model. Defaults to every request.

Source

pub fn success(self, message: impl Into<Text>) -> Self

The success notification after a commit. Defaults to the label: "Recount tags: done".

Trait Implementations§

Source§

impl Debug for HeaderActionDef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HeaderActionDef

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more