ChoreRunnerUI.ChoreLive (chore_runner v0.1.1)
A LiveView used in conjunction with ChoreRunner's regular functionality. Features logging and data value display of all running chores locally and on all connected nodes. Allows the running of chores (with autogenerated forms based on chore inputs), as well as stopping running chores.
Usage
Make sure that Chore.Supervisor
is added in your application
children = [
{Phoenix.PubSub, name: MyApp.PubSub},
{ChoreRunner, pubsub: MyApp.PubSub}
]
A pubsub MUST BE RUNNING and configured for both the Chore supervisor and the Chore LiveView for the Chore UI to function.
Make the Chore LiveView accessible in your Phoenix web app, either in a template or in the router.
Template
<%= live_render(@conn, ChoreRunnerUI.ChoreLive, session: %{"otp_app" => :my_app, "chore_root" => MyApp.Chores, "pubsub" => MyApp.PubSub}) %>
Router
@chore_session %{
"otp_app" => :my_app,
"chore_root" => MyApp.Chores,
"pubsub" => MyApp.PubSub
}
scope "/" do
pipe_through :browser
live_session :chores, session: @chore_session do
live "/", ChoreRunnerUI.ChoreLive
end
end
The "chore_root"
key in the session should be the module root that all of your chore modules use.
For example: if your root is MyApp.Chores
your chore modules should be named like MyApp.Chores.MyChore
Now you can visit the speficied url and start running chores!
Link to this section Summary
Functions
Callback implementation for Phoenix.LiveView.handle_event/3
.
Callback implementation for Phoenix.LiveView.handle_info/2
.
Callback implementation for Phoenix.LiveView.mount/3
.
Callback implementation for Phoenix.LiveView.render/1
.
Link to this section Functions
handle_event(event, arg2, socket)
Callback implementation for Phoenix.LiveView.handle_event/3
.
handle_info(unhandled, socket)
Callback implementation for Phoenix.LiveView.handle_info/2
.
mount(params, session, socket)
Callback implementation for Phoenix.LiveView.mount/3
.
render(assigns)
Callback implementation for Phoenix.LiveView.render/1
.