small tweaks for notes/tags

This commit is contained in:
RaidMax 2022-07-20 11:39:46 -05:00
parent d2cfd50e39
commit 507688a175
4 changed files with 9 additions and 8 deletions

View File

@ -31,7 +31,7 @@ public class AddClientNoteCommand : Command
new CommandArgument new CommandArgument
{ {
Name = _translationLookup["COMMANDS_ARGS_NOTE"], Name = _translationLookup["COMMANDS_ARGS_NOTE"],
Required = true Required = false
} }
}; };

View File

@ -598,20 +598,20 @@ namespace WebfrontCore.Controllers
public async Task<IActionResult> SetClientTagForm(int id, CancellationToken token) public async Task<IActionResult> SetClientTagForm(int id, CancellationToken token)
{ {
var tags = await _metaService.GetPersistentMetaValue<List<LookupValue<string>>>(EFMeta.ClientTagNameV2, var tags = await _metaService.GetPersistentMetaValue<List<LookupValue<string>>>(EFMeta.ClientTagNameV2,
token); token) ?? new List<LookupValue<string>>();
var existingTag = await _metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2, var existingTag = await _metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2,
EFMeta.ClientTagNameV2, id, Manager.CancellationToken); EFMeta.ClientTagNameV2, id, Manager.CancellationToken);
var info = new ActionInfo var info = new ActionInfo
{ {
ActionButtonLabel = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_SUBMIT"], ActionButtonLabel = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_TITLE"], Name = Localization["WEBFRONT_PROFILE_CONTEXT_MENU_TAG"],
Inputs = new List<InputInfo> Inputs = new List<InputInfo>
{ {
new() new()
{ {
Name = "clientTag", Name = "clientTag",
Type = "select", Type = "select",
Label = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_TITLE"], Label = Localization["WEBFRONT_ACTION_SET_CLIENT_TAG_FORM_TAG"],
Values = tags.ToDictionary( Values = tags.ToDictionary(
item => item.Value == existingTag?.Value ? $"!selected!{item.Value}" : item.Value, item => item.Value == existingTag?.Value ? $"!selected!{item.Value}" : item.Value,
item => item.Value) item => item.Value)

View File

@ -57,7 +57,6 @@ namespace WebfrontCore.Controllers
_metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2, EFMeta.ClientTagNameV2, client.ClientId, _metaService.GetPersistentMetaByLookup(EFMeta.ClientTagV2, EFMeta.ClientTagNameV2, client.ClientId,
token), token),
_metaService.GetPersistentMeta("GravatarEmail", client.ClientId, token), _metaService.GetPersistentMeta("GravatarEmail", client.ClientId, token),
}; };
var persistentMeta = await Task.WhenAll(persistentMetaTask); var persistentMeta = await Task.WhenAll(persistentMetaTask);
@ -71,7 +70,7 @@ namespace WebfrontCore.Controllers
client.SetAdditionalProperty(EFMeta.ClientTagV2, tag.Value); client.SetAdditionalProperty(EFMeta.ClientTagV2, tag.Value);
} }
if (note is not null) if (!string.IsNullOrWhiteSpace(note?.Note))
{ {
note.OriginEntityName = await _clientService.GetClientNameById(note.OriginEntityId); note.OriginEntityName = await _clientService.GetClientNameById(note.OriginEntityId);
} }
@ -135,7 +134,7 @@ namespace WebfrontCore.Controllers
ingameClient.CurrentServer.Port), ingameClient.CurrentServer.Port),
CurrentServerName = ingameClient?.CurrentServer?.Hostname, CurrentServerName = ingameClient?.CurrentServer?.Hostname,
GeoLocationInfo = await _geoLocationService.Locate(client.IPAddressString), GeoLocationInfo = await _geoLocationService.Locate(client.IPAddressString),
NoteMeta = note NoteMeta = string.IsNullOrWhiteSpace(note?.Note) ? null: note
}; };
var meta = await _metaService.GetRuntimeMeta<InformationResponse>(new ClientPaginationRequest var meta = await _metaService.GetRuntimeMeta<InformationResponse>(new ClientPaginationRequest

View File

@ -184,7 +184,9 @@
<div class="text-force-break">@line.TrimEnd('\r')</div> <div class="text-force-break">@line.TrimEnd('\r')</div>
} }
<div class="mt-5"> <div class="mt-5">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.NoteMeta.OriginEntityId" class="no-decoration ">@Model.NoteMeta.OriginEntityName</a> <a asp-controller="Client" asp-action="Profile" asp-route-id="@Model.NoteMeta.OriginEntityId" class="no-decoration ">
<color-code value="@Model.NoteMeta.OriginEntityName"></color-code>
</a>
<span>&mdash; @Model.NoteMeta.ModifiedDate.HumanizeForCurrentCulture()</span> <span>&mdash; @Model.NoteMeta.ModifiedDate.HumanizeForCurrentCulture()</span>
</div> </div>
</div> </div>