     import Enum
     alias Serverboards.Plugin.Component
 
-    plugins = Agent.get registry, &(&1)
-    #Logger.debug("Known plugins: #{inspect plugins}")
-    #Logger.debug("filter Q #{inspect q}")
-    #fields = q |> map(fn {k,_} -> k end)
-
-    components = plugins |>
+    components = active_plugins |>
       flat_map(fn p -> # maps plugins to list of components that fit, or []
         p.components
           |> filter(fn c ->

require Logger

defmodule Serverboards.Plugin.Registry do
  def start_link(options \\ []) do
    {:ok, pid} = Agent.start_link(&load_plugins/0, options)

    Serverboards.Plugin.Monitor.start_link
    plugins = Agent.get pid, &(&1)
    Logger.info("Starting plugin registry #{inspect pid}, got #{Enum.count plugins}")

    {:ok, pid}
  end

  @doc ~S"""
  Reload all plugin data. Normally called from the inotify watcher
  """
  def reload_plugins do
    GenServer.cast(Serverboards.Plugin.Registry, {:reload})
  end

  def active_plugins do
    GenServer.call(Serverboards.Plugin.Registry, {:get_active})
  end

  def all_plugins do
    GenServer.call(Serverboards.Plugin.Registry, {:get_all})
  end

  @doc ~S"""
