Added custom search functionality
This commit is contained in:
33
.idea/.idea.HopFrame/.idea/workspace.xml
generated
33
.idea/.idea.HopFrame/.idea/workspace.xml
generated
@@ -11,11 +11,12 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="Added plugin buttons">
|
||||
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/testing/HopFrame.Testing/TestPlugin.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/PageInitializedEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/TableInitializedEvent.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/IPluginOrchestrator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/IPluginOrchestrator.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/SearchEvent.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/Plugins/Events/SearchEvent.cs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/testing/HopFrame.Testing/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/testing/HopFrame.Testing/Program.cs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -35,7 +36,7 @@
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="dev" />
|
||||
<entry key="$PROJECT_DIR$" value="feature/plugins" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
@@ -84,6 +85,7 @@
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/adcd2c45092dd8e4fc412325c8adb75d6e7d8b3e90a9523f167583fb9c60/ServiceCollectionExtensions.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/b3ccb66df3646cb51df73ad51716136ebd2eefb4edb1308dd52a7e999582d59e/IBindableColumn.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/bfff78ecaa39c818519fc918bb2d4bbdca6ad93d7170f5cf325f67ccd0b97d43/BooleanAsserts.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/d0165cb640e16fb3b8fe6932c042fc2917cd7f2770ff123cf7b9d11b5bfc6/Task.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/d04a416cac8afac0341a8be0e859b230f2eae64924298eef48c317ba35916/RenderTreeBuilder.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/d39923abb31e6a6e7a9e8173e217da584c54925ce63e568126a2b89b9ab/DefaultRazorComponentsServiceOptionsConfiguration.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/d858ddb35a8e36df5573b7612542f9ad50f426b8ab43818587d1ac65fab14829/DatabaseGeneratedAttribute.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
@@ -96,6 +98,8 @@
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/fd57398b7dc3a8ce7da2786f2c67289c3d974658a9e90d0c1e84db3d965fbf1/Console.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/ff37d54b3bf4d2756237fb789635831532603376e940f63d634b869d26d74c/Regular16.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="file://$PROJECT_DIR$/src/HopFrame.Core/Config/DbContextConfig.cs" root0="FORCE_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor" root0="SKIP_HIGHLIGHTING" root1="FORCE_HIGHLIGHTING" root2="FORCE_HIGHLIGHTING" />
|
||||
<setting file="mock://C:/Users/leon/Documents/Projekte/HopFrame/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs" root0="SKIP_HIGHLIGHTING" />
|
||||
</component>
|
||||
<component name="KubernetesApiPersistence">{}</component>
|
||||
<component name="KubernetesApiProvider">{
|
||||
@@ -125,7 +129,7 @@
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"b5f11219-dfc4-47a1-b02c-90ab603034fb.executor": "Debug",
|
||||
"dcdf1689-dc07-47e4-8824-2e60a4fbf301.executor": "Debug",
|
||||
"git-widget-placeholder": "!30 on feature/plugins",
|
||||
"git-widget-placeholder": "dev",
|
||||
"list.type.of.created.stylesheet": "CSS",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
@@ -239,7 +243,8 @@
|
||||
<workItem from="1738421294144" duration="1651000" />
|
||||
<workItem from="1738422949337" duration="141000" />
|
||||
<workItem from="1738512801911" duration="6776000" />
|
||||
<workItem from="1738769458367" duration="4838000" />
|
||||
<workItem from="1738769458367" duration="5256000" />
|
||||
<workItem from="1738774834563" duration="361000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Added basic configuration">
|
||||
<option name="closed" value="true" />
|
||||
@@ -553,7 +558,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1738773315593</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="40" />
|
||||
<task id="LOCAL-00040" summary="Added default button removal feature">
|
||||
<option name="closed" value="true" />
|
||||
<created>1738774569657</created>
|
||||
<option name="number" value="00040" />
|
||||
<option name="presentableId" value="LOCAL-00040" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1738774569657</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="41" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -604,7 +617,6 @@
|
||||
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||
<MESSAGE value="Addressed all build warnings" />
|
||||
<MESSAGE value="Added documentation for the configurators and service extensions methods" />
|
||||
<MESSAGE value="Created tests for the core module" />
|
||||
<MESSAGE value="Added more tests" />
|
||||
@@ -629,6 +641,7 @@
|
||||
<MESSAGE value="Added plugin events" />
|
||||
<MESSAGE value="Passed cancellation tokens to event handlers if needed" />
|
||||
<MESSAGE value="Added plugin buttons" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added plugin buttons" />
|
||||
<MESSAGE value="Added default button removal feature" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added default button removal feature" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -239,9 +239,16 @@
|
||||
|
||||
var eventResult = await PluginOrchestrator.DispatchEvent(new SearchEvent(this) {
|
||||
SearchTerm = _searchTerm,
|
||||
Table = _config!
|
||||
Table = _config!,
|
||||
CurrentPage = _currentPage
|
||||
}, _tokenSource.Token);
|
||||
if (eventResult.IsCanceled) return;
|
||||
if (eventResult.IsCanceled) {
|
||||
if (eventResult.SearchResult is null) return;
|
||||
|
||||
CurrentlyDisplayedModels = eventResult.SearchResult.ToArray();
|
||||
_totalPages = eventResult.TotalPages;
|
||||
return;
|
||||
}
|
||||
_searchTerm = eventResult.SearchTerm;
|
||||
|
||||
await Reload();
|
||||
@@ -259,7 +266,7 @@
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_searchTerm)) {
|
||||
(var query, _totalPages) = await _manager!.Search(_searchTerm, 0, PerPage);
|
||||
(var query, _totalPages) = await _manager!.Search(_searchTerm, _currentPage, PerPage);
|
||||
CurrentlyDisplayedModels = query.ToArray();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
using HopFrame.Web.Components.Pages;
|
||||
using System.Collections;
|
||||
using HopFrame.Web.Components.Pages;
|
||||
|
||||
namespace HopFrame.Web.Plugins.Events;
|
||||
|
||||
public sealed class SearchEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
|
||||
public required string SearchTerm { get; set; }
|
||||
public required int CurrentPage { get; init; }
|
||||
internal IEnumerable<object>? SearchResult { get; set; }
|
||||
internal int TotalPages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the new search result that is being displayed<br />
|
||||
/// The event needs to be canceled in order for the custom search results to appear
|
||||
/// </summary>
|
||||
/// <param name="result">The current page of search results</param>
|
||||
/// <param name="totalPages">The total pages of search results</param>
|
||||
public void SetSearchResult(IEnumerable result, int totalPages) {
|
||||
SearchResult = result.OfType<object>();
|
||||
TotalPages = totalPages;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user