Browse Source

refactor: remove unused MudBlazor theming module and update dependencies in MyProjectNameBlazorModule

pull/25235/head
maliming 5 months ago
parent
commit
2ffd01d897
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 2
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor.Bundling/MauiBlazorMudBlazorStyleContributor.cs
  2. 20
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor/AbpAspNetCoreComponentsMauiBlazorThemingMudBlazorModule.cs
  3. 1
      framework/src/Volo.Abp.AspNetCore.Components.Server.Theming.MudBlazor/Bundling/BlazorServerMudBlazorScriptContributor.cs
  4. 12
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/AbpAspNetCoreComponentsWebThemingMudBlazorModule.cs
  5. 18
      framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Layout/PageHeader.razor.cs
  6. 14
      framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudExtensibleDataGrid.razor.cs
  7. 32
      framework/src/Volo.Abp.MudBlazorUI/Components/ObjectExtending/MudDateTimeOffsetExtensionProperty.razor
  8. 93
      framework/src/Volo.Abp.MudBlazorUI/Components/ObjectExtending/MudDateTimeOffsetExtensionProperty.razor.cs
  9. 17
      framework/src/Volo.Abp.MudBlazorUI/MudBlazorUiObjectExtensionPropertyInfoExtensions.cs
  10. 2
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.MudBlazorBasicTheme/MudBlazorBasicThemeToolbarContributor.cs
  11. 8
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/MudBlazorBasicTheme.cs
  12. 1
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor
  13. 3
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/Themes/Basic/NavMenuItem.razor
  14. 4
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/Themes/Basic/_Imports.razor
  15. 10
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor
  16. 1
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor
  17. 1
      modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor.Server/AbpIdentityBlazorMudBlazorServerModule.cs
  18. 9
      modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/IdentityMenuNames.cs
  19. 10
      modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/RoleManagement.razor.cs
  20. 4
      modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor
  21. 27
      modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor.cs
  22. 1
      modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/PermissionManagementModal.razor
  23. 43
      modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/PermissionManagementModal.razor.cs
  24. 3
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor
  25. 3
      modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/TimeZoneSettingGroup/TimeZoneSettingGroupViewComponent.razor
  26. 4
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.Server/AbpTenantManagementBlazorMudBlazorServerModule.cs
  27. 1
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.Server/Volo.Abp.TenantManagement.Blazor.MudBlazor.Server.csproj
  28. 2
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly/AbpTenantManagementBlazorMudBlazorWebAssemblyModule.cs
  29. 1
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly/Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly.csproj
  30. 6
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor/Pages/TenantManagement/TenantManagement.razor
  31. 21
      modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor/Pages/TenantManagement/TenantManagement.razor.cs
  32. 103868
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/Logs/logs.txt
  33. 3
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs

2
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor.Bundling/MauiBlazorMudBlazorStyleContributor.cs

@ -7,8 +7,10 @@ public class MauiBlazorMudBlazorStyleContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor/libs/fontawesome/css/all.css");
context.Files.AddIfNotContains("_content/MudBlazor/MudBlazor.min.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/css/abp.css");
context.Files.AddIfNotContains("_content/Volo.Abp.MudBlazorUI/volo.abp.mudblazorui.css");
context.Files.AddIfNotContains("_content/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor/libs/flag-icon/css/flag-icon.css");
}
}

20
framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor/AbpAspNetCoreComponentsMauiBlazorThemingMudBlazorModule.cs

@ -1,7 +1,6 @@
using Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor.Bundling;
using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor;
using Volo.Abp.AspNetCore.Components.MauiBlazor;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.Modularity;
namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor;
@ -13,23 +12,4 @@ namespace Volo.Abp.AspNetCore.Components.MauiBlazor.Theming.MudBlazor;
)]
public class AbpAspNetCoreComponentsMauiBlazorThemingMudBlazorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpBundlingOptions>(options =>
{
options
.StyleBundles
.Add(MauiBlazorMudBlazorStandardBundles.Styles.Global, bundle =>
{
bundle.AddContributors(typeof(MauiBlazorMudBlazorStyleContributor));
});
options
.ScriptBundles
.Add(MauiBlazorMudBlazorStandardBundles.Scripts.Global, bundle =>
{
bundle.AddContributors(typeof(MauiBlazorMudBlazorScriptContributor));
});
});
}
}

1
framework/src/Volo.Abp.AspNetCore.Components.Server.Theming.MudBlazor/Bundling/BlazorServerMudBlazorScriptContributor.cs

