Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/admin-sample.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --module Admin --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --brouter false

- name: Update core appsettings.json
uses: devops-actions/variable-substitution@ae7b1f3676ae374dc70282e6b9650bc50b611222 # v1.2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bit.full.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ jobs:

- name: Build sample configuration 1
run: |
dotnet new bit-bp --name TestProject --database SqlServer --filesStorage AzureBlobStorage --api Integrated --captcha reCaptcha --pipeline Azure --module Admin --offlineDb --appInsights --sentry --signalR --notification --cloudflare --ads --aspire --redis --multitenant
dotnet new bit-bp --name TestProject --database SqlServer --filesStorage AzureBlobStorage --api Integrated --captcha reCaptcha --pipeline Azure --module Admin --offlineDb --appInsights --sentry --signalR --notification --cloudflare --ads --aspire --redis --multitenant --brouter
dotnet build TestProject/TestProject.sln -p:InvariantGlobalization=false -p:Environment=Staging -p:EnforceCodeStyleInBuild=true
rm -r "TestProject"

- name: Build sample configuration 2
run: |
dotnet new bit-bp --name TestProject2 --database Other --filesStorage S3 --api Standalone --captcha None --pipeline None --module None --offlineDb false --appInsights false --sentry false --signalR false --notification false --cloudflare false --ads false --aspire true --redis false --multitenant false
dotnet new bit-bp --name TestProject2 --database Other --filesStorage S3 --api Standalone --captcha None --pipeline None --module None --offlineDb false --appInsights false --sentry false --signalR false --notification false --cloudflare false --ads false --aspire true --redis false --multitenant false --brouter false
dotnet build TestProject2/TestProject2.slnx -p:InvariantGlobalization=true -p:Environment=Development -p:EnforceCodeStyleInBuild=true
rm -r "TestProject2"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sales-module-demo.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name SalesModule --database PostgreSQL --module Sales --appInsights --apiServerUrl ${{ env.SERVER_ADDRESS }} --webAppUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads
cd ../../../ && dotnet new bit-bp --name SalesModule --database PostgreSQL --module Sales --appInsights --apiServerUrl ${{ env.SERVER_ADDRESS }} --webAppUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --brouter false

- name: Update core appsettings.json
uses: devops-actions/variable-substitution@ae7b1f3676ae374dc70282e6b9650bc50b611222 # v1.2
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
cd src\Templates\Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ..\..\..\ && dotnet new bit-bp --name SalesModule --database PostgreSQL --module Sales --sentry --apiServerUrl ${{ env.SERVER_ADDRESS }} --webAppUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --ads
cd ..\..\..\ && dotnet new bit-bp --name SalesModule --database PostgreSQL --module Sales --sentry --apiServerUrl ${{ env.SERVER_ADDRESS }} --webAppUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --ads --brouter false

- name: Update core appsettings.json
uses: devops-actions/variable-substitution@ae7b1f3676ae374dc70282e6b9650bc50b611222 # v1.2
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/todo-sample.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --offlineDb --signalR --ads --api Standalone --redis --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --offlineDb --signalR --ads --api Standalone --redis --multitenant false --brouter false

- name: Use Bit.ResxTranslator
run: |
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --api Standalone --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --api Standalone --multitenant false --brouter false

- name: Use Bit.ResxTranslator
run: |
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --ads --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --ads --multitenant false --brouter false
Comment thread
yasmoradi marked this conversation as resolved.

- name: Update core appsettings.json
uses: devops-actions/variable-substitution@ae7b1f3676ae374dc70282e6b9650bc50b611222 # v1.2
Expand Down Expand Up @@ -207,7 +207,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --offlineDb --signalR --ads --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --appInsights --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --offlineDb --signalR --ads --multitenant false --brouter false

- name: Update core appsettings.json
uses: devops-actions/variable-substitution@ae7b1f3676ae374dc70282e6b9650bc50b611222 # v1.2
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --ads --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --ads --multitenant false --brouter false

- name: Update core appsettings.json
uses: devops-actions/variable-substitution@ae7b1f3676ae374dc70282e6b9650bc50b611222 # v1.2
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
cd src\Templates\Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --ads --multitenant false
cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --ads --multitenant false --brouter false

- name: Use Bit.ResxTranslator
run: |
Expand Down Expand Up @@ -376,7 +376,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --multitenant false --brouter false

