Browse Source

Add React to the UiFramework enum

React solutions are generated by ABP Studio's modern templates, so map React in ToFrameworkName and reject it in the classic template builder. Also document that React templates can be customized in ABP Suite.
pull/25825/head
maliming 2 months ago
parent
commit
ef7fc3b717
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 5
      docs/en/suite/editing-templates.md
  2. 3
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/UiFramework.cs
  3. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/UiFrameworkExtensions.cs
  4. 9
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs

5
docs/en/suite/editing-templates.md

@ -13,10 +13,10 @@ ABP Suite uses templates to generate the code files. You can see the template fi
There are 2 template filters:
1. **UI**: You can switch between `Angular`, `MVC` and `Blazor` templates.
1. **UI**: You can switch between `Angular`, `MVC`, `Blazor` and `React` templates.
2. **Database provider:** You can switch between `EF Core` and `MongoDb` templates.
> **Note:** This template editor lists the `Angular`, `MVC` and `Blazor` templates. ABP Suite generates React CRUD pages for modern React UI solutions from built-in templates, but those React templates are not editable through this template editor.
> **Note:** For modern React UI solutions, the React templates are listed here as well. Customizing one makes ABP Suite generate the React pages from your version instead of the built-in template, the same way as for the Angular, MVC and Blazor UI stacks.
These filters are automatically selected based on your ABP solution. The selected solution is shown on the top right of the page. In the current screenshot it is "Acme.BookStore".
@ -33,6 +33,7 @@ There's a naming convention for the template files.
* If the template name has `Frontend.Mvc` prefix, it's used for razor pages, menus, JavaScript, CSS files.
* If the template name has `Frontend.Blazor` prefix (no `.MudBlazor` segment), it's used for Blazorise-based razor components.
* If the template name has `Frontend.Blazor.MudBlazor` prefix, it's used for [MudBlazor](https://mudblazor.com)-based razor components.
* If the template name has `Frontend.React` prefix, it's used for the modern React UI code generation.
> The template list only shows the variant that matches your solution's [Blazor UI library](index.md#blazor-ui-library) (Blazorise or MudBlazor), so you never see both trees side-by-side and the "outdated" check only flags the active set.

3
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/UiFramework.cs

@ -9,5 +9,6 @@ public enum UiFramework
Blazor = 4,
BlazorServer = 5,
MauiBlazor = 6,
BlazorWebApp = 7
BlazorWebApp = 7,
React = 8
}

1
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/UiFrameworkExtensions.cs

@ -12,6 +12,7 @@ public static class UiFrameworkExtensions
case UiFramework.Blazor: return "blazor";
case UiFramework.BlazorServer: return "blazor-server";
case UiFramework.BlazorWebApp: return "blazor-webapp";
case UiFramework.React: return "react";
case UiFramework.NotSpecified: return "NotSpecified";
default: return "NotSpecified";
}

9
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs

@ -59,6 +59,15 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency
NormalizeArgs(args, templateInfo);
// Checked after NormalizeArgs so a NotSpecified UI resolved to React is caught too. React is only
// produced by ABP Studio's modern solution templates; the classic builders below have no React
// handling, so fail fast instead of emitting a solution with an unconfigured UI.
if (args.UiFramework == UiFramework.React)
{
throw new UserFriendlyException(
"The React UI is generated by ABP Studio's modern solution templates and is not supported by the classic template builder.");
}
await EventBus.PublishAsync(new ProjectCreationProgressEvent {
Message = "Downloading the solution template"
}, false);

Loading…
Cancel
Save