1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

add "advanced" search functionality

This commit is contained in:
RaidMax
2023-01-23 16:38:16 -06:00
parent c961d4e953
commit 4c51d86fae
24 changed files with 771 additions and 44 deletions

View File

@ -862,7 +862,6 @@ namespace WebfrontCore.Controllers
private Dictionary<string, string> GetPresetPenaltyReasons() => _appConfig.PresetPenaltyReasons.Values
.Concat(_appConfig.GlobalRules)
.Concat(_appConfig.Servers.SelectMany(server => server.Rules ?? Array.Empty<string>()))
.Distinct()
.Select((value, _) => new
{
Value = value
@ -872,6 +871,7 @@ namespace WebfrontCore.Controllers
{
Value = ""
})
.Distinct()
.ToDictionary(item => item.Value, item => item.Value);
}
}

View File

@ -15,6 +15,7 @@ using Data.Models;
using SharedLibraryCore.Services;
using Stats.Config;
using WebfrontCore.Permissions;
using WebfrontCore.QueryHelpers.Models;
using WebfrontCore.ViewComponents;
namespace WebfrontCore.Controllers
@ -26,15 +27,19 @@ namespace WebfrontCore.Controllers
private readonly IGeoLocationService _geoLocationService;
private readonly ClientService _clientService;
private readonly IInteractionRegistration _interactionRegistration;
private readonly IResourceQueryHelper<ClientResourceRequest, ClientResourceResponse> _clientResourceHelper;
public ClientController(IManager manager, IMetaServiceV2 metaService, StatsConfiguration config,
IGeoLocationService geoLocationService, ClientService clientService, IInteractionRegistration interactionRegistration) : base(manager)
IGeoLocationService geoLocationService, ClientService clientService,
IInteractionRegistration interactionRegistration,
IResourceQueryHelper<ClientResourceRequest, ClientResourceResponse> clientResourceHelper) : base(manager)
{
_metaService = metaService;
_config = config;
_geoLocationService = geoLocationService;
_clientService = clientService;
_interactionRegistration = interactionRegistration;
_clientResourceHelper = clientResourceHelper;
}
[Obsolete]
@ -241,6 +246,17 @@ namespace WebfrontCore.Controllers
return View("Find/Index", clientsDto);
}
public async Task<IActionResult> AdvancedFind(ClientResourceRequest request)
{
ViewBag.Title = Localization["WEBFRONT_SEARCH_RESULTS_TITLE"];
ViewBag.ClientResourceRequest = request;
var response = await _clientResourceHelper.QueryResource(request);
return request.Offset > 0
? PartialView("Find/_AdvancedFindList", response.Results)
: View("Find/AdvancedFind", response.Results);
}
public IActionResult Meta(int id, int count, int offset, long? startAt, MetaType? metaFilterType,
CancellationToken token)
{