Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Add notes #147

Merged
merged 3 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions WHMapper.Tests/WHMapper.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageReference Include="Npgsql" Version="7.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
<PackageReference Include="Npgsql" Version="7.0.6" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Xunit.Priority" Version="1.1.6" />
</ItemGroup>
Expand Down
101 changes: 0 additions & 101 deletions WHMapper/Pages/Mapper/CustomNode/EveSystemNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,12 @@ namespace WHMapper.Pages.Mapper.CustomNode
{
public partial class EveSystemNode : ComponentBase
{
private const string MENU_LOCK_SYSTEM_VALUE = "Lock";
private const string MENU_UNLOCK_SYSTEM_VALUE = "Unlock";


private EveSystemNodeModel _node = null!;

private string _secColor = IWHColorHelper.DEFAULT_COLOR;
private string _systemColor = IWHColorHelper.DEFAULT_COLOR;
private string _whEffectColor = IWHColorHelper.DEFAULT_COLOR;
private string _menu_lock_value = MENU_LOCK_SYSTEM_VALUE;
private string _menu_lock_icon_value = Icons.Material.Sharp.Lock;


[Inject]
IEveAPIServices EveServices { get; set; } = null!;

[Inject]
IWHSystemRepository DbWHSystems { get; set; } = null!;

[Inject]
public ILogger<EveSystemNode> Logger { get; set; } = null!;
Expand All @@ -61,98 +49,9 @@ public EveSystemNodeModel Node
_secColor = WHColorHelper.GetSecurityStatusColor(_node.SecurityStatus);
_systemColor = WHColorHelper.GetSystemTypeColor(_node.SystemType);
_whEffectColor = WHColorHelper.GetEffectColor(_node.Effect);

Locked = _node.Locked;

}
}
}

private bool Locked
{
get
{
if (_node != null)
return _node.Locked;
else
return false;
}
set
{
if(_node!=null)
{
_node.Locked = value;

if (_node.Locked)
{
_menu_lock_value = MENU_UNLOCK_SYSTEM_VALUE;
_menu_lock_icon_value = Icons.Material.Sharp.LockOpen;
}
else
{
_menu_lock_value = MENU_LOCK_SYSTEM_VALUE;
_menu_lock_icon_value = Icons.Material.Sharp.Lock;
}
StateHasChanged();
}
}
}



private async Task<bool> SetSelectedSystemDestinationWaypoint()
{
try
{
if (_node.Selected)
{
var res = await EveServices.UserInterfaceServices.SetWaypoint(_node.SolarSystemId, false, true);
return true;

}

return false;
}
catch (Exception ex)
{
Logger.LogError(ex, "Set destination waypoint error");
return false;
}
}

private async Task<bool> ToggleSystemLock()
{
try
{
var whSystem = await DbWHSystems.GetById(_node.IdWH);
if (whSystem != null && whSystem.Id==_node.IdWH)
{
whSystem.Locked = !whSystem.Locked;
whSystem = await DbWHSystems.Update(whSystem.Id, whSystem);
if (whSystem == null)
{
Logger.LogError("Update lock system status error");
return false;
}

Locked = whSystem.Locked;
_node.Refresh();
return true;
}
else
{
return false;
}


}
catch (Exception ex)
{
Logger.LogError(ex, "Toggle destination waypoint error");
return false;
}

}
}
}

145 changes: 68 additions & 77 deletions WHMapper/Pages/Mapper/CustomNode/EveSystemNode.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,74 @@
@using WHMapper.Models.DTO.EveMapper.Enums;


<MudMenu PositionAtCursor="true" ActivationEvent="@MouseEvent.RightClick" Dense="true">
<ActivatorContent>
<MudCard Outlined="true" Style="@(Node.Selected ? "border-color:white;" : "border-color:grey;")">
<MudCardHeader Class="mb-n5">
<CardHeaderAvatar>
<MudBadge Origin="Origin.TopRight" Overlap="true" [email protected] Visible=@((Node.NameExtension!=null) ? true : false) Bordered="true" Color="Color.Dark">
<MudAvatar class="mt-1" Style="@($"color:{_systemColor}; border-color:{_systemColor}; font-weight:bold;")" Size="Size.Small" Variant="Variant.Outlined">@Node.SystemType.ToDescriptionString()</MudAvatar>
</MudBadge>
</CardHeaderAvatar>
<CardHeaderContent>
<MudText class="ml-n1 pr-2 mt-1" Typo="Typo.body2" Style="font-weight:bold;">@Node.Name</MudText>
</CardHeaderContent>
<CardHeaderActions>
@if (Locked)
{
<MudIcon Icon="@Icons.Material.Sharp.Lock" DisableElevation="true" Size="Size.Small" Style="margin-top:-3px" />
}
@if (Node != null && Node.Effect != WHMapper.Models.DTO.EveMapper.Enums.WHEffect.None)
{
<MudTooltip Text="@Node.Effect.ToString()" Arrow="true" Placement="Placement.Bottom">
<ChildContent>
<MudIcon Icon="@Icons.Material.Filled.Square" DisableElevation="true" Style="@($"color:{_whEffectColor};")" Size="Size.Small" />
</ChildContent>
<TooltipContent>
<MudPaper Class="d-flex flex-column flex-grow-1 gap-1" Elevation="0">
@foreach (var effectInfo in Node.EffectDetails)
{
<MudText class="ml-1 mr-1" Typo="Typo.caption">@effectInfo.Name. : @effectInfo.Value%</MudText>
}
</MudPaper>
</TooltipContent>
</MudTooltip>
}
</CardHeaderActions>
</MudCardHeader>

