mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-02 15:37:03 +00:00
Compare commits
3 Commits
v1.75.11
...
auto-delet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe64c27e85 | ||
|
|
4ec7b40eb7 | ||
|
|
9fab757bea |
@@ -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)}
|
||||
|
||||
@@ -67,8 +67,7 @@ defmodule WandererApp.Api.MapSystemSignature do
|
||||
:name,
|
||||
:description,
|
||||
:kind,
|
||||
:group,
|
||||
:linked_system_id
|
||||
:group
|
||||
]
|
||||
|
||||
primary? true
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -721,6 +721,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
%{
|
||||
assigns: %{
|
||||
map_id: map_id,
|
||||
map_user_settings: map_user_settings,
|
||||
user_characters: user_characters,
|
||||
user_permissions: %{update_system: true}
|
||||
}
|
||||
@@ -754,9 +755,23 @@ defmodule WandererAppWeb.MapLive do
|
||||
|> parse_signatures(first_character_eve_id, system.id)
|
||||
|> Enum.map(fn s -> s.eve_id end)
|
||||
|
||||
delete_connection_with_sigs =
|
||||
map_user_settings
|
||||
|> WandererApp.MapUserSettingsRepo.to_form_data!()
|
||||
|> WandererApp.MapUserSettingsRepo.get_boolean_setting("delete_connection_with_sigs")
|
||||
|
||||
WandererApp.Api.MapSystemSignature.by_system_id!(system.id)
|
||||
|> Enum.filter(fn s -> s.eve_id in removed_signatures_eve_ids end)
|
||||
|> Enum.each(fn s ->
|
||||
|
||||
if delete_connection_with_sigs && not is_nil(s.linked_system_id) do
|
||||
map_id
|
||||
|> WandererApp.Map.Server.delete_connection(%{
|
||||
solar_system_source_id: solar_system_id |> String.to_integer(),
|
||||
solar_system_target_id: s.linked_system_id
|
||||
})
|
||||
end
|
||||
|
||||
s
|
||||
|> Ash.destroy!()
|
||||
end)
|
||||
@@ -1216,7 +1231,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
) do
|
||||
settings =
|
||||
user_settings_form
|
||||
|> Map.take(["select_on_spash", "link_signature_on_splash"])
|
||||
|> Map.take(["select_on_spash", "link_signature_on_splash", "delete_connection_with_sigs"])
|
||||
|> Jason.encode!()
|
||||
|
||||
{:ok, user_settings} =
|
||||
|
||||
Reference in New Issue
Block a user