Given that ABP promotes a modular solution, it seems logical that each module should handle its own dependencies and initializations since the modules are supposed to be able to be added/removed to/from a solution without much change to the solution. Ideally, the only change when adding/removing a module, would be to add the project/package reference and add the AbpModule of the module's project to the DependsOnAttribute of the solution's projects.
However, the ABP project templates for the solutions indicate that the main application project is responsible for initializing or managing many dependencies of the UI layer.
I want to build a Blazor WebApp application with many modules. Each module is responsible for a business domain and has its own models, logic and UI. Modules may depend on other modules (no circular dependencies obviously). Now I need to implement some components in one of the modules.
What I want: I want to open the module solution, implement the UI component and use a test UI project to see the component and test it. I want the project that implements the UI component to contain and initialize any 3rd party library it may use to develop the component.
Problems:
I want to create a minimal Blazor Web App project (with the purpose of testing a module's UI components). I have already created something that works and uses the module's test projects to set up the back-end ("module" means a DDD Web App module created from ABP Studio)
My server project has the following packages: Volo.Abp.AspNetCore.Mvc.UI.Bundling Volo.Abp.AspNetCore.Serilog Volo.Abp.Autofac Volo.Abp.AspNetCore.Components.Web Volo.Abp.AspNetCore.Components.Web.Theming Volo.Abp.AutoMapper as well as any other packages that the test projects and the source projects of the module have.
In order to test components that use basic services like IBlockUiService and INotificationService, I discovered that I need to add some bundles (js and css) to the minimal project. However, the documentation is unclear on what is needed to be included. At first I thought that I should just include the npm package "@abp/core". This did not work as apparently the abp.ui.block function in abp.js is not the same as what the IBlockUiService expects.
So I searched for any bundles that should be included in App.razor to make the basic ABP functionality work. Sadly, the documentation only mentions that the themes have global bundles and I do not have a theme in my minimal project. By searching ABP's project templates, I discovered the BlazorStandardBundles and BlazorWebAssemblyStandardBundles. If I include the BlazorStandardBundles in my App.razor, IBlockUiService at least works. INotificationService probably expects Blazorise to be initialized?
So, my questions are:
The AI basically reiterated what I said. I don't have a _Host.cshtml in a Blazor Web App project and the .AddBlazorise is already done by Volo.Abp.BlazoriseUI. AddBootstrapProviders() and AddFontAwesomeIcons() are not done, but wouldn't they be done if BlazoriseUI needed them?
Please answer again to my original questions.
I sent a project. You can switch between the commented lines for different results of the test. Without the BlazorStandardBundles, calling IBlockUiService and IUiNotificationService produces exceptions. With the BlazorStandardBundles, IBlockUiService works correctly, but IUiNotificationService does nothing.
private void ConfigureBundles()
{
//Create the global bundle
Configure<AbpBundlingOptions>(options =>
{
options.StyleBundles
.Add("MyGlobalBundle");
//options.StyleBundles
// .Add("MyGlobalBundle", config =>
// {
// config.AddBaseBundles(BlazorStandardBundles.Styles.Global);
// });
options.ScriptBundles
.Add("MyGlobalBundle");
//options.ScriptBundles
// .Add("MyGlobalBundle", config =>
// {
// config.AddBaseBundles(BlazorStandardBundles.Scripts.Global);
// });
});
}
Are you saying that it is necessary to have a theme for a minimal ABP application to work? I thought ABP was meant to be modular in the sense that you only installed what you needed and the installed modules did the setup for whatever dependency they needed.
Also, the services that I mentioned were not working (the block service and the notification service) are just those I've noticed. Is there another service from the initial packages (and their dependencies) that might not work even if I use a theme?
Thank you very much for the layout. I see now that some services need hooks in the layout to work. I would suggest a note in the documentation of those services mentioning the necessary setup in case a theme is not used or is being customized.
Context: I am developing a Blazor Web App using the LeptonX theme, and I’m implementing a different branding logo for each tenant. To achieve this, I overrode the DefaultBrandingProvider class and overrode the LogoUrl property.
Issue: After I overrode the LogoUrl property, two issues appeared on the login page:
Expected Behavior:
[Dependency(ReplaceServices = true)]
public class AbpTabsBrandingProvider : DefaultBrandingProvider
{
private IStringLocalizer<AbpTabsResource> _localizer;
public AbpTabsBrandingProvider(IStringLocalizer<AbpTabsResource> localizer)
{
_localizer = localizer;
}
public override string AppName => "AbpTest";
public override string LogoUrl => "/images/logo/leptonx/icon.svg";
}
I understand that overriding the login page in the theme is a workaround of this issue. The question is: Is there another workaround that does not override the theme? Also, is this considered a bug of the theme that we should expect to be fixed in the future?
Context: I am developing a Blazor Web App using the LeptonX theme. Following the ABP documentation, I have successfully overridden the SideMenuLayout by creating a custom layout (CustomSideMenuLayout) as described here.
Issue: Pages coming from the Account.Pro module (e.g., Security Logs, Sessions, External logins etc.) do not use my CustomSideMenuLayout.
Things I have investigated: Those pages call IThemeManager.CurrentTheme.GetApplicationLayout(), which returns the type SideMenuLayout of LeptonX. Instead of asking the service provider to resolve that type and obtain my overriden layout, they use that type.
Expected Behavior: All Blazor pages—including those provided by Account.Pro should use the overridden SideMenuLayout (CustomSideMenuLayout).
I'm not sure the AI answer makes sense.