<MudCardContent Class="d-flex pa-1 pr-2 justify-space-between">
<div Class="d-flex justify-start">
@if (Node != null && Node.ConnectedUsers != null && Node.ConnectedUsers.FirstOrDefault() != null)
{
<MudTooltip Typo="Typo.caption" Arrow="true" Placement="Placement.Bottom">
<ChildContent>
<MudIcon Icon="@Icons.Material.Filled.Group" Color=Color.Default Size="Size.Small" />
</ChildContent>
<TooltipContent>
<MudPaper Class="d-flex flex-column flex-grow-1 gap-1" Elevation="0">
@foreach (var user in @Node.ConnectedUsers)
{
<MudText class="ml-1 mr-1" Typo="Typo.caption">@user</MudText>
}
</MudPaper>
</TooltipContent>
</MudTooltip>
}
else
{
<MudIcon Icon="@Icons.Material.Filled.Group" Color=Color.Transparent Size="Size.Small" />
}
<MudText Class="align-self-stretch ml-1 mt-1" Typo="Typo.caption">@Node?.ConnectedUsers.FirstOrDefault()</MudText>
</div>
<div Class="d-flex justify-end">
@if (Node != null && Node.Statics != null && Node?.Statics.Count() > 0)
{
@foreach (var item in Node.Statics)
{
<MudText Class="align-self-stretch mt-1 ml-1" Typo="Typo.body2" Style="@($"color:{WHColorHelper.GetSystemTypeColor(@item.EveSystemDestinationType)};")">@item.EveSystemDestinationType.ToString()</MudText>
}
}
</div>
</MudCardContent>
</MudCard>
</ActivatorContent>
<ChildContent>
<MudMenuItem OnClick="@(() =>SetSelectedSystemDestinationWaypoint())" Icon="@Icons.Material.Sharp.FlagCircle" Size="Size.Small">Set Destination</MudMenuItem>
<MudMenuItem OnClick="@(() =>ToggleSystemLock())" Icon="@_menu_lock_icon_value" Size="Size.Small">@_menu_lock_value</MudMenuItem>
</ChildContent>
</MudMenu>

<MudCard Outlined="true" Style="@(Node.Selected ? "border-color:white;" : "border-color:grey;")">
<MudCardHeader Class="mb-n5">
<CardHeaderAvatar>
<MudBadge Origin="Origin.TopRight" Overlap="true" [email protected] Visible=@((Node.NameExtension!=null) ? true : false) Bordered="true" Color="Color.Dark">
<MudAvatar class="mt-1" Style="@($"color:{_systemColor}; border-color:{_systemColor}; font-weight:bold;")" Size="Size.Small" Variant="Variant.Outlined">@Node.SystemType.ToDescriptionString()</MudAvatar>
</MudBadge>
</CardHeaderAvatar>
<CardHeaderContent>
<MudText class="ml-n1 pr-2 mt-1" Typo="Typo.body2" Style="font-weight:bold;">@Node.Name</MudText>
</CardHeaderContent>
<CardHeaderActions>
@if (_node.Locked)
{
<MudIcon Icon="@Icons.Material.Sharp.Lock" DisableElevation="true" Size="Size.Small" Style="margin-top:-3px" />
}
@if (Node != null && Node.Effect != WHMapper.Models.DTO.EveMapper.Enums.WHEffect.None)
{
<MudTooltip Text="@Node.Effect.ToString()" Arrow="true" Placement="Placement.Bottom">
<ChildContent>
<MudIcon Icon="@Icons.Material.Filled.Square" DisableElevation="true" Style="@($"color:{_whEffectColor};")" Size="Size.Small" />
</ChildContent>
<TooltipContent>
<MudPaper Class="d-flex flex-column flex-grow-1 gap-1" Elevation="0">
@foreach (var effectInfo in Node.EffectDetails)
{
<MudText class="ml-1 mr-1" Typo="Typo.caption">@effectInfo.Name. : @effectInfo.Value%</MudText>
}
</MudPaper>
</TooltipContent>
</MudTooltip>
}
</CardHeaderActions>
</MudCardHeader>

<MudCardContent Class="d-flex pa-1 pr-2 justify-space-between">
<div Class="d-flex justify-start">
@if (Node != null && Node.ConnectedUsers != null && Node.ConnectedUsers.FirstOrDefault() != null)
{
<MudTooltip Typo="Typo.caption" Arrow="true" Placement="Placement.Bottom">
<ChildContent>
<MudIcon Icon="@Icons.Material.Filled.Group" Color=Color.Default Size="Size.Small" />
</ChildContent>
<TooltipContent>
<MudPaper Class="d-flex flex-column flex-grow-1 gap-1" Elevation="0">
@foreach (var user in @Node.ConnectedUsers)
{
<MudText class="ml-1 mr-1" Typo="Typo.caption">@user</MudText>
}
</MudPaper>
</TooltipContent>
</MudTooltip>
}
else
{
<MudIcon Icon="@Icons.Material.Filled.Group" Color=Color.Transparent Size="Size.Small" />
}
<MudText Class="align-self-stretch ml-1 mt-1" Typo="Typo.caption">@Node?.ConnectedUsers.FirstOrDefault()</MudText>
</div>
<div Class="d-flex justify-end">
@if (Node != null && Node.Statics != null && Node?.Statics.Count() > 0)
{
@foreach (var item in Node.Statics)
{
<MudText Class="align-self-stretch mt-1 ml-1" Typo="Typo.body2" Style="@($"color:{WHColorHelper.GetSystemTypeColor(@item.EveSystemDestinationType)};")">@item.EveSystemDestinationType.ToString()</MudText>
}
}
</div>
</MudCardContent>
</MudCard>

Loading
Loading