Skip to main content

Module runtime_resource

Module runtime_resource 

Source
Expand description

Resources defined at run time, from data: their slug, fields, columns and queries are values, not a Rust type, so an app can add and remove them while the panel serves.

A static resource implements IgniteResource and is added with Ignite::resource. A runtime resource is a RuntimeResource value, whose rows come from a RuntimeData the app implements, and is added with Registries::register_runtime. The panel serves both through the same list, form and delete flows, at the same /admin/<slug> address, and a slug can belong to only one of them.

ⓘ
register_runtime(
    RuntimeResource::new("books", "Books", "Book", BookData)
        .field(FieldDef { name: "title".into(), label: "Title".into(),
                          kind: FieldKindDef::Text, required: true })
        .column(ColumnDef { key: "title".into(), label: "Title".into(),
                            sortable: true, searchable: true }),
)?;

Structs§

BlockDef
One block of a FieldKindDef::FlexibleContent field: the owned twin of Block.
ColumnDef
One column of the list of a runtime resource: the owned twin of Column.
FieldDef
One input on the form of a runtime resource: the owned twin of Field.
RegisteredResource
A runtime resource as the registry holds it: the definition, ready for the panel.
RuntimeResource
A resource defined by data. Build it with new and the field and column methods, then add it to the panel with Registries::register_runtime.

Enums§

FieldKindDef
The kind of a FieldDef: every FieldKind, with owned values so it can be loaded from a database.
RedirectAfter
Where the panel goes after a successful save of a runtime resource’s form, as Filament’s getRedirectUrl() and the panel’s resourceCreatePageRedirect() and resourceEditPageRedirect(). See RuntimeResource::redirect_after_create and RuntimeResource::redirect_after_update.
RuntimeError
Why the registry refused a change.

Constants§

MAX_FIELD_NAME
The longest field name a runtime resource accepts, in bytes, as for a MySQL or MariaDB column name. The limit is a validation rule: names are owned by their resource and freed with it.

Traits§

RuntimeData
Where the rows of a runtime resource live. The app implements it, so Ignite assumes no table layout: a custom post type can keep its rows in a shared posts table and its values in a meta table.

Functions§

register_runtime
Registers resource on the default app, as 0.7.1 did. See Registries::register_runtime.
reserve_slugs
Reserves slugs on the default app, as 0.7.1 did. See Registries::reserve_slugs.
runtime_resource
The runtime resource at slug on the default app. See Registries::runtime_resource.
runtime_resources
The runtime resources of the default app. See Registries::runtime_resources.
unregister_runtime
Removes the runtime resource at slug from the default app. See Registries::unregister_runtime.
validate_fields_for_update
Turns a submitted form into a Row for the fields fields that are not a resource’s, such as the fields an app adds to the panel’s profile page, with the checks and the values of RegisteredResource::validate_update: a blank password and a field the form did not send are left out of the row, an optional field sent blank is null, and a checkbox the form did not send is false. Each error is keyed by its field’s name. A lookup’s value is not checked against its choices here: the panel checks it, as for a resource.

Type Aliases§

FormNotice
A line a record’s form shows, from its FormContext, or none.
FormRule
A rule on a record’s form, given its FormContext: the operation, the record, the user and the form’s values, as a Filament closure is given $record and $operation.
Row
One record of a runtime resource: its values by key, as JSON. A row the panel lists or edits must have a numeric id, and a key for each field and column it shows.
RuntimeFuture
The future a RuntimeData method returns: boxed, so the trait can be a trait object. Write the body as Box::pin(async move { ... }).