- name: Extract Android signing key from env
uses: timheuer/base64-to-file@dfa5a5dd38803cb4f5c3a081eeb28e8362d43e9c # v2
Expand Down Expand Up @@ -477,7 +477,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --multitenant false
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample --sentry --apiServerUrl ${{ env.SERVER_API_ADDRESS }} --webAppUrl ${{ env.SERVER_WEB_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --ads --multitenant false --brouter false

- name: Use Bit.ResxTranslator
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
{
"id": "ads"
},
{
"id": "brouter"
},
{
"id": "apiServerUrl",
"isVisible": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@
"defaultValue": "false",
"description": "Adds GoogleAds integration."
},
"brouter": {
"displayName": "Use bit Brouter?",
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Replaces the built-in Blazor Router with bit Brouter, bringing advanced routing features - nested routes, route guards, data loaders, keep-alive pages and view transitions - inspired by the routers of Vue.js, React and Angular."
},
"nameToLower": {
"type": "generated",
"generator": "casing",
Expand Down Expand Up @@ -690,6 +697,12 @@
"src/Client/Boilerplate.Client.Core/Infrastructure/Services/Contracts/IAdsService.cs",
"src/Client/Boilerplate.Client.Core/Infrastructure/Services/AdsService.cs"
]
},
{
"condition": "(brouter != true)",
"exclude": [
"src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs"
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<PackageReference Include="Bit.BlazorUI.Icons" />
<PackageReference Include="Bit.BlazorUI.Assets" />
<!--/+:msbuild-conditional:noEmit -->
<Using Condition=" '$(brouter)' == 'true' OR '$(brouter)' == '' " Include="Bit.Brouter" />
<PackageReference Condition=" '$(brouter)' == 'true' OR '$(brouter)' == '' " Include="Bit.Brouter" />
<PackageReference Condition=" '$(appInsights)' == 'true' OR '$(appInsights)' == '' " Include="BlazorApplicationInsights" />
<PackageReference Condition=" '$(offlineDb)' == 'true' OR '$(offlineDb)' == ''" Include="Bit.Besql" />
<PackageReference Condition=" '$(offlineDb)' == 'true' OR '$(offlineDb)' == ''" Include="CommunityToolkit.Datasync.Client" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ namespace Boilerplate.Client.Core.Components;

public partial class AppRouteDataPublisher : AppComponentBase
{
private RouteData? lastPublishedRouteData;

[Parameter] public RouteData? RouteData { get; set; }

protected override async Task OnInitAsync()
protected override async Task OnParamsSetAsync()
{
await base.OnInitAsync();
await base.OnParamsSetAsync();

// RouteData is a fresh instance per navigation; skip redundant publishes on plain re-renders.
if (ReferenceEquals(lastPublishedRouteData, RouteData)) return;
lastPublishedRouteData = RouteData;

PubSubService.Publish(ClientAppMessages.ROUTE_DATA_UPDATED, RouteData);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
namespace Boilerplate.Client.Core.Components.Pages;

/// <summary>
/// bit Brouter route-lifecycle hooks for pages deriving from <see cref="AppPageBase"/>.
///
/// <para>
/// Brouter treats routing as more than "match a URL and mount a component". A route can be marked
/// <c>KeepAlive</c> (see <c>Routes.razor</c>): instead of being torn down when you navigate away, the
/// page's component instance is retained and merely <em>hidden</em>, then <em>revealed</em> again on
/// return - so scroll position, grid paging/sorting/filtering, unsaved input, in-flight state, etc. all
/// survive the round-trip. And whether a page is kept alive or not, Brouter gives it a much richer
/// lifecycle than Blazor's bare <c>OnInitialized</c>/<c>Dispose</c> pair.
/// </para>
/// </summary>
public abstract partial class AppPageBase : IBrouterRoute

Check failure on line 15 in src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs

View workflow job for this annotation

GitHub Actions / build Bit.Templates

The type or namespace name 'IBrouterRoute' could not be found (are you missing a using directive or an assembly reference?)
{
/// <summary>
/// <inheritdoc cref="IBrouterRoute.OnActivatedAsync"/>
/// </summary>
protected virtual async ValueTask OnActivated(BrouterRouteActivation activation) { }

Check failure on line 20 in src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs

View workflow job for this annotation

GitHub Actions / build Bit.Templates

The type or namespace name 'BrouterRouteActivation' could not be found (are you missing a using directive or an assembly reference?)
public async ValueTask OnActivatedAsync(BrouterRouteActivation activation)

Check failure on line 21 in src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs

View workflow job for this annotation

GitHub Actions / build Bit.Templates

The type or namespace name 'BrouterRouteActivation' could not be found (are you missing a using directive or an assembly reference?)
{
try
{
await OnActivated(activation);
}
catch (Exception exp)
{
ExceptionHandler.Handle(exp);
}
}

/// <summary>
/// <inheritdoc cref="IBrouterRoute.OnDeactivatedAsync"/>
/// </summary>
protected virtual async ValueTask OnDeactivated(BrouterRouteDeactivation deactivation) { }

Check failure on line 36 in src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs

View workflow job for this annotation

GitHub Actions / build Bit.Templates

The type or namespace name 'BrouterRouteDeactivation' could not be found (are you missing a using directive or an assembly reference?)
public async ValueTask OnDeactivatedAsync(BrouterRouteDeactivation deactivation)

Check failure on line 37 in src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs

View workflow job for this annotation

GitHub Actions / build Bit.Templates

The type or namespace name 'BrouterRouteDeactivation' could not be found (are you missing a using directive or an assembly reference?)
{
try
{
await OnDeactivated(deactivation);
}
catch (Exception exp)
{
ExceptionHandler.Handle(exp);
}
}

/// <summary>
/// <inheritdoc cref="IBrouterRoute.OnDeactivatingAsync"/>
/// </summary>
protected virtual async ValueTask OnDeactivating(BrouterRouteDeactivatingContext context) { }

Check failure on line 52 in src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/AppPageBase.BrouterLifecycles.cs

View workflow job for this annotation

GitHub Actions / build Bit.Templates

The type or namespace name 'BrouterRouteDeactivatingContext' could not be found (are you missing a using directive or an assembly reference?)
public async ValueTask OnDeactivatingAsync(BrouterRouteDeactivatingContext context)
{
try
{
await OnDeactivating(context);
}
catch (Exception exp)
{
ExceptionHandler.Handle(exp);
}
}

/// <summary>
/// <inheritdoc cref="IBrouterRoute.OnRenavigatedAsync"/>
/// </summary>
protected virtual async ValueTask OnRenavigated(BrouterRouteRenavigation renavigation) { }
public async ValueTask OnRenavigatedAsync(BrouterRouteRenavigation renavigation)
{
try
{
await OnRenavigated(renavigation);
}
catch (Exception exp)
{
ExceptionHandler.Handle(exp);
}
}

/// <summary>
/// <inheritdoc cref="IBrouterRoute.OnRenavigatingAsync"/>
/// </summary>
protected virtual async ValueTask OnRenavigating(BrouterRouteRenavigatingContext context) { }
public async ValueTask OnRenavigatingAsync(BrouterRouteRenavigatingContext context)
{
try
{
await OnRenavigating(context);
}
catch (Exception exp)
{
ExceptionHandler.Handle(exp);
}
}

// The following code enables Brouter route-lifecycle hooks for pages inheriting from AppPageBase.

[CascadingParameter] private BrouterRouteContext? routeContext { get; set; }
private bool brouterRegistered;

public override Task SetParametersAsync(ParameterView parameters)
{
var task = base.SetParametersAsync(parameters);

if (brouterRegistered is false && routeContext is not null)
{
routeContext.Register(this);
brouterRegistered = true;
}

return task;
}

protected override ValueTask DisposeAsync(bool disposing)
{
if (brouterRegistered)
{
routeContext?.Unregister(this);
brouterRegistered = false;
}

return base.DisposeAsync(disposing);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

namespace Boilerplate.Client.Core.Components.Pages;

public abstract partial class AppPageBase : AppComponentBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
Class="categories-grid"
OnRead="LoadCategories"
Loading="isLoading"
Pageable Filterable Resizable
ShowToolbar ShowCsvExport ShowExcelExport
Pageable Filterable Resizable Reorderable
ShowToolbar ShowColumnChooser ShowCsvExport ShowExcelExport
PageSize="10"
Strings="DataGridStrings">
<BitDataGridColumn Title="@Localizer[nameof(AppStrings.Name)]"
Expand Down
Loading
Loading