Files
archived-teslamate/lib/teslamate_web/views/layout_view.ex
2020-02-07 13:21:05 +01:00

17 lines
425 B
Elixir

defmodule TeslaMateWeb.LayoutView do
use TeslaMateWeb, :view
dashboards =
for dashboard_path <- Path.wildcard("grafana/dashboards/*.json") do
@external_resource Path.relative_to_cwd(dashboard_path)
dashboard_path
|> File.read!()
|> Jason.decode!()
|> Map.take(["title", "uid"])
end
@dashboards Enum.sort_by(dashboards, & &1["title"])
defp list_dashboards, do: @dashboards
end