@ -15,7 +15,6 @@ public class BlazorServerMudBlazorScriptContributor : BundleContributor
{
context.Files.AddIfNotContains("/_framework/blazor.server.js");
}
//TODO@MudBlazor: Do we need this script, check ?
context.Files.AddIfNotContains("/_content/MudBlazor/MudBlazor.min.js");
context.Files.AddIfNotContains("/_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/abp.js");
context.Files.AddIfNotContains("/_content/Volo.Abp.AspNetCore.Components.Web/libs/abp/js/authentication-state-listener.js");

12
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/AbpAspNetCoreComponentsWebThemingMudBlazorModule.cs

@ -1,7 +1,4 @@
using Volo.Abp.Application;
using Volo.Abp.Authorization;
using Volo.Abp.Features;
using Volo.Abp.GlobalFeatures;
using Volo.Abp.AspNetCore.Components.Web.Security;
using Volo.Abp.Modularity;
using Volo.Abp.MudBlazorUI;
using Volo.Abp.UI.Navigation;
@ -14,5 +11,12 @@ namespace Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor;
)]
public class AbpAspNetCoreComponentsWebThemingMudBlazorModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpDynamicLayoutComponentOptions>(options =>
{
options.Components.Add(typeof(AbpAuthenticationState), null);
});
}
}

18
framework/src/Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor/Layout/PageHeader.razor.cs

