Compare commits

..

13 Commits

Author SHA1 Message Date
CI
02d97a009c chore: release version v1.2.8 2024-10-06 13:13:12 +00:00
Ryan Olds
33940cdb9b Sortable signatures (#18)
feat(Signatures): Make signatures sortable
2024-10-06 17:12:47 +04:00
CI
7a63f9ee6b chore: release version v1.2.7 2024-10-05 07:55:07 +00:00
Dmitry Popov
89b41fff59 Merge branch 'main' of github.com:wanderer-industries/wanderer 2024-10-05 11:54:38 +04:00
Dmitry Popov
7a15f71528 chore: release version v1.2.5 2024-10-05 11:54:35 +04:00
CI
cdce2f8761 chore: release version v1.2.6 2024-10-05 07:39:43 +00:00
Dmitry Popov
a2470bbe47 Merge branch 'main' of github.com:wanderer-industries/wanderer 2024-10-05 11:39:17 +04:00
Dmitry Popov
dbdf1ddce0 fix(Core): Stability & performance improvements 2024-10-05 11:39:13 +04:00
CI
f767e42e6f chore: release version v1.2.5 2024-10-04 21:56:47 +00:00
Dmitry Popov
3051eb6369 Merge branch 'main' of github.com:wanderer-industries/wanderer 2024-10-05 01:56:19 +04:00
Dmitry Popov
a41faddca3 fix(Core): Add system "true security" correction 2024-10-05 01:56:16 +04:00
CI
469038730e chore: release version v1.2.4 2024-10-03 09:27:53 +00:00
Dmitry Popov
b1fe5d2453 fix(Map): Remove duplicate connections 2024-10-03 13:27:21 +04:00
7 changed files with 136 additions and 45 deletions

View File

@@ -2,6 +2,43 @@
<!-- changelog -->
## [v1.2.8](https://github.com/wanderer-industries/wanderer/compare/v1.2.7...v1.2.8) (2024-10-06)
## [v1.2.7](https://github.com/wanderer-industries/wanderer/compare/v1.2.6...v1.2.7) (2024-10-05)
## [v1.2.6](https://github.com/wanderer-industries/wanderer/compare/v1.2.5...v1.2.6) (2024-10-05)
### Bug Fixes:
* Core: Stability & performance improvements
## [v1.2.5](https://github.com/wanderer-industries/wanderer/compare/v1.2.4...v1.2.5) (2024-10-04)
### Bug Fixes:
* Core: Add system "true security" correction
## [v1.2.4](https://github.com/wanderer-industries/wanderer/compare/v1.2.3...v1.2.4) (2024-10-03)
### Bug Fixes:
* Map: Remove duplicate connections
## [v1.2.3](https://github.com/wanderer-industries/wanderer/compare/v1.2.2...v1.2.3) (2024-10-02)

View File

@@ -178,7 +178,7 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
resizableColumns
rowHover
selectAll
showHeaders={false}
sortField="eve_id"
onRowMouseEnter={handleEnterRow}
onRowMouseLeave={handleLeaveRow}
rowClassName={row => {
@@ -199,6 +199,7 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
field="group"
body={renderIcon}
style={{ maxWidth: 26, minWidth: 26, width: 26 }}
headerStyle={{ fontSize: "14px", padding: "0.25rem" }}
></Column>
<Column
@@ -206,12 +207,16 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
header="Id"
bodyClassName="text-ellipsis overflow-hidden whitespace-nowrap"
style={{ maxWidth: 72, minWidth: 72, width: 72 }}
headerStyle={{ fontSize: "14px", padding: "0.25rem" }}
sortable
></Column>
<Column
field="group"
header="Group"
bodyClassName="text-ellipsis overflow-hidden whitespace-nowrap"
hidden={compact}
headerStyle={{ fontSize: "14px", padding: "0.25rem" }}
sortable
></Column>
<Column
field="name"
@@ -220,6 +225,8 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
body={renderName}
style={{ maxWidth: nameColumnWidth }}
hidden={compact || medium}
headerStyle={{ fontSize: "14px", padding: "0.25rem" }}
sortable
></Column>
<Column
field="updated_at"
@@ -227,6 +234,8 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
dataType="date"
bodyClassName="w-[80px] text-ellipsis overflow-hidden whitespace-nowrap"
body={renderTimeLeft}
headerStyle={{ fontSize: "14px", padding: "0.25rem" }}
sortable
></Column>
</DataTable>
</>

View File

@@ -18,10 +18,7 @@ defmodule WandererApp.Api.MapConnection do
action: :read
)
define(:by_locations,
get_by: [:map_id, :solar_system_source, :solar_system_target],
action: :read
)
define(:by_locations, action: :read_by_locations)
define(:read_by_map, action: :read_by_map)
define(:get_link_pairs_advanced, action: :get_link_pairs_advanced)
@@ -47,6 +44,13 @@ defmodule WandererApp.Api.MapConnection do
filter(expr(map_id == ^arg(:map_id)))
end
read :read_by_locations do
argument(:map_id, :string, allow_nil?: false)
argument(:solar_system_source, :integer, allow_nil?: false)
argument(:solar_system_target, :integer, allow_nil?: false)
filter(expr(map_id == ^arg(:map_id) and solar_system_source == ^arg(:solar_system_source) and solar_system_target == ^arg(:solar_system_target)))
end
read :get_link_pairs_advanced do
argument(:map_id, :string, allow_nil?: false)
argument(:include_mass_crit, :boolean, allow_nil?: false)

View File

@@ -229,7 +229,7 @@ defmodule WandererApp.EveDataService do
constellation_id = row["constellationID"] |> Integer.parse() |> elem(0)
{:ok, wormhole_class_id} =
_get_wormhole_class_id(
get_wormhole_class_id(
map_location_wormhole_classes,
region_id,
constellation_id,
@@ -237,16 +237,16 @@ defmodule WandererApp.EveDataService do
)
{:ok, constellation_name} =
_get_constellation_name(map_constellations, constellation_id)
get_constellation_name(map_constellations, constellation_id)
{:ok, region_name} = _get_region_name(map_regions, region_id)
{:ok, region_name} = get_region_name(map_regions, region_id)
{:ok, wormhole_class} = _get_wormhole_class(wormhole_classes, wormhole_class_id)
{:ok, wormhole_class} = get_wormhole_class(wormhole_classes, wormhole_class_id)
{:ok, security} = _get_security(row["security"])
{:ok, security} = get_security(row["security"])
{:ok, class_title} =
_get_class_title(
get_class_title(
wormhole_classes_info,
wormhole_class_id,
security,
@@ -270,7 +270,7 @@ defmodule WandererApp.EveDataService do
solar_system_id: solar_system_id,
solar_system_name: row["solarSystemName"],
solar_system_name_lc: row["solarSystemName"] |> String.downcase(),
sun_type_id: _get_sun_type_id(row["sunTypeID"]),
sun_type_id: get_sun_type_id(row["sunTypeID"]),
constellation_name: constellation_name,
region_name: region_name,
security: security,
@@ -279,8 +279,8 @@ defmodule WandererApp.EveDataService do
type_description: wormhole_class.title,
is_shattered: is_shattered
}
|> _get_wormhole_data(wormhole_systems, solar_system_id, wormhole_class)
|> _get_triglavian_data(triglavian_systems, solar_system_id)
|> get_wormhole_data(wormhole_systems, solar_system_id, wormhole_class)
|> get_triglavian_data(triglavian_systems, solar_system_id)
end
)
end
@@ -332,14 +332,14 @@ defmodule WandererApp.EveDataService do
)
end
defp _get_sun_type_id(sun_type_id) do
defp get_sun_type_id(sun_type_id) do
case sun_type_id do
"None" -> 0
_ -> sun_type_id |> Integer.parse() |> elem(0)
end
end
defp _get_wormhole_data(default_data, wormhole_systems, solar_system_id, wormhole_class) do
defp get_wormhole_data(default_data, wormhole_systems, solar_system_id, wormhole_class) do
case Enum.find(wormhole_systems, fn system -> system.solar_system_id == solar_system_id end) do
nil ->
default_data
@@ -355,7 +355,7 @@ defmodule WandererApp.EveDataService do
end
end
defp _get_triglavian_data(default_data, triglavian_systems, solar_system_id) do
defp get_triglavian_data(default_data, triglavian_systems, solar_system_id) do
case Enum.find(triglavian_systems, fn system -> system.solar_system_id == solar_system_id end) do
nil ->
default_data
@@ -370,14 +370,18 @@ defmodule WandererApp.EveDataService do
end
end
defp _get_security(security) do
defp get_security(security) do
case security do
nil -> {:ok, ""}
_ -> {:ok, Decimal.parse(security) |> elem(0) |> Decimal.round(1) |> Decimal.to_string()}
_ -> {:ok, String.to_float(security) |> get_true_security() |> Float.to_string(decimals: 1)}
end
end
defp _get_class_title(wormhole_classes_info, wormhole_class_id, security, wormhole_class) do
defp get_true_security(security) when is_float(security) and security > 0.0 and security < 0.05, do: security |> Float.ceil(1)
defp get_true_security(security) when is_float(security), do: security |> Float.floor(1)
defp get_class_title(wormhole_classes_info, wormhole_class_id, security, wormhole_class) do
case wormhole_class_id in [
wormhole_classes_info.names["hs"],
wormhole_classes_info.names["ls"],
@@ -391,7 +395,7 @@ defmodule WandererApp.EveDataService do
end
end
defp _get_constellation_name(constellations, constellation_id) do
defp get_constellation_name(constellations, constellation_id) do
case Enum.find(constellations, fn constellation ->
constellation.constellation_id == constellation_id
end) do
@@ -400,24 +404,24 @@ defmodule WandererApp.EveDataService do
end
end
defp _get_region_name(regions, region_id) do
defp get_region_name(regions, region_id) do
case Enum.find(regions, fn region -> region.region_id == region_id end) do
nil -> {:ok, ""}
region -> {:ok, region.region_name}
end
end
defp _get_wormhole_class(wormhole_classes, wormhole_class_id) do
defp get_wormhole_class(wormhole_classes, wormhole_class_id) do
{:ok,
Enum.find(wormhole_classes, fn wormhole_class ->
wormhole_class.wormhole_class_id == wormhole_class_id
end)}
end
defp _get_wormhole_class_id(_systems, _region_id, _constellation_id, 30_100_000),
defp get_wormhole_class_id(_systems, _region_id, _constellation_id, 30_100_000),
do: {:ok, 10_100}
defp _get_wormhole_class_id(systems, region_id, constellation_id, solar_system_id) do
defp get_wormhole_class_id(systems, region_id, constellation_id, solar_system_id) do
with region <-
Enum.find(systems, fn system ->
system.location_id |> Integer.parse() |> elem(0) == region_id
@@ -430,23 +434,23 @@ defmodule WandererApp.EveDataService do
Enum.find(systems, fn system ->
system.location_id |> Integer.parse() |> elem(0) == solar_system_id
end),
wormhole_class_id <- _get_wormhole_class_id(region, constellation, solar_system) do
wormhole_class_id <- get_wormhole_class_id(region, constellation, solar_system) do
{:ok, wormhole_class_id}
else
_ -> {:ok, -1}
end
end
defp _get_wormhole_class_id(_region, _constellation, solar_system)
defp get_wormhole_class_id(_region, _constellation, solar_system)
when not is_nil(solar_system),
do: solar_system.wormhole_class_id |> Integer.parse() |> elem(0)
defp _get_wormhole_class_id(_region, constellation, _solar_system)
defp get_wormhole_class_id(_region, constellation, _solar_system)
when not is_nil(constellation),
do: constellation.wormhole_class_id |> Integer.parse() |> elem(0)
defp _get_wormhole_class_id(region, _constellation, _solar_system) when not is_nil(region),
defp get_wormhole_class_id(region, _constellation, _solar_system) when not is_nil(region),
do: region.wormhole_class_id |> Integer.parse() |> elem(0)
defp _get_wormhole_class_id(_region, _constellation, _solar_system), do: -1
defp get_wormhole_class_id(_region, _constellation, _solar_system), do: -1
end

View File

@@ -365,17 +365,7 @@ defmodule WandererApp.Map.Server.Impl do
connections_to_remove
|> Enum.each(fn connection ->
@logger.debug(fn -> "Removing connection from map: #{inspect(connection)}" end)
connection
|> WandererApp.MapConnectionRepo.destroy!()
|> case do
:ok ->
:ok
{:error, error} ->
@logger.error("Failed to remove connection from map: #{inspect(error, pretty: true)}")
:ok
end
WandererApp.MapConnectionRepo.destroy(map_id, connection)
end)
@ddrt.delete(removed_ids, rtree_name)
@@ -1575,8 +1565,7 @@ defmodule WandererApp.Map.Server.Impl do
old_location.solar_system_id
) do
{:ok, connection} ->
connection
|> WandererApp.MapConnectionRepo.destroy!()
:ok = WandererApp.MapConnectionRepo.destroy(map_id, connection)
broadcast!(map_id, :remove_connections, [connection])
map_id |> WandererApp.Map.remove_connection(connection)

View File

@@ -1,12 +1,60 @@
defmodule WandererApp.MapConnectionRepo do
use WandererApp, :repository
require Logger
@logger Application.compile_env(:wanderer_app, :logger)
def get_by_map(map_id),
do: WandererApp.Api.MapConnection.read_by_map(%{map_id: map_id})
def get_by_locations(map_id, solar_system_source, solar_system_target) do
WandererApp.Api.MapConnection.by_locations(%{map_id: map_id, solar_system_source: solar_system_source, solar_system_target: solar_system_target})
|> case do
{:ok, connections} ->
{:ok, connections}
{:error, %Ash.Error.Query.NotFound{}} ->
{:ok, []}
{:error, error} ->
@logger.error("Failed to get connections: #{inspect(error, pretty: true)}")
{:error, error}
end
end
def create!(connection), do: connection |> WandererApp.Api.MapConnection.create!()
def destroy!(connection), do: connection |> WandererApp.Api.MapConnection.destroy!()
def destroy(map_id, connection) do
{:ok, from_connections} = get_by_locations(map_id, connection.solar_system_source, connection.solar_system_target)
{:ok, to_connections} = get_by_locations(map_id, connection.solar_system_target, connection.solar_system_source)
[from_connections ++ to_connections]
|> List.flatten()
|> bulk_destroy!()
|> case do
:ok ->
:ok
error ->
@logger.error("Failed to remove connections from map: #{inspect(error, pretty: true)}")
:ok
end
end
def destroy!(connection), do:
connection |> WandererApp.Api.MapConnection.destroy!()
def bulk_destroy!(connections) do
connections
|> WandererApp.Api.MapConnection.destroy!()
|> case do
%Ash.BulkResult{status: :success} ->
:ok
error ->
error
end
end
def update_time_status(connection, update),
do:

View File

@@ -2,7 +2,7 @@ defmodule WandererApp.MixProject do
use Mix.Project
@source_url "https://github.com/wanderer-industries/wanderer"
@version "1.2.3"
@version "1.2.8"
def project do
[