28 lines
717 B
Elixir
28 lines
717 B
Elixir
defmodule ToweropsWeb.SiteLive.Index do
|
|
@moduledoc false
|
|
use ToweropsWeb, :live_view
|
|
|
|
alias Towerops.Sites
|
|
|
|
@impl true
|
|
def mount(_params, _session, socket) do
|
|
organization = socket.assigns.current_scope.organization
|
|
sites = Sites.list_organization_sites(organization.id)
|
|
site_tree = Sites.build_site_tree(organization.id)
|
|
|
|
{:ok,
|
|
socket
|
|
|> assign(:page_title, "Sites")
|
|
|> assign(:sites, sites)
|
|
|> assign(:site_tree, site_tree)}
|
|
end
|
|
|
|
@impl true
|
|
def handle_params(params, _url, socket) do
|
|
{:noreply, apply_action(socket, socket.assigns.live_action, params)}
|
|
end
|
|
|
|
defp apply_action(socket, :index, _params) do
|
|
assign(socket, :page_title, "Sites")
|
|
end
|
|
end
|