@ -115,8 +115,7 @@ public partial class PageHeader : ComponentBase, IDisposable
var item = pageItems[i];
var isLast = i == pageItems.Count - 1;
// Convert Blazorise icon to MudBlazor icon if needed
var mudIcon = ConvertToMudIcon(item.Icon);
var mudIcon = ConvertToMudIcon(item.Icon);
// If BreadcrumbShowCurrent is false, skip the last item or make it non-clickable
if (isLast && !BreadcrumbShowCurrent)
@ -132,26 +131,19 @@ public partial class PageHeader : ComponentBase, IDisposable
}
}
/// <summary>
/// Converts Blazorise icon to MudBlazor icon.
/// You may need to expand this mapping based on the icons used in your application.
/// </summary>
private static string? ConvertToMudIcon(object? blazoriseIcon)
private static string? ConvertToMudIcon(object? icon)
{
if (blazoriseIcon == null)
if (icon == null)
{
return null;
}
// If it's already a string (MudBlazor icon format), return as-is
if (blazoriseIcon is string iconString)
if (icon is string iconString)
{
return iconString;
}
// Map common Blazorise icons to MudBlazor icons
// Add more mappings as needed for your application
var iconName = blazoriseIcon.ToString();
var iconName = icon.ToString();
return iconName switch
{

14
framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudExtensibleDataGrid.razor.cs

@ -11,6 +11,7 @@ using Microsoft.Extensions.Localization;
using MudBlazor;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns;
using Volo.Abp.Data;
using Volo.Abp.Timing;
namespace Volo.Abp.MudBlazorUI.Components;
@ -46,6 +47,9 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
[Inject]
public IStringLocalizer<AbpUiResource> UiLocalizer { get; set; } = default!;
[Inject]
public IClock Clock { get; set; } = default!;
public virtual async Task ReloadServerDataAsync()
{
if (_dataGrid != null && ServerData != null)
@ -104,6 +108,16 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
value = propertyValue;
}
if (value is DateTime dateTime)
{
return Clock.ConvertToUserTime(dateTime);
}
if (value is DateTimeOffset dateTimeOffset)
{
return Clock.ConvertToUserTime(dateTimeOffset);
}
return value;
}

32
framework/src/Volo.Abp.MudBlazorUI/Components/ObjectExtending/MudDateTimeOffsetExtensionProperty.razor

@ -0,0 +1,32 @@
@typeparam TEntity
@typeparam TResourceType
@using Volo.Abp.Localization
@using Volo.Abp.ObjectExtending
@inherits MudExtensionPropertyComponentBase<TEntity, TResourceType>
@if (PropertyInfo != null && Entity != null)
{
@if (PropertyInfo.IsDate())
{
<MudDatePicker T="DateTime?"
Label="@PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
@bind-Date="@DateOnlyValue"
Disabled="IsReadonlyField"
Validation="@((Func<DateTime?, string?>)(v => Validate(v)))"
DateFormat="@GetDateFormat()" />
}
else
{
<MudStack Row="true" Spacing="2">
<MudDatePicker T="DateTime?"
Label="@PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
@bind-Date="@DateValue"
Disabled="IsReadonlyField"
DateFormat="@GetDateFormat()" />
<MudTimePicker T="TimeSpan?"
Label="@GetTimeLabel()"
@bind-Time="@TimeValue"
Disabled="IsReadonlyField" />
</MudStack>
}
}

93
framework/src/Volo.Abp.MudBlazorUI/Components/ObjectExtending/MudDateTimeOffsetExtensionProperty.razor.cs

@ -0,0 +1,93 @@
using System;
using Volo.Abp.Data;
using Volo.Abp.ObjectExtending;
namespace Volo.Abp.MudBlazorUI.Components.ObjectExtending;
public partial class MudDateTimeOffsetExtensionProperty<TEntity, TResourceType>
where TEntity : IHasExtraProperties
{
protected DateTimeOffset? Value
{
get
{
var raw = Entity.GetProperty(PropertyInfo.Name);
return raw switch
{
null => null,
DateTimeOffset dto => dto,
DateTime dt => dt.Kind switch
{
DateTimeKind.Utc => new DateTimeOffset(dt, TimeSpan.Zero),
DateTimeKind.Local => new DateTimeOffset(dt),
_ => new DateTimeOffset(DateTime.SpecifyKind(dt, DateTimeKind.Utc), TimeSpan.Zero)
},
_ => null
};
}
set => Entity.SetProperty(PropertyInfo.Name, value, false);
}
protected DateTime? DateOnlyValue
{
get => Value?.DateTime.Date;
set
{
if (value.HasValue)
{
Value = new DateTimeOffset(value.Value);
}
else
{
Value = null;
}
}
}
protected DateTime? DateValue
{
get => Value?.DateTime.Date;
set
{
if (value.HasValue)
{
var time = Value?.DateTime.TimeOfDay ?? TimeSpan.Zero;
var offset = Value?.Offset ?? TimeSpan.Zero;
Value = new DateTimeOffset(value.Value.Date + time, offset);
}
else
{
Value = null;
}
}
}
protected TimeSpan? TimeValue
{
get => Value?.DateTime.TimeOfDay;
set
{
if (Value.HasValue && value.HasValue)
{
var offset = Value.Value.Offset;
Value = new DateTimeOffset(Value.Value.DateTime.Date + value.Value, offset);
}
}
}
protected string GetDateFormat()
{
var dataFormatString = PropertyInfo.GetDataFormatStringOrNull();
if (!string.IsNullOrEmpty(dataFormatString))
{
return dataFormatString.Replace("{0:", "").Replace("}", "");
}
return PropertyInfo.IsDate() ? "yyyy-MM-dd" : "yyyy-MM-dd";
}
protected string GetTimeLabel()
{
return "Time";
}
}

17
framework/src/Volo.Abp.MudBlazorUI/MudBlazorUiObjectExtensionPropertyInfoExtensions.cs

@ -28,7 +28,6 @@ public static class MudBlazorUiObjectExtensionPropertyInfoExtensions
typeof(short),
typeof(ushort),
typeof(uint),
typeof(long),
typeof(ulong),
typeof(float),
typeof(double),
@ -40,7 +39,6 @@ public static class MudBlazorUiObjectExtensionPropertyInfoExtensions
typeof(short?),
typeof(ushort?),
typeof(uint?),
typeof(long?),
typeof(ulong?),
typeof(float?),
typeof(double?),
@ -132,7 +130,7 @@ public static class MudBlazorUiObjectExtensionPropertyInfoExtensions
{
foreach (var attribute in propertyInfo.Attributes)
{
var inputTypeByAttribute = GetInputTypeFromAttributeOrNull(attribute);
var inputTypeByAttribute = GetInputTypeFromAttributeOrNull(attribute, propertyInfo.Type);
if (inputTypeByAttribute != null)
{
return inputTypeByAttribute;
@ -147,7 +145,7 @@ public static class MudBlazorUiObjectExtensionPropertyInfoExtensions
return propertyInfo.Type.IsEnum || TypeHelper.IsNullableEnum(propertyInfo.Type);
}
private static Type? GetInputTypeFromAttributeOrNull(Attribute attribute)
private static Type? GetInputTypeFromAttributeOrNull(Attribute attribute, Type propertyType)
{
var hasTextEditSupport = TextEditSupportedAttributeTypes.Any(t => t == attribute.GetType());
@ -167,7 +165,9 @@ public static class MudBlazorUiObjectExtensionPropertyInfoExtensions
return typeof(MudTextExtensionProperty<,>);
case DataType.Date:
case DataType.DateTime:
return typeof(MudDateTimeExtensionProperty<,>);
return propertyType == typeof(DateTimeOffset) || propertyType == typeof(DateTimeOffset?)
? typeof(MudDateTimeOffsetExtensionProperty<,>)
: typeof(MudDateTimeExtensionProperty<,>);
case DataType.Time:
return typeof(MudTimeExtensionProperty<,>);
case DataType.MultilineText:
@ -185,11 +185,16 @@ public static class MudBlazorUiObjectExtensionPropertyInfoExtensions
return typeof(MudCheckExtensionProperty<,>);
}
if (type == typeof(DateTime))
if (type == typeof(DateTime) || type == typeof(DateTime?))
{
return typeof(MudDateTimeExtensionProperty<,>);
}
if (type == typeof(DateTimeOffset) || type == typeof(DateTimeOffset?))
{
return typeof(MudDateTimeOffsetExtensionProperty<,>);
}
if (NumberTypes.Contains(type))
{
return typeof(MudTextExtensionProperty<,>);

2
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.MudBlazorBasicTheme/MudBlazorBasicThemeToolbarContributor.cs

@ -11,8 +11,8 @@ public class MudBlazorBasicThemeToolbarContributor : IToolbarContributor
{
if (context.Toolbar.Name == StandardToolbars.Main)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitch)));
context.Toolbar.Items.Add(new ToolbarItem(typeof(LoginDisplay)));
context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitch)));
}
return Task.CompletedTask;

