MishkaGervaz (MishkaGervaz v0.0.1-alpha.3)

Copy Markdown View Source

MishkaGervaz is a Spark-based DSL library that provides declarative admin table and form configuration for Ash Framework resources.

Usage

Add the extension to your Ash resource. The top-level mishka_gervaz block contains two sibling sections: table (admin list view) and form (create/edit form).

Table example

defmodule MyApp.CMS.Component do
  use Ash.Resource,
    domain: MyApp.CMS,
    extensions: [MishkaGervaz.Resource]

  mishka_gervaz do
    table do
      identity do
        route "/admin/components"
      end

      columns do
        column :name, sortable: true
        column :status
      end

      row_actions do
        action :edit, type: :link
        action :delete, type: :destroy
      end
    end
  end

  # ... rest of Ash resource
end

Form example

mishka_gervaz do
  form do
    identity do
      name :component_form
      route "/admin/components"
    end

    source do
      actor_key :current_user
      master_check fn user -> user.role == :admin end

      actions do
        create {:master_create, :create}
        update {:master_update, :update}
        read {:master_get, :read}
      end
    end

    fields do
      field :name, :text, required: true
      field :status, :select
    end
  end
end

Design Principles

  1. Separation of Concerns: source = data/behavior, ui = presentation, render = custom output
  2. Smart Type Inference: Single source key detects intent from value shape
  3. Everything Optional: Sensible defaults everywhere, minimal required config
  4. Template Agnostic: ui.extra map for template-specific options
  5. Multi-tenant First: Built-in master/tenant user handling
  6. Overridable Pillars: Every state builder, event handler, and data loader can be swapped via DSL (state do field MyMod end, events do submit MyMod end, etc.)

Table sections

The following sections live within the table block:

Form sections

The following sections live within the form block:

Introspection