tenant management web layout extended

pull/4861/head
Ahmet Çotur 5 years ago
parent b646388195
commit cf17af4199

@ -5,6 +5,8 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.FeatureManagement; using Volo.Abp.FeatureManagement;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.ObjectExtending.Modularity;
using Volo.Abp.TenantManagement.Localization; using Volo.Abp.TenantManagement.Localization;
using Volo.Abp.TenantManagement.Web.Navigation; using Volo.Abp.TenantManagement.Web.Navigation;
using Volo.Abp.UI.Navigation; using Volo.Abp.UI.Navigation;
@ -57,5 +59,16 @@ namespace Volo.Abp.TenantManagement.Web
options.Conventions.AuthorizePage("/TenantManagement/Tenants/ConnectionStrings", TenantManagementPermissions.Tenants.ManageConnectionStrings); options.Conventions.AuthorizePage("/TenantManagement/Tenants/ConnectionStrings", TenantManagementPermissions.Tenants.ManageConnectionStrings);
}); });
} }
public override void PostConfigureServices(ServiceConfigurationContext context)
{
ModuleExtensionConfigurationHelper
.ApplyEntityConfigurationToUi(
TenantManagementModuleExtensionConsts.ModuleName,
TenantManagementModuleExtensionConsts.EntityNames.Tenant,
createFormTypes: new[] { typeof(Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants.CreateModalModel.TenantInfoModel) },
editFormTypes: new[] { typeof(Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants.EditModalModel.TenantInfoModel) }
);
}
} }
} }

@ -1,10 +1,13 @@
@page @page
@using Microsoft.Extensions.Localization @using Microsoft.Extensions.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Abp.Localization
@using Volo.Abp.ObjectExtending
@using Volo.Abp.TenantManagement.Localization @using Volo.Abp.TenantManagement.Localization
@using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants @using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
@model CreateModalModel @model CreateModalModel
@inject IStringLocalizer<AbpTenantManagementResource> L @inject IStringLocalizer<AbpTenantManagementResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@{ @{
Layout = null; Layout = null;
} }
@ -17,6 +20,23 @@
<abp-input asp-for="Tenant.AdminEmailAddress" /> <abp-input asp-for="Tenant.AdminEmailAddress" />
<abp-input asp-for="Tenant.AdminPassword" /> <abp-input asp-for="Tenant.AdminPassword" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<CreateModalModel.TenantInfoModel>())
{
if (propertyInfo.Type.IsEnum)
{
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"></abp-select>
}
else
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
asp-format="@propertyInfo.GetInputFormatOrNull()"
value="@propertyInfo.GetInputValueOrNull(Model.Tenant.ExtraProperties[propertyInfo.Name])" />
}
}
</abp-modal-body> </abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer> <abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal> </abp-modal>

@ -1,6 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Validation; using Volo.Abp.Validation;
namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
@ -32,7 +33,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
return NoContent(); return NoContent();
} }
public class TenantInfoModel public class TenantInfoModel: ExtensibleObject
{ {
[Required] [Required]
[DynamicStringLength(typeof(TenantConsts), nameof(TenantConsts.MaxNameLength))] [DynamicStringLength(typeof(TenantConsts), nameof(TenantConsts.MaxNameLength))]

@ -1,10 +1,14 @@
@page @page
@using Microsoft.AspNetCore.Mvc.Localization @using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal @using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal
@using Volo.Abp.Localization
@using Volo.Abp.ObjectExtending
@using Volo.Abp.TenantManagement.Localization @using Volo.Abp.TenantManagement.Localization
@using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants @using Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
@model EditModalModel @model EditModalModel
@inject IHtmlLocalizer<AbpTenantManagementResource> L @inject IHtmlLocalizer<AbpTenantManagementResource> L
@inject IStringLocalizerFactory StringLocalizerFactory
@{ @{
Layout = null; Layout = null;
} }
@ -14,6 +18,12 @@
<abp-modal-body> <abp-modal-body>
<input asp-for="Tenant.Id" /> <input asp-for="Tenant.Id" />
<abp-input asp-for="Tenant.Name" label="@L["TenantName"].Value" /> <abp-input asp-for="Tenant.Name" label="@L["TenantName"].Value" />
@foreach (var propertyInfo in ObjectExtensionManager.Instance.GetProperties<EditModalModel.TenantInfoModel>())
{
<abp-input type="@propertyInfo.GetInputType()"
asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)" />
}
</abp-modal-body> </abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer> <abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>
</abp-modal> </abp-modal>

@ -2,6 +2,7 @@ using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Validation; using Volo.Abp.Validation;
namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
@ -37,7 +38,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants
return NoContent(); return NoContent();
} }
public class TenantInfoModel public class TenantInfoModel : ExtensibleObject
{ {
[HiddenInput] [HiddenInput]
public Guid Id { get; set; } public Guid Id { get; set; }

@ -37,13 +37,6 @@
</abp-row> </abp-row>
</abp-card-header> </abp-card-header>
<abp-card-body> <abp-card-body>
<abp-table striped-rows="true" class="nowrap"> <abp-table striped-rows="true" class="nowrap"></abp-table>
<thead>
<tr>
<th>@L["Actions"]</th>
<th>@L["TenantName"]</th>
</tr>
</thead>
</abp-table>
</abp-card-body> </abp-card-body>
</abp-card> </abp-card>

@ -17,19 +17,12 @@
modalClass: 'TenantConnectionStringManagement', modalClass: 'TenantConnectionStringManagement',
}); });
$(function () { abp.ui.extensions.tableColumns.get("tenant").addContributor(
var _$wrapper = $('#TenantsWrapper'); function (columnList) {
columnList.addManyTail(
var _dataTable = _$wrapper.find('table').DataTable( [
abp.libs.datatables.normalizeConfiguration({
order: [[1, 'asc']],
processing: true,
paging: true,
scrollX: true,
serverSide: true,
ajax: abp.libs.datatables.createAjax(_tenantAppService.getList),
columnDefs: [
{ {
title: l("Actions"),
rowAction: { rowAction: {
items: [ items: [
{ {
@ -89,9 +82,27 @@
}, },
}, },
{ {
title: l("TenantName"),
data: 'name', data: 'name',
}, }
], ]
);
},
0 //adds as the first contributor
);
$(function () {
var _$wrapper = $('#TenantsWrapper');
var _dataTable = _$wrapper.find('table').DataTable(
abp.libs.datatables.normalizeConfiguration({
order: [[1, 'asc']],
processing: true,
paging: true,
scrollX: true,
serverSide: true,
ajax: abp.libs.datatables.createAjax(_tenantAppService.getList),
columnDefs: abp.ui.extensions.tableColumns.get("tenant").columns.toArray(),
}) })
); );

Loading…
Cancel
Save