8
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/MudBlazorBasicTheme.cs

@ -2,14 +2,16 @@ using System;
using Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme.Themes.Basic;
using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.Layout;
using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.Theming;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme;
public class MudBlazorBasicTheme : ITheme
[ThemeName(Name)]
public class MudBlazorBasicTheme : ITheme, ITransientDependency
{
public static string Name = "MudBlazorBasic";
public const string Name = "MudBlazorBasic";
public Type GetLayout(string name, bool fallbackToDefault = true)
public virtual Type GetLayout(string name, bool fallbackToDefault = true)
{
switch (name)
{

1
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor

@ -22,7 +22,6 @@ else
@code {
[Inject] protected NavigationManager NavigationManager { get; set; } = default!;
[Inject] protected IAbpLazyServiceProvider LazyServiceProvider { get; set; } = default!;
protected void Logout()
{

3
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/Themes/Basic/NavMenuItem.razor

@ -1,3 +1,4 @@
@implements IDisposable
@using Volo.Abp.UI.Navigation
@using MudBlazor
@using Microsoft.AspNetCore.Components
@ -75,5 +76,3 @@ else
NavigationManager.LocationChanged -= OnLocationChanged;
}
}
@implements IDisposable

4
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.MudBlazorBasicTheme/Themes/Basic/_Imports.razor

@ -5,5 +5,5 @@
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using Volo.Abp.MudBlazorUI;
@using Volo.Abp.MudBlazorUI.Components;
@using Volo.Abp.MudBlazorUI
@using Volo.Abp.MudBlazorUI.Components

10
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor

@ -17,6 +17,16 @@
<AuthorizeView>
<Authorized>
<MudMenu Icon="@Icons.Material.Filled.AccountCircle">
<MudMenuItem>
@if (CurrentTenant.Name != null)
{
<span><i>@CurrentTenant.Name</i>\@CurrentUser.UserName</span>
}
else
{
<span>@CurrentUser.UserName</span>
}
</MudMenuItem>
@if (Menu != null)
{
@foreach (var menuItem in Menu.Items)

1
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor

@ -2,7 +2,6 @@
@using JetBrains.Annotations
@using Volo.Abp.Validation.StringValues
@using Microsoft.Extensions.Localization
@using MudBlazor
@using Volo.Abp.FeatureManagement.Localization
@inherits AbpFeatureManagementComponentBase

1
modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor.Server/AbpIdentityBlazorMudBlazorServerModule.cs

@ -6,6 +6,7 @@ namespace Volo.Abp.Identity.Blazor.MudBlazor.Server;
[DependsOn(
typeof(AbpIdentityBlazorMudBlazorModule),
typeof(AbpAspNetCoreComponentsServerThemingMudBlazorModule),
typeof(AbpPermissionManagementBlazorMudBlazorServerModule)
)]
public class AbpIdentityBlazorMudBlazorServerModule : AbpModule

9
modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/IdentityMenuNames.cs

@ -1,10 +1,9 @@
namespace Volo.Abp.Identity.Blazor.MudBlazor;
public static class IdentityMenuNames
public class IdentityMenuNames
{
public const string GroupName = "IdentityManagement";
public const string GroupName = "AbpIdentity";
public const string Roles = "AbpIdentity.Roles";
public const string Users = "AbpIdentity.Users";
public const string Roles = GroupName + ".Roles";
public const string Users = GroupName + ".Users";
}

10
modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/RoleManagement.razor.cs

@ -79,11 +79,8 @@ public partial class RoleManagement
{
if (PermissionManagementModal != null)
{
var role = data.As<IdentityRoleDto>();
await PermissionManagementModal.OpenAsync(
PermissionProviderName,
role.Id.ToString(),
role.Name);
await PermissionManagementModal.OpenAsync(PermissionProviderName,
data.As<IdentityRoleDto>().Name);
}
}
},
@ -91,7 +88,8 @@ public partial class RoleManagement
{
Text = L["Delete"],
Visible = (data) => HasDeletePermission && !data.As<IdentityRoleDto>().IsStatic,
Clicked = async (data) => await DeleteEntityAsync(data.As<IdentityRoleDto>())
Clicked = async (data) => await DeleteEntityAsync(data.As<IdentityRoleDto>()),
ConfirmationMessage = (data) => GetDeleteConfirmationMessage(data.As<IdentityRoleDto>())
}
});

4
modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor

@ -88,7 +88,7 @@
{
@foreach (var role in NewUserRoles)
{
<MudCheckBox T="bool" @bind-Value="@role.IsAssigned" Label="@role.Name" />
<MudCheckBox T="bool" @bind-Value="@role.IsAssigned" Disabled="@(!role.IsAssignable)" Label="@role.Name" />
<input type="hidden" @bind-value="@role.Name" />
}
}
@ -154,7 +154,7 @@
<MudTabPanel Text="@L["Roles"]">
@foreach (var role in EditUserRoles)
{
<MudCheckBox T="bool" @bind-Value="@role.IsAssigned" Label="@role.Name" />
<MudCheckBox T="bool" @bind-Value="@role.IsAssigned" Disabled="@(!role.IsAssignable)" Label="@role.Name" />
<input type="hidden" @bind-value="@role.Name" />
}
</MudTabPanel>

27
modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor.cs

@ -114,7 +114,8 @@ public partial class UserManagement
NewUserRoles = Roles.Select(x => new AssignedRoleViewModel
{
Name = x.Name,
IsAssigned = x.IsDefault
IsAssigned = x.IsDefault,
IsAssignable = true
}).ToArray();
}
@ -143,14 +144,25 @@ public partial class UserManagement
_editTabIndex = 0;
IsEditCurrentUser = entity.Id == CurrentUser.Id;
if (Roles != null && await PermissionChecker.IsGrantedAsync(IdentityPermissions.Users.ManageRoles))
if (await PermissionChecker.IsGrantedAsync(IdentityPermissions.Users.ManageRoles))
{
var userRoleIds = (await AppService.GetRolesAsync(entity.Id)).Items.Select(r => r.Id).ToList();
var assignableRoles = Roles ?? (await AppService.GetAssignableRolesAsync()).Items;
var currentRoles = (await AppService.GetRolesAsync(entity.Id)).Items;
EditUserRoles = Roles.Select(x => new AssignedRoleViewModel
var combinedRoles = assignableRoles
.Concat(currentRoles)
.GroupBy(role => role.Id)
.Select(group => group.First())
.ToList();
var currentRoleIds = currentRoles.Select(r => r.Id).ToHashSet();
var assignableRoleIds = assignableRoles.Select(r => r.Id).ToHashSet();
EditUserRoles = combinedRoles.Select(x => new AssignedRoleViewModel
{
Name = x.Name,
IsAssigned = userRoleIds.Contains(x.Id)
IsAssigned = currentRoleIds.Contains(x.Id),
IsAssignable = assignableRoleIds.Contains(x.Id)
}).ToArray();
_showPassword = false;
@ -208,7 +220,8 @@ public partial class UserManagement
{
Text = L["Delete"],
Visible = (data) => HasDeletePermission && CurrentUser.GetId() != data.As<IdentityUserDto>().Id,
Clicked = async (data) => await DeleteEntityAsync(data.As<IdentityUserDto>())
Clicked = async (data) => await DeleteEntityAsync(data.As<IdentityUserDto>()),
ConfirmationMessage = (data) => GetDeleteConfirmationMessage(data.As<IdentityUserDto>())
}
});
@ -265,4 +278,6 @@ public class AssignedRoleViewModel
public string Name { get; set; } = string.Empty;
public bool IsAssigned { get; set; }
public bool IsAssignable { get; set; }
}

