Compare commits

...

12 Commits

Author SHA1 Message Date
Dmitry Popov
fe64c27e85 feat(Map): Auto delete linked connections 2024-10-22 09:45:28 +02:00
Dmitry Popov
4ec7b40eb7 Merge branch 'main' into auto-delete-connections 2024-10-21 16:08:56 +02:00
CI
4835dfcc42 chore: release version v1.12.4 2024-10-21 11:11:42 +00:00
Dmitry Popov
15bceb09a2 chore: release version v1.12.3 2024-10-21 13:11:13 +02:00
Dmitry Popov
13e818abfd fix(Map): Fix systems cleanup 2024-10-21 13:02:42 +02:00
Dmitry Popov
9fab757bea feat(Map): Auto delete linked connections 2024-10-21 10:30:11 +02:00
CI
9c5f6049b5 chore: release version v1.12.3 2024-10-18 07:10:35 +00:00
Dmitry Popov
2095b619a4 Merge branch 'main' of github.com:wanderer-industries/wanderer 2024-10-18 11:10:06 +04:00
Dmitry Popov
df155cbc1b fix(Map): Fix regression issues 2024-10-18 11:10:02 +04:00
CI
3781729fd1 chore: release version v1.12.2 2024-10-16 21:12:27 +00:00
Dmitry Popov
d03c634ec0 Merge branch 'main' of github.com:wanderer-industries/wanderer 2024-10-17 01:11:41 +04:00
Dmitry Popov
93c979c218 chore: release version v1.12.0 2024-10-17 01:11:37 +04:00
13 changed files with 673 additions and 803 deletions

View File

@@ -2,6 +2,29 @@
<!-- changelog -->
## [v1.12.4](https://github.com/wanderer-industries/wanderer/compare/v1.12.3...v1.12.4) (2024-10-21)
### Bug Fixes:
* Map: Fix systems cleanup
## [v1.12.3](https://github.com/wanderer-industries/wanderer/compare/v1.12.2...v1.12.3) (2024-10-18)
### Bug Fixes:
* Map: Fix regression issues
## [v1.12.2](https://github.com/wanderer-industries/wanderer/compare/v1.12.1...v1.12.2) (2024-10-16)
## [v1.12.1](https://github.com/wanderer-industries/wanderer/compare/v1.12.0...v1.12.1) (2024-10-16)

View File

@@ -9,21 +9,25 @@ import { OutCommand } from '@/hooks/Mapper/types';
export enum UserSettingsRemoteProps {
link_signature_on_splash = 'link_signature_on_splash',
select_on_spash = 'select_on_spash',
delete_connection_with_sigs = 'delete_connection_with_sigs',
}
export const DEFAULT_REMOTE_SETTINGS = {
[UserSettingsRemoteProps.link_signature_on_splash]: false,
[UserSettingsRemoteProps.select_on_spash]: false,
[UserSettingsRemoteProps.delete_connection_with_sigs]: false,
};
export const UserSettingsRemoteList = [
UserSettingsRemoteProps.link_signature_on_splash,
UserSettingsRemoteProps.select_on_spash,
UserSettingsRemoteProps.delete_connection_with_sigs,
];
export type UserSettingsRemote = {
link_signature_on_splash: boolean;
select_on_spash: boolean;
delete_connection_with_sigs: boolean;
};
export type UserSettings = UserSettingsRemote & InterfaceStoredSettings;
@@ -51,6 +55,10 @@ const SIGNATURES_CHECKBOXES_PROPS: CheckboxesList = [
{ prop: UserSettingsRemoteProps.link_signature_on_splash, label: 'Link signature on splash' },
];
const CONNECTIONS_CHECKBOXES_PROPS: CheckboxesList = [
{ prop: UserSettingsRemoteProps.delete_connection_with_sigs, label: 'Delete connections to linked signatures' },
];
const UI_CHECKBOXES_PROPS: CheckboxesList = [
{ prop: InterfaceStoredSettingsProps.isShowMenu, label: 'Enable compact map menu bar' },
];
@@ -149,8 +157,8 @@ export const MapSettings = ({ show, onHide }: MapSettingsProps) => {
{renderCheckboxesList(SYSTEMS_CHECKBOXES_PROPS)}
</div>
</TabPanel>
<TabPanel disabled header="Connections" headerClassName={styles.verticalTabHeader}>
<p>Connections</p>
<TabPanel header="Connections" headerClassName={styles.verticalTabHeader}>
{renderCheckboxesList(CONNECTIONS_CHECKBOXES_PROPS)}
</TabPanel>
<TabPanel header="Signatures" headerClassName={styles.verticalTabHeader}>
{renderCheckboxesList(SIGNATURES_CHECKBOXES_PROPS)}

View File

@@ -30,4 +30,19 @@ defmodule WandererApp do
defmacro __using__(which) when is_atom(which) do
apply(__MODULE__, which, [])
end
def log_exception(kind, reason, stacktrace) do
reason = Exception.normalize(kind, reason, stacktrace)
crash_reason =
case kind do
:throw -> {{:nocatch, reason}, stacktrace}
_ -> {reason, stacktrace}
end
Logger.error(
Exception.format(kind, reason, stacktrace),
crash_reason: crash_reason
)
end
end

View File

@@ -67,8 +67,7 @@ defmodule WandererApp.Api.MapSystemSignature do
:name,
:description,
:kind,
:group,
:linked_system_id
:group
]
primary? true

