+
diff --git a/TELBlazor.Components.ShowCase.Shared/Pages/Error.razor b/TELBlazor.Components.ShowCase.Shared/Pages/Error.razor index 4248f90..36c62e9 100644 --- a/TELBlazor.Components.ShowCase.Shared/Pages/Error.razor +++ b/TELBlazor.Components.ShowCase.Shared/Pages/Error.razor @@ -1,4 +1,6 @@ ο»Ώ@page "/Error/" -This error has taken you to the ocean! ... +Error Image Finn Ocean \ No newline at end of file diff --git a/TELBlazor.Components.ShowCase.Shared/Pages/NoJSFormSubmitStubPage.razor b/TELBlazor.Components.ShowCase.Shared/Pages/NoJSFormSubmitStubPage.razor new file mode 100644 index 0000000..48d32a5 --- /dev/null +++ b/TELBlazor.Components.ShowCase.Shared/Pages/NoJSFormSubmitStubPage.razor @@ -0,0 +1,12 @@ +ο»Ώ@page "/nojsformsubmitstubpage" + +

Welcome to nojsformsubmitstubpage

+

NoJS form submit stub page, if your here your in a nojs browser or clicked quick on a prerender hosting of the page, + testing can catch the request before it gets here and check the data being sent is correct before redirection happens. +

+

but if you're not here because of the about then something went wrong...

+

Welcome to the ocean!

+Error Image Finn Ocean + diff --git a/TELBlazor.Components.ShowCase.Shared/Pages/OptionalImplementations/TestComponentPages/SearchExperimentPage.razor b/TELBlazor.Components.ShowCase.Shared/Pages/OptionalImplementations/TestComponentPages/SearchExperimentPage.razor index 4e3352d..24f8e14 100644 --- a/TELBlazor.Components.ShowCase.Shared/Pages/OptionalImplementations/TestComponentPages/SearchExperimentPage.razor +++ b/TELBlazor.Components.ShowCase.Shared/Pages/OptionalImplementations/TestComponentPages/SearchExperimentPage.razor @@ -4,12 +4,21 @@ Instructions="@Instructions" Description="@Description" IsTestComponent="@IsTestComponent"> - + +

qqqq put a readme link or markdig section per component here in future