1
modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/PermissionManagementModal.razor

@ -1,7 +1,6 @@
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@using global::MudBlazor
@using JetBrains.Annotations
@using MudBlazor
@using Volo.Abp.PermissionManagement.Localization
<MudDialog @bind-Visible="@_isVisible" Options="@(new DialogOptions { MaxWidth = MaxWidth.Large, FullWidth = true })" CloseOnEscapeKey="true">

43
modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/PermissionManagementModal.razor.cs

@ -64,8 +64,8 @@ public partial class PermissionManagementModal
NormalizePermissionGroup();
GrantAll = _groups.SelectMany(x => x.Permissions).All(p => p.IsGranted);
GrantAny = !GrantAll && _groups.SelectMany(x => x.Permissions).Any(p => p.IsGranted);
GrantAll = _allGroups.SelectMany(x => x.Permissions).All(p => p.IsGranted);
GrantAny = !GrantAll && _allGroups.SelectMany(x => x.Permissions).Any(p => p.IsGranted);
_isVisible = true;
await InvokeAsync(StateHasChanged);
@ -223,10 +223,10 @@ public partial class PermissionManagementModal
}
}
if (_groups != null)
if (_allGroups != null)
{
GrantAll = _groups.SelectMany(x => x.Permissions).All(p => p.IsGranted);
GrantAny = !GrantAll && _groups.SelectMany(x => x.Permissions).Any(p => p.IsGranted);
GrantAll = _allGroups.SelectMany(x => x.Permissions).All(p => p.IsGranted);
GrantAny = !GrantAll && _allGroups.SelectMany(x => x.Permissions).Any(p => p.IsGranted);
}
await InvokeAsync(StateHasChanged);
}
@ -249,10 +249,10 @@ public partial class PermissionManagementModal
}
}
if (_groups != null)
if (_allGroups != null)
{
GrantAll = _groups.SelectMany(x => x.Permissions).All(p => p.IsGranted);
GrantAny = !GrantAll && _groups.SelectMany(x => x.Permissions).Any(p => p.IsGranted);
GrantAll = _allGroups.SelectMany(x => x.Permissions).All(p => p.IsGranted);
GrantAny = !GrantAll && _allGroups.SelectMany(x => x.Permissions).Any(p => p.IsGranted);
}
await InvokeAsync(StateHasChanged);
}
@ -310,12 +310,27 @@ public partial class PermissionManagementModal
protected virtual bool IsDisabledPermission(PermissionGrantInfoDto permissionGrantInfo)
{
return _disabledPermissions.Any(x => x == permissionGrantInfo);
if (!permissionGrantInfo.IsEditable)
{
return true;
}
return permissionGrantInfo.IsGranted &&
permissionGrantInfo.GrantedProviders.All(p => p.ProviderName != _providerName);
}
protected virtual string GetShownName(PermissionGrantInfoDto permissionGrantInfo)
{
if (!IsDisabledPermission(permissionGrantInfo))
if (permissionGrantInfo.GrantedProviders.All(p => p.ProviderName == _providerName))
{
return permissionGrantInfo.DisplayName;
}
var grantedByOtherProviders = permissionGrantInfo.GrantedProviders
.Where(p => p.ProviderName != _providerName)
.ToList();
if (!grantedByOtherProviders.Any())
{
return permissionGrantInfo.DisplayName;
}
@ -323,8 +338,7 @@ public partial class PermissionManagementModal
return string.Format(
"{0} ({1})",
permissionGrantInfo.DisplayName,
permissionGrantInfo.GrantedProviders
.Where(p => p.ProviderName != _providerName)
grantedByOtherProviders
.Select(p => p.ProviderName)
.JoinAsString(", ")
);
@ -332,10 +346,7 @@ public partial class PermissionManagementModal
protected virtual bool IsPermissionGroupDisabled(PermissionGroupDto group)
{
var permissions = group.Permissions;
var grantedProviders = permissions.SelectMany(x => x.GrantedProviders);
return permissions.All(x => x.IsGranted) && grantedProviders.Any(p => p.ProviderName != _providerName);
return group.Permissions.All(IsDisabledPermission);
}
protected virtual async Task ResetSearchTextAsync()

3
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor

@ -1,7 +1,6 @@
@using Volo.Abp.SettingManagement.Localization
@using MudBlazor
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@using global::MudBlazor
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@if (EmailSettings != null)
{

3
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/TimeZoneSettingGroup/TimeZoneSettingGroupViewComponent.razor

@ -1,7 +1,6 @@
@using Volo.Abp.SettingManagement.Localization
@using MudBlazor
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@using global::MudBlazor
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase
@if (TimezoneSettings != null)
{

4
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.Server/AbpTenantManagementBlazorMudBlazorServerModule.cs

@ -1,11 +1,13 @@
using Volo.Abp.AspNetCore.Components.Server.Theming.MudBlazor;
using Volo.Abp.FeatureManagement.Blazor.MudBlazor.Server;
using Volo.Abp.Modularity;
namespace Volo.Abp.TenantManagement.Blazor.MudBlazor.Server;
[DependsOn(
typeof(AbpTenantManagementBlazorMudBlazorModule),
typeof(AbpAspNetCoreComponentsServerThemingMudBlazorModule)
typeof(AbpAspNetCoreComponentsServerThemingMudBlazorModule),
typeof(AbpFeatureManagementBlazorMudBlazorServerModule)
)]
public class AbpTenantManagementBlazorMudBlazorServerModule : AbpModule
{

1
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.Server/Volo.Abp.TenantManagement.Blazor.MudBlazor.Server.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.TenantManagement.Blazor.MudBlazor\Volo.Abp.TenantManagement.Blazor.MudBlazor.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.Server.Theming.MudBlazor\Volo.Abp.AspNetCore.Components.Server.Theming.MudBlazor.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Blazor.MudBlazor.Server\Volo.Abp.FeatureManagement.Blazor.MudBlazor.Server.csproj" />
</ItemGroup>
</Project>

2
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly/AbpTenantManagementBlazorMudBlazorWebAssemblyModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.MudBlazor;
using Volo.Abp.FeatureManagement.Blazor.MudBlazor.WebAssembly;
using Volo.Abp.Modularity;
namespace Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly;
@ -6,6 +7,7 @@ namespace Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly;
[DependsOn(
typeof(AbpTenantManagementBlazorMudBlazorModule),
typeof(AbpAspNetCoreComponentsWebAssemblyThemingMudBlazorModule),
typeof(AbpFeatureManagementBlazorMudBlazorWebAssemblyModule),
typeof(AbpTenantManagementHttpApiClientModule)
)]
public class AbpTenantManagementBlazorMudBlazorWebAssemblyModule : AbpModule

1
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly/Volo.Abp.TenantManagement.Blazor.MudBlazor.WebAssembly.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.TenantManagement.Blazor.MudBlazor\Volo.Abp.TenantManagement.Blazor.MudBlazor.csproj" />
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.MudBlazor\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.MudBlazor.csproj" />
<ProjectReference Include="..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Blazor.MudBlazor.WebAssembly\Volo.Abp.FeatureManagement.Blazor.MudBlazor.WebAssembly.csproj" />
<ProjectReference Include="..\Volo.Abp.TenantManagement.HttpApi.Client\Volo.Abp.TenantManagement.HttpApi.Client.csproj" />
</ItemGroup>

6
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor/Pages/TenantManagement/TenantManagement.razor

@ -4,6 +4,8 @@
@using Microsoft.AspNetCore.Authorization
@using Volo.Abp.FeatureManagement.Blazor.MudBlazor.Components
@using Volo.Abp.MudBlazorUI.Components
@using Volo.Abp.MudBlazorUI.Components.ObjectExtending
@using Volo.Abp.TenantManagement.Localization
@using Microsoft.Extensions.Localization
@using Volo.Abp.UI.Navigation.Localization.Resource
@using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.Layout
@ -53,7 +55,7 @@
Adornment="Adornment.End"
AdornmentIcon="@(ShowPassword ? Icons.Material.Filled.Visibility : Icons.Material.Filled.VisibilityOff)"
OnAdornmentClick="@TogglePasswordVisibility" />
<ExtensionProperties TEntityType="TenantCreateDto" TResourceType="AbpTenantManagementResource" Entity="@NewEntity" ModalType="ExtensionPropertyModalType.CreateModal" />
<MudExtensionProperties TEntityType="TenantCreateDto" TResourceType="AbpTenantManagementResource" Entity="@NewEntity" LH="@_localizerHelper" ModalType="ExtensionPropertyModalType.CreateModal" />
</MudForm>
</DialogContent>
<DialogActions>
@ -78,7 +80,7 @@
Required="true"
RequiredError="@L["ThisFieldIsRequired."]"
AutoFocus="true" />
<ExtensionProperties TEntityType="TenantUpdateDto" TResourceType="AbpTenantManagementResource" Entity="@EditingEntity" ModalType="ExtensionPropertyModalType.EditModal" />
<MudExtensionProperties TEntityType="TenantUpdateDto" TResourceType="AbpTenantManagementResource" Entity="@EditingEntity" LH="@_localizerHelper" ModalType="ExtensionPropertyModalType.EditModal" />
</MudForm>
</DialogContent>
<DialogActions>

21
modules/tenant-management/src/Volo.Abp.TenantManagement.Blazor.MudBlazor/Pages/TenantManagement/TenantManagement.razor.cs

@ -2,11 +2,14 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using MudBlazor;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.EntityActions;
using Volo.Abp.AspNetCore.Components.Web.Extensibility.TableColumns;
using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.PageToolbars;
using Volo.Abp.FeatureManagement.Blazor.MudBlazor.Components;
using Volo.Abp.MudBlazorUI;
using Volo.Abp.ObjectExtending;
using Volo.Abp.TenantManagement.Localization;
@ -27,6 +30,11 @@ public partial class TenantManagement
protected List<TableColumn> TenantManagementTableColumns => TableColumns.Get<TenantManagement>();
private AbpMudBlazorMessageLocalizerHelper<AbpTenantManagementResource>? _localizerHelper;
[Inject]
protected IStringLocalizer<AbpTenantManagementResource> Localizer { get; set; } = default!;
private MudForm? _createFormRef;
private MudForm? _editFormRef;
@ -50,6 +58,12 @@ public partial class TenantManagement
return base.SetBreadcrumbItemsAsync();
}
protected override async Task OnInitializedAsync()
{
_localizerHelper = new AbpMudBlazorMessageLocalizerHelper<AbpTenantManagementResource>(Localizer);
await base.OnInitializedAsync();
}
protected override async Task SetPermissionsAsync()
{
await base.SetPermissionsAsync();
@ -64,9 +78,9 @@ public partial class TenantManagement
protected override ValueTask SetToolbarItemsAsync()
{
Toolbar.AddButton(L["NewTenant"],
Toolbar.AddMudButton(L["NewTenant"],
OpenCreateDialogAsync,
icon: Icons.Material.Filled.Add,
icon: Icons.Material.Filled.Add.ToString(),
requiredPolicyName: CreatePolicyName);
return base.SetToolbarItemsAsync();
@ -101,7 +115,8 @@ public partial class TenantManagement
{
Text = L["Delete"],
Visible = (data) => HasDeletePermission,
Clicked = async (data) => await DeleteEntityAsync(data.As<TenantDto>())
Clicked = async (data) => await DeleteEntityAsync(data.As<TenantDto>()),
ConfirmationMessage = (data) => GetDeleteConfirmationMessage(data.As<TenantDto>())
}
});

103868
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/Logs/logs.txt

File diff suppressed because it is too large

3
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp/MyProjectNameBlazorModule.cs

@ -20,7 +20,6 @@ using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Server.MudBlazorBasicTheme;
using Volo.Abp.AspNetCore.Components.Server.MudBlazorBasicTheme.Bundling;
using Volo.Abp.AspNetCore.Components.Server.Theming.MudBlazor;
using Volo.Abp.AspNetCore.Components.Web.Theming.MudBlazor.Routing;
using Volo.Abp.AspNetCore.Components.WebAssembly.MudBlazorBasicTheme.Bundling;
using Volo.Abp.AspNetCore.Mvc;
@ -57,7 +56,7 @@ namespace MyCompanyName.MyProjectName.Blazor.WebApp;
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebOpenIddictModule),
typeof(AbpAspNetCoreComponentsServerMudBlazorBasicThemeModule),
typeof(AbpAspNetCoreComponentsServerThemingMudBlazorModule),
typeof(AbpAspNetCoreComponentsWebAssemblyMudBlazorBasicThemeBundlingModule),
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpIdentityBlazorMudBlazorServerModule),
typeof(AbpTenantManagementBlazorMudBlazorServerModule),

Loading…
Cancel
Save