pub struct RuntimeResource {
pub slug: String,
pub title: String,
pub singular: String,
pub per_page: i64,
pub fields: Vec<FieldDef>,
pub columns: Vec<ColumnDef>,
pub data: Arc<dyn RuntimeData>,
pub navigation_label: Option<String>,
pub navigation_group: Option<String>,
pub navigation_sort: Option<i32>,
pub navigation_icon: Option<String>,
pub conditions: FieldConditions,
}Expand description
A resource defined by data. Build it with new and the
field and column methods, then add it to the panel
with register_runtime.
Fields§
§slug: StringURL segment: "books" serves the resource at /admin/books. Lowercase letters,
digits, - and _ only.
title: StringHeading and navigation label: "Books".
singular: StringThe name of one record, for headings such as “New Book”.
per_page: i64Rows per page on the list view. The default is 20, as for a static resource.
fields: Vec<FieldDef>Form fields, in display order.
columns: Vec<ColumnDef>Table columns, in display order. Each column’s key is a field name.
data: Arc<dyn RuntimeData>Where the rows live.
The label of the navigation entry, as Filament’s $navigationLabel. None, the
default, is the title.
The navigation group the resource is listed under, as Filament’s $navigationGroup.
See IgniteResource::NAVIGATION_GROUP.
The resource’s place in the navigation, as Filament’s $navigationSort: lower first.
See IgniteResource::NAVIGATION_SORT.
The name of the navigation entry’s icon, such as post, as Filament’s
$navigationIcon. See IgniteResource::NAVIGATION_ICON.
conditions: FieldConditionsThe conditions that show or hide the form’s fields, and the live fields, as
Filament’s visible(), hidden() and live(). See FieldConditions.
Implementations§
Source§impl RuntimeResource
impl RuntimeResource
Sourcepub fn new(
slug: impl Into<String>,
title: impl Into<String>,
singular: impl Into<String>,
data: impl RuntimeData,
) -> Self
pub fn new( slug: impl Into<String>, title: impl Into<String>, singular: impl Into<String>, data: impl RuntimeData, ) -> Self
A resource at slug with no fields or columns yet, whose rows come from data.
Sets the label of the navigation entry, as Filament’s navigationLabel.
Lists the resource under the navigation group group, as Filament’s navigationGroup.
Sets the resource’s place in the navigation, as Filament’s navigationSort: lower first.
Sets the name of the navigation entry’s icon, as Filament’s navigationIcon: a name
such as "post" or a custom post type’s own, which the admin theme maps to its icon.
See IgniteResource::NAVIGATION_ICON.
Sourcepub fn visible(
self,
field: impl Into<String>,
rule: impl Fn(&FormContext<'_>) -> bool + Send + Sync + 'static,
) -> Self
pub fn visible( self, field: impl Into<String>, rule: impl Fn(&FormContext<'_>) -> bool + Send + Sync + 'static, ) -> Self
Shows the field field only when rule holds, as Filament’s ->visible(). See
FieldConditions::visible.
Hides the field field when rule holds, as Filament’s ->hidden(). See
FieldConditions::hidden.
Sourcepub fn visible_on(
self,
field: impl Into<String>,
operations: &[Operation],
) -> Self
pub fn visible_on( self, field: impl Into<String>, operations: &[Operation], ) -> Self
Shows the field field only on the forms of operations, as Filament’s
->visibleOn().
Hides the field field on the forms of operations, as Filament’s ->hiddenOn().
Sourcepub fn live(self, field: impl Into<String>) -> Self
pub fn live(self, field: impl Into<String>) -> Self
Makes the field field live, as Filament’s ->live(): a change to it in the browser
shows the form’s fields again for the new value. See FieldConditions::live.
Trait Implementations§
Source§impl Clone for RuntimeResource
impl Clone for RuntimeResource
Auto Trait Implementations§
impl !RefUnwindSafe for RuntimeResource
impl !UnwindSafe for RuntimeResource
impl Forget for RuntimeResource
impl Freeze for RuntimeResource
impl Move for RuntimeResource
impl Send for RuntimeResource
impl Sync for RuntimeResource
impl Unpin for RuntimeResource
impl UnsafeUnpin for RuntimeResource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more