@code { private bool IsTestComponent => true; private string Title => "SearchExperiment"; - private string Instructions => "Try searching"; + private string Instructions => "Try searching: ⚠️ Warning: This is a test element. It is only hitting the suggestion endpoint currently for searches and for suggestions, as that is all that is available. Suggestions shown won’t necessarily lead to effective or relevant search results."; private string Description => "This is not a prototype for the new search component its a test component just for a component needing a service only"; + private string NoJSSearchText = "Example previous nojs search"; + private string NoJSActionUrl = "/nojsformsubmitstubpage"; + private List NoJSSearchResults = new List() {"In a nojs browser", " the user would first get a blanks components ", " they then send their data", " the Controller would provide","this static info back", "including original provideds search", "having used the same service", "serverside in its controller"}; + private List NoJSSuggestions = new List() {"Unsure if this would work ","it might do but we wouldnt", " want to spam a page reload per button press ", " so maybe there would be different suggestions in nojs" }; + } diff --git a/TELBlazor.Components.ShowCase.Shared/Utilities/JSDisabledWarning.razor b/TELBlazor.Components.ShowCase.Shared/Utilities/JSDisabledWarning.razor new file mode 100644 index 0000000..667a1b3 --- /dev/null +++ b/TELBlazor.Components.ShowCase.Shared/Utilities/JSDisabledWarning.razor @@ -0,0 +1,3 @@ +ο»Ώ \ No newline at end of file diff --git a/TELBlazor.Components.ShowCase.Shared/_Imports.razor b/TELBlazor.Components.ShowCase.Shared/_Imports.razor index a54e1eb..62c1560 100644 --- a/TELBlazor.Components.ShowCase.Shared/_Imports.razor +++ b/TELBlazor.Components.ShowCase.Shared/_Imports.razor @@ -11,8 +11,9 @@ @using TELBlazor.Components.Core.Extensions @using Microsoft.AspNetCore.Components.Forms @using TELBlazor.Components.Components.BaseComponents -@using TELBlazor.Components.OptionalImplementations.TestComponents +@using TELBlazor.Components.OptionalImplementations.Test.TestComponents @using Microsoft.Extensions.Logging; @using Microsoft.AspNetCore.Components.Routing @using TELBlazor.Components.ShowCase.Shared.Layouts.ComponentLayouts -@using TELBlazor.Components.OptionalImplementations.TestComponents.SearchExperiment +@using TELBlazor.Components.OptionalImplementations.Test.TestComponents.SearchExperiment +@using TELBlazor.Components.ShowCase.Shared.Utilities diff --git a/TELBlazor.Components.ShowCase.WasmStaticClient/Program.cs b/TELBlazor.Components.ShowCase.WasmStaticClient/Program.cs index 143e35f..9387134 100644 --- a/TELBlazor.Components.ShowCase.WasmStaticClient/Program.cs +++ b/TELBlazor.Components.ShowCase.WasmStaticClient/Program.cs @@ -1,35 +1,31 @@ // Microsoft namespaces +// Still required server side even if not used so components dont fail +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.DependencyInjection; - // Serilog core (used via appsettings, do not delete even if vs marks not in use) using Serilog; using Serilog.Configuration; using Serilog.Core; using Serilog.Events; - // Serilog extensions and sinks (used via appsettings, do not delete even if vs marks not in use) using Serilog.Extensions.Logging; using Serilog.Formatting.Compact; using Serilog.Settings.Configuration; using Serilog.Sinks.BrowserConsole; - -// Still required server side even if not used so components dont fail -using Blazored.LocalStorage; - // TELBlazor components using TELBlazor.Components.Core.Configuration; using TELBlazor.Components.Core.Services.HelperServices; - -using TELBlazor.Components.ShowCase.WasmStaticClient; +using TELBlazor.Components.OptionalImplementations.Core.DI; using TELBlazor.Components.OptionalImplementations.Core.Services.HelperServices; +using TELBlazor.Components.ShowCase.WasmStaticClient; var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -78,7 +74,7 @@ builder.Services.AddScoped(sp => levelSwitch); builder.Services.AddScoped(); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - + builder.Services.AddTELBlazorComponentServicesForTestComponents(); await builder.Build().RunAsync(); } catch (Exception ex) diff --git a/TELBlazor.Components.ShowCase.WasmStaticClient/packages.lock.json b/TELBlazor.Components.ShowCase.WasmStaticClient/packages.lock.json index a5fc1e5..e3f0b36 100644 --- a/TELBlazor.Components.ShowCase.WasmStaticClient/packages.lock.json +++ b/TELBlazor.Components.ShowCase.WasmStaticClient/packages.lock.json @@ -76,15 +76,15 @@ }, "Microsoft.NET.ILLink.Tasks": { "type": "Direct", - "requested": "[8.0.16, )", - "resolved": "8.0.16", - "contentHash": "0H1QaKpVibe++Zx6EYJQGhrpfz2bBPGiQ7Rpsmx8I3+oKv+ZRRIfVfmcj50KuZlhhRE6V02y5bUjP+V2oPM2ng==" + "requested": "[8.0.17, )", + "resolved": "8.0.17", + "contentHash": "x5/y4l8AtshpBOrCZdlE4txw8K3e3s9meBFeZeR3l8hbbku2V7kK6ojhXvrbjg1rk3G+JqL1BI26gtgc1ZrdUw==" }, "Microsoft.NET.Sdk.WebAssembly.Pack": { "type": "Direct", - "requested": "[8.0.16, )", - "resolved": "8.0.16", - "contentHash": "Lu5e8iqQzLnMrD0WmHz6yw7EEauaP9Ip5RxtZgSmi1GhcymZvL1MU6vFerVHbT+FPuqHSlEyM3rXtcQE8NElAw==" + "requested": "[8.0.17, )", + "resolved": "8.0.17", + "contentHash": "wufm5kIsP5PlG54bahrhJDPbN114ru7mIYOdyVQS4sCr3811SLqcn1X6rg3mxZgGxRbyfMcMBXcg5P2HV/MRYQ==" }, "Serilog": { "type": "Direct", @@ -463,7 +463,7 @@ "Blazored.LocalStorage": "[4.5.0, )", "Microsoft.AspNetCore.Components.Web": "[8.0.14, )", "Serilog": "[4.2.0, )", - "TELBlazor.Components": "[1.8.0, )" + "TELBlazor.Components": "[1.9.2-local, )" } }, "Microsoft.AspNetCore.Components.Web": { diff --git a/TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json.template b/TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json.template index 91a07f1..9508ceb 100644 --- a/TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json.template +++ b/TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json.template @@ -1,5 +1,10 @@ ο»Ώ{ "APIs": { + /*Not in production there needs to be a specific soluton for security*/ + "SearchApi": { + "BaseUrl": "https://lh-openapi.dev.local", + "BearerToken": "your_token_here" + } }, "Serilog": { diff --git a/TELBlazor.Components.UnitTests/_Imports.razor b/TELBlazor.Components.UnitTests/_Imports.razor index d70747a..97cfa9b 100644 --- a/TELBlazor.Components.UnitTests/_Imports.razor +++ b/TELBlazor.Components.UnitTests/_Imports.razor @@ -28,7 +28,7 @@ // Unit tests @using TELBlazor.Components.UnitTests.DI -@using TELBlazor.Components.OptionalImplementations.TestComponents +@using TELBlazor.Components.OptionalImplementations.Test.TestComponents @using TELBlazor.Components.Core.Enums @using TELBlazor.Components.Core.Extensions diff --git a/TELBlazor.Components/Components/BaseComponents/TELButton.razor b/TELBlazor.Components/Components/BaseComponents/TELButton.razor index 867626c..82046c9 100644 --- a/TELBlazor.Components/Components/BaseComponents/TELButton.razor +++ b/TELBlazor.Components/Components/BaseComponents/TELButton.razor @@ -55,7 +55,7 @@ else /// [Parameter] public bool IsSubmitButtonForEditForm { get; set; } = false; [Parameter] public Dictionary FormData { get; set; } = new(); - [EditorRequired, Parameter] public required string NoJSActionUrl { get; set; } // URL for the form submission + [Parameter] public string NoJSActionUrl { get; set; } = null; // URL for the form submission (not required because there may be a parent form with it if its a submit for a form) [Parameter] public EventCallback OnClick { get; set; } // Not required because the submit wont use it, when its placed in a form. [Parameter] public bool PreventDoubleClick { get; set; } = false; // View Component equivalent behaviour diff --git a/TELBlazor.Components/OptionalImplementations/Core/DI/DI.cs b/TELBlazor.Components/OptionalImplementations/Core/DI/DI.cs index ecf309d..72edd36 100644 --- a/TELBlazor.Components/OptionalImplementations/Core/DI/DI.cs +++ b/TELBlazor.Components/OptionalImplementations/Core/DI/DI.cs @@ -9,11 +9,13 @@ using System.Text; using System.Threading.Tasks; using TELBlazor.Components.Core.Configuration; +using TELBlazor.Components.OptionalImplementations.Test.TestComponents.SearchExperiment; namespace TELBlazor.Components.OptionalImplementations.Core.DI { public static class DI { + private static IServiceCollection AddTELBlazorComponentServicessShared(this IServiceCollection services, ITELBlazorBaseComponentConfiguration TELBlazorBaseComponentConfiguration ) @@ -34,5 +36,12 @@ ITELBlazorBaseComponentConfiguration TELBlazorBaseComponentConfiguration { throw new NotImplementedException("This method is not implemented yet. See DI task"); } + public static IServiceCollection AddTELBlazorComponentServicesForTestComponents(this IServiceCollection services) + { + services.AddHttpClient(); + services.AddScoped(); + return services; + } + } } diff --git a/TELBlazor.Components/OptionalImplementations/TestComponents/CssSourceChecker.razor b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/CssSourceChecker.razor similarity index 100% rename from TELBlazor.Components/OptionalImplementations/TestComponents/CssSourceChecker.razor rename to TELBlazor.Components/OptionalImplementations/Test/TestComponents/CssSourceChecker.razor diff --git a/TELBlazor.Components/OptionalImplementations/TestComponents/CssSourceChecker.razor.css b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/CssSourceChecker.razor.css similarity index 100% rename from TELBlazor.Components/OptionalImplementations/TestComponents/CssSourceChecker.razor.css rename to TELBlazor.Components/OptionalImplementations/Test/TestComponents/CssSourceChecker.razor.css diff --git a/TELBlazor.Components/OptionalImplementations/TestComponents/LogLevelSwitcher.razor b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/LogLevelSwitcher.razor similarity index 100% rename from TELBlazor.Components/OptionalImplementations/TestComponents/LogLevelSwitcher.razor rename to TELBlazor.Components/OptionalImplementations/Test/TestComponents/LogLevelSwitcher.razor diff --git a/TELBlazor.Components/OptionalImplementations/TestComponents/SearchExperiment/DummyData.cs b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/DummyData.cs similarity index 97% rename from TELBlazor.Components/OptionalImplementations/TestComponents/SearchExperiment/DummyData.cs rename to TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/DummyData.cs index 23d70e4..ac565b4 100644 --- a/TELBlazor.Components/OptionalImplementations/TestComponents/SearchExperiment/DummyData.cs +++ b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/DummyData.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace TELBlazor.Components.OptionalImplementations.TestComponents.SearchExperiment +namespace TELBlazor.Components.OptionalImplementations.Test.TestComponents.SearchExperiment { public static class DummyData { diff --git a/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/ISearchExperimentService.cs b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/ISearchExperimentService.cs new file mode 100644 index 0000000..9de77ec --- /dev/null +++ b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/ISearchExperimentService.cs @@ -0,0 +1,53 @@ +ο»Ώusing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TELBlazor.Components.OptionalImplementations.Test.TestComponents.SearchExperiment +{ + public interface ISearchExperimentService + { + + /// + /// Gets search suggestions for a term + /// + /// The search term + /// Cancellation token + /// List of suggestion strings + public Task> GetSuggestionsAsync(string term, CancellationToken cancellationToken = default); + + /// + /// Performs a search and returns results + /// + /// The search term + /// Cancellation token + /// List of search result strings + public Task> SearchAsync(string searchTerm, CancellationToken cancellationToken = default); + } + + ///// + ///// Extended search service interface for more advanced scenarios + ///// If you need more complex results, implement this instead + ///// + //public interface IAdvancedSearchService + //{ + // /// + // /// Gets search suggestions with metadata + // /// + // /// The search term + // /// Cancellation token + // /// Search suggestions with metadata + // Task GetSuggestionsAsync(string term, CancellationToken cancellationToken = default); + + // /// + // /// Performs a search with pagination and filtering + // /// + // /// The search request + // /// Cancellation token + // /// Paginated search results + // Task SearchAsync(SearchRequest request, CancellationToken cancellationToken = default); + //} + + +} diff --git a/TELBlazor.Components/OptionalImplementations/TestComponents/SearchExperiment/SearchExperiment.razor b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/SearchExperiment.razor similarity index 68% rename from TELBlazor.Components/OptionalImplementations/TestComponents/SearchExperiment/SearchExperiment.razor rename to TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/SearchExperiment.razor index 9bfcdb5..8d7470d 100644 --- a/TELBlazor.Components/OptionalImplementations/TestComponents/SearchExperiment/SearchExperiment.razor +++ b/TELBlazor.Components/OptionalImplementations/Test/TestComponents/SearchExperiment/SearchExperiment.razor @@ -5,8 +5,11 @@ @inherits TELComponentBase - + + + @inject NavigationManager NavigationManager +@inject ISearchExperimentService searchExperimentService @* @implements IDisposable *@ @using static DummyData