View File

@@ -1,7 +1,7 @@
defmodule WandererApp.MapRepo do
use WandererApp, :repository
@default_map_options %{"layout" => "left_to_right", "store_custom_labels" => false}
@default_map_options %{"layout" => "left_to_right", "store_custom_labels" => "false"}
def get(map_id, relationships \\ []) do
map_id

View File

@@ -1,7 +1,7 @@
defmodule WandererApp.MapUserSettingsRepo do
use WandererApp, :repository
@default_form_data %{"select_on_spash" => "false", "link_signature_on_splash" => "false"}
@default_form_data %{"select_on_spash" => false, "link_signature_on_splash" => false, "delete_connection_with_sigs" => false}
def get(map_id, user_id) do
map_id
@@ -46,4 +46,13 @@ defmodule WandererApp.MapUserSettingsRepo do
{:ok, data} = to_form_data(user_settings)
data
end
def get_boolean_setting(settings, key, default \\ false) do
settings
|> Map.get(key, default)
|> to_boolean()
end
def to_boolean(value) when is_binary(value), do: value |> String.to_existing_atom()
def to_boolean(value) when is_boolean(value), do: value
end

View File

@@ -0,0 +1,38 @@
defmodule WandererAppWeb.MapLoader do
use WandererAppWeb, :live_component
def render(assigns) do
~H"""
<div
id="map-loader"
data-loading={show_loader("map-loader")}
data-loaded={hide_loader("map-loader")}
class="!z-100 w-screen h-screen hidden relative"
>
<div class="hs-overlay-backdrop transition duration absolute inset-0 blur" />
<div class="flex !z-[150] w-full h-full items-center justify-center">
<div class="Loader" data-text="Wanderer">
<span class="Loader__Circle"></span>
<span class="Loader__Circle"></span>
<span class="Loader__Circle"></span>
<span class="Loader__Circle"></span>
</div>
</div>
</div>
"""
end
defp show_loader(js \\ %JS{}, id),
do:
JS.show(js,
to: "##{id}",
transition: {"transition-opacity ease-out duration-500", "opacity-0", "opacity-100"}
)
defp hide_loader(js \\ %JS{}, id),
do:
JS.hide(js,
to: "##{id}",
transition: {"transition-opacity ease-in duration-500", "opacity-100", "opacity-0"}
)
end

View File

@@ -0,0 +1,75 @@
defmodule WandererAppWeb.MapPicker do
use WandererAppWeb, :live_component
use LiveViewEvents
@impl true
def mount(socket) do
socket =
socket
|> assign(form: to_form(%{"map_slug" => nil}))
{:ok, socket}
end
def update(
%{
current_user: current_user,
map_slug: map_slug
} = assigns,
socket
) do
socket = handle_info_or_assign(socket, assigns)
{:ok,
socket
|> assign(form: to_form(%{"map_slug" => map_slug}))
|> assign_async(:maps, fn ->
get_available_maps(current_user)
end)}
end
def render(assigns) do
~H"""
<div id={@id}>
<.form
:let={f}
:if={not is_nil(assigns |> Map.get(:maps))}
for={@form}
phx-change="select"
phx-target={@myself}
>
<.async_result :let={maps} assign={@maps}>
<:loading><span class="loading loading-dots loading-xs" /></:loading>
<:failed :let={reason}><%= reason %></:failed>
<.input
:if={maps}
type="select"
field={f[:map_slug]}
class="select h-8 min-h-[0px] !pt-1 !pb-1 text-sm bg-neutral-900"
placeholder="Select a map..."
options={Enum.map(@maps.result, fn map -> {map.label, map.value} end)}
/>
</.async_result>
</.form>
</div>
"""
end
def handle_event("select", %{"map_slug" => map_slug} = _params, socket) do
notify_to(socket.assigns.notify_to, socket.assigns.event_name, map_slug)
{:noreply, socket}
end
defp get_available_maps(current_user) do
{:ok, maps} =
current_user
|> WandererApp.Maps.get_available_maps()
{:ok, %{maps: maps |> Enum.sort_by(& &1.name, :asc) |> Enum.map(&map_map/1)}}
end
defp map_map(%{name: name, slug: slug} = _map),
do: %{label: name, value: slug}
end

