Jobs module for PhoenixKit.
This module provides functions for managing the Jobs admin interface. When enabled, it shows a view-only dashboard of job status and history.
Core Functions
System Control
enabled?/0- Check if Jobs module is enabledenable_system/0- Enable Jobs moduledisable_system/0- Disable Jobs module
Settings Keys
All configuration is stored in the Settings system:
jobs_enabled- Enable/disable Jobs admin interface (boolean)
Usage Examples
# Check if Jobs module is enabled
if PhoenixKit.Jobs.enabled?() do
# Show jobs dashboard
end
# Enable/disable the module
PhoenixKit.Jobs.enable_system()
PhoenixKit.Jobs.disable_system()
Summary
Functions
Disables the Jobs module.
Enables the Jobs module.
Returns true when the Jobs module is enabled.
Returns the current Jobs module configuration as a map.
Returns job statistics from the Oban jobs table.
Functions
Disables the Jobs module.
Examples
iex> PhoenixKit.Jobs.disable_system()
{:ok, %PhoenixKit.Settings.Setting{}}
Enables the Jobs module.
Examples
iex> PhoenixKit.Jobs.enable_system()
{:ok, %PhoenixKit.Settings.Setting{}}
@spec enabled?() :: boolean()
Returns true when the Jobs module is enabled.
Examples
iex> PhoenixKit.Jobs.enabled?()
false
iex> PhoenixKit.Jobs.enable_system()
iex> PhoenixKit.Jobs.enabled?()
true
@spec get_config() :: map()
Returns the current Jobs module configuration as a map.
Examples
iex> PhoenixKit.Jobs.get_config()
%{
enabled: true,
stats: %{
available: 0,
scheduled: 0,
executing: 0,
completed: 0,
retryable: 0,
discarded: 0,
cancelled: 0
}
}
@spec get_job_stats() :: map()
Returns job statistics from the Oban jobs table.
Examples
iex> PhoenixKit.Jobs.get_job_stats()
%{available: 5, scheduled: 2, executing: 1, completed: 100, ...}