mirror of https://github.com/abpframework/abp.git
12 changed files with 162 additions and 68 deletions
@ -1,3 +1,3 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
||||
<ConfigureAwait /> |
<ConfigureAwait ContinueOnCapturedContext="false" /> |
||||
</Weavers> |
</Weavers> |
||||
@ -1,23 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.UI.Navigation; |
|
||||
|
|
||||
namespace Volo.Abp.TenantManagement.Blazor.Menus |
|
||||
{ |
|
||||
public class TenantManagementBlazorMenuContributor : IMenuContributor |
|
||||
{ |
|
||||
public async Task ConfigureMenuAsync(MenuConfigurationContext context) |
|
||||
{ |
|
||||
if (context.Menu.Name == StandardMenus.Main) |
|
||||
{ |
|
||||
await ConfigureMainMenu(context); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private Task ConfigureMainMenu(MenuConfigurationContext context) |
|
||||
{ |
|
||||
//Add main menu items.
|
|
||||
|
|
||||
return Task.CompletedTask; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
namespace Volo.Abp.TenantManagement.Blazor.Menus |
|
||||
{ |
|
||||
public class TenantManagementBlazorMenus |
|
||||
{ |
|
||||
private const string Prefix = "MyProjectName"; |
|
||||
|
|
||||
//Add your menu items here...
|
|
||||
//public const string Home = Prefix + ".MyNewMenuItem";
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,32 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.TenantManagement.Localization; |
||||
|
using Volo.Abp.UI.Navigation; |
||||
|
|
||||
|
namespace Volo.Abp.TenantManagement.Blazor.Navigation |
||||
|
{ |
||||
|
public class TenantManagementBlazorMenuContributor : IMenuContributor |
||||
|
{ |
||||
|
public async Task ConfigureMenuAsync(MenuConfigurationContext context) |
||||
|
{ |
||||
|
if (context.Menu.Name == StandardMenus.Main) |
||||
|
{ |
||||
|
await ConfigureMainMenu(context); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private async Task ConfigureMainMenu(MenuConfigurationContext context) |
||||
|
{ |
||||
|
var administrationMenu = context.Menu.GetAdministration(); |
||||
|
|
||||
|
var l = context.GetLocalizer<AbpTenantManagementResource>(); |
||||
|
|
||||
|
var tenantManagementMenuItem = new ApplicationMenuItem(TenantManagementMenuNames.GroupName, l["Menu:TenantManagement"], icon: "fa fa-users"); |
||||
|
administrationMenu.AddItem(tenantManagementMenuItem); |
||||
|
|
||||
|
if (await context.IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) |
||||
|
{ |
||||
|
tenantManagementMenuItem.AddItem(new ApplicationMenuItem(TenantManagementMenuNames.Tenants, l["Tenants"], url: "TenantManagement/Tenants")); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace Volo.Abp.TenantManagement.Blazor.Navigation |
||||
|
{ |
||||
|
public class TenantManagementMenuNames |
||||
|
{ |
||||
|
public const string GroupName = "TenantManagement"; |
||||
|
|
||||
|
public const string Tenants = GroupName + ".Tenants"; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
@page "/tenant-management/tenants" |
||||
|
@attribute [Authorize(TenantManagementPermissions.Tenants.Default)] |
||||
|
@using Microsoft.AspNetCore.Authorization |
||||
|
@using Microsoft.Extensions.Localization |
||||
|
@using Volo.Abp.TenantManagement.Localization |
||||
|
@inherits TenantManagementBase |
||||
|
@inject IStringLocalizer<AbpTenantManagementResource> L |
||||
|
|
||||
|
@* ************************* PAGE HEADER ************************* *@ |
||||
|
<Row> |
||||
|
<Column ColumnSize="ColumnSize.Is6"> |
||||
|
<h1>@L["Tenants"]</h1> |
||||
|
</Column> |
||||
|
<Column ColumnSize="ColumnSize.Is6"> |
||||
|
@if (HasCreatePermission) |
||||
|
{ |
||||
|
<Paragraph Alignment="TextAlignment.Right"> |
||||
|
<Button Color="Color.Primary" Clicked="OpenCreateModalAsync">@L["NewTenant"]</Button> |
||||
|
</Paragraph> |
||||
|
} |
||||
|
</Column> |
||||
|
</Row> |
||||
|
|
||||
|
@* ************************* DATA GRID ************************* *@ |
||||
|
<DataGrid TItem="TenantDto" |
||||
|
Data="Entities" |
||||
|
ReadData="OnDataGridReadAsync" |
||||
|
TotalItems="TotalCount" |
||||
|
ShowPager="true" |
||||
|
PageSize="PageSize"> |
||||
|
<DataGridColumns> |
||||
|
@if (ShouldShowEntityActions) |
||||
|
{ |
||||
|
<DataGridColumn Width="150px" TItem="TenantDto" Field="@nameof(TenantDto.Name)" Sortable="false" Caption="@L["Actions"].Value"> |
||||
|
<DisplayTemplate> |
||||
|
<Dropdown> |
||||
|
<DropdownToggle Color="Color.Primary"> |
||||
|
@L["Actions"] |
||||
|
</DropdownToggle> |
||||
|
<DropdownMenu> |
||||
|
@if (HasUpdatePermission) |
||||
|
{ |
||||
|
<DropdownItem Clicked="() => OpenEditModalAsync(context.As<TenantDto>().Id)">@L["Edit"]</DropdownItem> |
||||
|
} |
||||
|
@if (HasDeletePermission) |
||||
|
{ |
||||
|
<DropdownDivider/> |
||||
|
<DropdownItem Clicked="() => DeleteEntityAsync(context.As<TenantDto>())">@L["Delete"]</DropdownItem> |
||||
|
} |
||||
|
</DropdownMenu> |
||||
|
</Dropdown> |
||||
|
</DisplayTemplate> |
||||
|
</DataGridColumn> |
||||
|
} |
||||
|
<DataGridColumn TItem="TenantDto" Field="@nameof(TenantDto.Name)" Caption="@L["TenantName"].Value"> |
||||
|
<DisplayTemplate> |
||||
|
@(context.As<TenantDto>().Name) |
||||
|
</DisplayTemplate> |
||||
|
</DataGridColumn> |
||||
|
</DataGridColumns> |
||||
|
</DataGrid> |
||||
@ -0,0 +1,29 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.BlazoriseUI; |
||||
|
|
||||
|
namespace Volo.Abp.TenantManagement.Blazor.Pages.TenantManagement |
||||
|
{ |
||||
|
public abstract class TenantManagementBase |
||||
|
: AbpCrudPageBase<ITenantAppService, TenantDto, Guid, GetTenantsInput, TenantCreateDto, TenantUpdateDto> |
||||
|
{ |
||||
|
protected bool ShouldShowEntityActions; |
||||
|
|
||||
|
public TenantManagementBase() |
||||
|
{ |
||||
|
ObjectMapperContext = typeof(AbpTenantManagementBlazorModule); |
||||
|
|
||||
|
CreatePolicyName = TenantManagementPermissions.Tenants.Create; |
||||
|
UpdatePolicyName = TenantManagementPermissions.Tenants.Update; |
||||
|
DeletePolicyName = TenantManagementPermissions.Tenants.Delete; |
||||
|
} |
||||
|
|
||||
|
protected override async Task SetPermissionsAsync() |
||||
|
{ |
||||
|
await base.SetPermissionsAsync(); |
||||
|
|
||||
|
ShouldShowEntityActions = HasUpdatePermission || |
||||
|
HasDeletePermission; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,8 +0,0 @@ |
|||||
@page "/TenantManagement/Tenants" |
|
||||
@using Microsoft.Extensions.Localization |
|
||||
@using Volo.Abp.TenantManagement.Localization |
|
||||
@inject IStringLocalizer<AbpTenantManagementResource> L |
|
||||
@{ |
|
||||
} |
|
||||
<h1>MyProjectName</h1> |
|
||||
<p>@L["SamplePageMessage"]</p> |
|
||||
@ -1,20 +1,26 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk.Razor"> |
||||
|
|
||||
<Import Project="..\..\..\..\configureawait.props" /> |
<Import Project="..\..\..\..\configureawait.props" /> |
||||
<Import Project="..\..\..\..\common.props" /> |
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.1</TargetFramework> |
|
||||
<RazorLangVersion>3.0</RazorLangVersion> |
|
||||
<RootNamespace>Volo.Abp.TenantManagement.Blazor</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
<PropertyGroup> |
||||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" /> |
<TargetFramework>netstandard2.1</TargetFramework> |
||||
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.WebAssembly.Theming\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.csproj" /> |
<RazorLangVersion>3.0</RazorLangVersion> |
||||
</ItemGroup> |
</PropertyGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AutoMapper\Volo.Abp.AutoMapper.csproj" /> |
||||
|
<ProjectReference Include="..\..\..\..\framework\src\Volo.Abp.AspNetCore.Components.WebAssembly.Theming\Volo.Abp.AspNetCore.Components.WebAssembly.Theming.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<ProjectReference Include="..\Volo.Abp.TenantManagement.HttpApi.Client\Volo.Abp.TenantManagement.HttpApi.Client.csproj" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Content Update="Pages\TenantManagement\TenantManagement.razor"> |
||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile> |
||||
|
</Content> |
||||
|
</ItemGroup> |
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\Volo.Abp.TenantManagement.HttpApi.Client\Volo.Abp.TenantManagement.HttpApi.Client.csproj" /> |
|
||||
</ItemGroup> |
|
||||
</Project> |
</Project> |
||||
|
|||||
@ -1,5 +1,6 @@ |
|||||
@using Microsoft.AspNetCore.Components.Web |
@using Microsoft.AspNetCore.Components.Web |
||||
@using Volo.Abp.AspNetCore.Components.WebAssembly |
@using Volo.Abp.AspNetCore.Components.WebAssembly |
||||
|
@using Microsoft.AspNetCore.Components.Forms |
||||
@using Volo.Abp.BlazoriseUI |
@using Volo.Abp.BlazoriseUI |
||||
@using Blazorise |
@using Blazorise |
||||
@using Blazorise.DataGrid |
@using Blazorise.DataGrid |
||||
Loading…
Reference in new issue