mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-03 07:57:05 +00:00
Compare commits
1 Commits
sig-panel-
...
all-system
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9196b42fc5 |
@@ -41,6 +41,10 @@ defmodule WandererApp.Api.MapSystem do
|
||||
action: :read_by_map_and_solar_system
|
||||
)
|
||||
|
||||
define(:search_by_map,
|
||||
action: :search_by_map
|
||||
)
|
||||
|
||||
define(:update_name, action: :update_name)
|
||||
define(:update_description, action: :update_description)
|
||||
define(:update_locked, action: :update_locked)
|
||||
@@ -73,6 +77,20 @@ defmodule WandererApp.Api.MapSystem do
|
||||
filter(expr(map_id == ^arg(:map_id) and visible == true))
|
||||
end
|
||||
|
||||
read :search_by_map do
|
||||
argument(:map_id, :string, allow_nil?: false)
|
||||
argument(:text, :string, allow_nil?: false)
|
||||
|
||||
filter(
|
||||
expr(
|
||||
(map_id == ^arg(:map_id) and
|
||||
contains(string_downcase(name), string_downcase(^arg(:text)))) or
|
||||
contains(string_downcase(custom_name), string_downcase(^arg(:text))) or
|
||||
contains(string_downcase(description), string_downcase(^arg(:text)))
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
read :read_by_map_and_solar_system do
|
||||
argument(:map_id, :string, allow_nil?: false)
|
||||
argument(:solar_system_id, :integer, allow_nil?: false)
|
||||
|
||||
@@ -523,7 +523,7 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
||||
%{
|
||||
systems:
|
||||
systems
|
||||
|> Enum.map(fn system -> MapEventHandler.map_ui_system(system, include_static_data?) end),
|
||||
|> Enum.map(fn system -> MapEventHandler.map_ui_system(system) end),
|
||||
hubs: hubs,
|
||||
connections: connections |> Enum.map(&MapEventHandler.map_ui_connection/1),
|
||||
options: options
|
||||
|
||||
@@ -267,6 +267,28 @@ defmodule WandererAppWeb.MapSystemsEventHandler do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
def handle_ui_event(
|
||||
"get_all_systems",
|
||||
_event,
|
||||
%{
|
||||
assigns: %{
|
||||
map_id: map_id
|
||||
}
|
||||
} =
|
||||
socket
|
||||
) do
|
||||
{:ok, systems} = WandererApp.MapSystemRepo.get_all_by_map(map_id)
|
||||
|
||||
systems =
|
||||
systems
|
||||
|> Enum.map(fn system -> MapEventHandler.map_ui_system(system, false) end)
|
||||
|
||||
{:reply,
|
||||
%{
|
||||
systems: systems
|
||||
}, socket}
|
||||
end
|
||||
|
||||
def handle_ui_event(
|
||||
"get_system_static_infos",
|
||||
%{"solar_system_ids" => solar_system_ids} = _event,
|
||||
|
||||
@@ -41,6 +41,7 @@ defmodule WandererAppWeb.MapEventHandler do
|
||||
"add_system",
|
||||
"delete_systems",
|
||||
"manual_add_system",
|
||||
"get_all_systems",
|
||||
"get_system_static_infos",
|
||||
"update_system_position",
|
||||
"update_system_positions",
|
||||
@@ -246,16 +247,23 @@ defmodule WandererAppWeb.MapEventHandler do
|
||||
status: status,
|
||||
visible: visible
|
||||
} = _system,
|
||||
_include_static_data? \\ true
|
||||
include_signatures? \\ true
|
||||
) do
|
||||
system_static_info = get_system_static_info(solar_system_id)
|
||||
|
||||
system_signatures =
|
||||
system_id
|
||||
|> WandererAppWeb.MapSignaturesEventHandler.get_system_signatures()
|
||||
|> Enum.filter(fn signature ->
|
||||
is_nil(signature.linked_system) && signature.group == "Wormhole"
|
||||
end)
|
||||
include_signatures?
|
||||
|> case do
|
||||
true ->
|
||||
system_id
|
||||
|> WandererAppWeb.MapSignaturesEventHandler.get_system_signatures()
|
||||
|> Enum.filter(fn signature ->
|
||||
is_nil(signature.linked_system) && signature.group == "Wormhole"
|
||||
end)
|
||||
|
||||
_ ->
|
||||
[]
|
||||
end
|
||||
|
||||
%{
|
||||
id: "#{solar_system_id}",
|
||||
|
||||
Reference in New Issue
Block a user