View File

@@ -1,6 +0,0 @@
defmodule WandererApp.MapCharacterSettingsRepo do
use WandererApp, :repository
def create(settings),
do: WandererApp.Api.MapCharacterSettings.create(settings)
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,34 +1,17 @@
<div
id="map-loader"
data-loading={show_loader("map-loader")}
data-loaded={hide_loader("map-loader")}
class="!z-100 w-screen h-screen hidden relative"
>
<div class="hs-overlay-backdrop transition duration absolute inset-0 blur" />
<div class="flex !z-[150] w-full h-full items-center justify-center">
<div class="Loader" data-text="Wanderer">
<span class="Loader__Circle"></span>
<span class="Loader__Circle"></span>
<span class="Loader__Circle"></span>
<span class="Loader__Circle"></span>
</div>
</div>
</div>
<.live_component module={WandererAppWeb.MapLoader} id="map-loader" />
<div class="w-full h-full" id="mapper" phx-hook="Mapper" phx-update="ignore"></div>
<div class="absolute top-0 mt-2 left-16 flex gap-1">
<.form :let={f} for={@form} phx-change="change_map">
<span :if={@maps_loading} class="loading loading-dots loading-xs"></span>
<.input
:if={not @maps_loading}
type="select"
field={f[:map_slug]}
class="select h-8 min-h-[0px] !pt-1 !pb-1 text-sm bg-neutral-900"
placeholder="Select a map..."
options={Enum.map(@maps, fn map -> {map.label, map.value} end)}
/>
</.form>
<.live_component
:if={not is_nil(assigns |> Map.get(:map_slug))}
module={WandererAppWeb.MapPicker}
id="map-picker"
notify_to={self()}
current_user={@current_user}
map_slug={@map_slug}
event_name="change_map"
/>
<.button
:if={(@user_permissions || %{}) |> Map.get(:view_character, false)}
@@ -149,25 +132,3 @@
</.table>
</.async_result>
</.modal>
<.modal
:if={assigns |> Map.get(:show_user_settings?, false)}
id="map-user-settings-modal"
title="Map user settings"
show
on_cancel={JS.push("hide_user_settings")}
>
<.form
:let={f}
:if={assigns |> Map.get(:user_settings_form, false)}
for={@user_settings_form}
phx-change="update_user_settings"
>
<.input type="checkbox" field={f[:select_on_spash]} label="Auto select splashed systems" />
<.input
type="checkbox"
field={f[:link_signature_on_splash]}
label="Link splashed systems to signatures"
/>
</.form>
</.modal>

View File

@@ -2,7 +2,7 @@ defmodule WandererApp.MixProject do
use Mix.Project
@source_url "https://github.com/wanderer-industries/wanderer"
@version "1.12.1"
@version "1.12.4"
def project do
[
@@ -112,7 +112,8 @@ defmodule WandererApp.MixProject do
{:git_ops, "~> 2.6.1"},
{:version_tasks, "~> 0.12.0"},
{:error_tracker, "~> 0.2"},
{:ddrt, "~> 0.2.1"}
{:ddrt, "~> 0.2.1"},
{:live_view_events, "~> 0.1.0"}
]
end

View File

@@ -58,6 +58,7 @@
"jumper": {:hex, :jumper, "1.0.2", "68cdcd84472a00ac596b4e6459a41b3062d4427cbd4f1e8c8793c5b54f1406a7", [:mix], [], "hexpm", "9b7782409021e01ab3c08270e26f36eb62976a38c1aa64b2eaf6348422f165e1"},
"libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"},
"live_select": {:hex, :live_select, "1.4.2", "193056948a52144177bb53266b116117c5ae129939a67f15d7927750d35dd1a9", [:mix], [{:ecto, "~> 3.8", [hex: :ecto, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix, ">= 1.6.0", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_html_helpers, "~> 1.0", [hex: :phoenix_html_helpers, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "fc59e20d8fcb78f3971e898019ad82a4fe2bb516414ccfd63c8463231030ed1f"},
"live_view_events": {:hex, :live_view_events, "0.1.2", "cd8df6d330c1e5e376664e9bd924ea2272c6060d234019be3cb7579c1c562590", [:mix], [{:phoenix_live_view, "~> 0.19", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "d54cb2515698a548a7ec9cc8d36798fc4799a157e9344f10642c3f848a6a1174"},
"makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"},