Merge pull request #3548 from leigh-pointer/ModuleMangPages
Module Management Ehancement - show where modules are used.
This commit is contained in:
commit
e209becff9
|
@ -8,6 +8,8 @@
|
|||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||
@inject IPageModuleService PageModuleService
|
||||
@inject IModuleService ModuleService
|
||||
|
||||
@if (_initialized)
|
||||
{
|
||||
|
@ -131,6 +133,18 @@
|
|||
<button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">@SharedLocalizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
|
||||
</TabPanel>
|
||||
<TabPanel Name="Pages" ResourceKey="Pages" Heading="Pages">
|
||||
<Pager Items="@_pagesWithModules" RowClass="align-middle">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>@SharedLocalizer["Name"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><button type="button" class="btn btn-secondary" @onclick="@(async () => NavigationManager.NavigateTo(Browse(context)))">@Localizer["Browse"]</button></td>
|
||||
<td>@(string.IsNullOrEmpty(context.Title) ? @context.Name : @context.Title )</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
</TabPanel>
|
||||
<TabPanel Name="Translations" ResourceKey="Translations" Heading="Translations">
|
||||
@if (_languages != null && _languages.Count > 0)
|
||||
{
|
||||
|
@ -240,6 +254,8 @@
|
|||
private DateTime _createdon;
|
||||
private string _modifiedby;
|
||||
private DateTime _modifiedon;
|
||||
private List<Page> _pagesWithModules
|
||||
;
|
||||
|
||||
#pragma warning disable 649
|
||||
private PermissionGrid _permissionGrid;
|
||||
|
@ -291,6 +307,18 @@
|
|||
_languages = _languages.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
// Group modules by PageId
|
||||
// Get distinct PageIds where modules are present
|
||||
var distinctPageIds = PageState.Modules
|
||||
.Where(md => md.ModuleDefinition.ModuleDefinitionId == _moduleDefinitionId && md.IsDeleted == false)
|
||||
.Select(md => md.PageId)
|
||||
.Distinct();
|
||||
|
||||
// Filter and retrieve the corresponding pages
|
||||
_pagesWithModules = PageState.Pages
|
||||
.Where(pg => distinctPageIds.Contains(pg.PageId) && pg.IsDeleted == false)
|
||||
.ToList();
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
|
@ -439,5 +467,5 @@
|
|||
AddModuleMessage(Localizer["Error.Validate"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private string Browse(Page page) => string.IsNullOrEmpty(page.Url) ? NavigateUrl(page.Path) : page.Url;
|
||||
}
|
||||
|
|
|
@ -240,4 +240,13 @@
|
|||
<data name="Validate" xml:space="preserve">
|
||||
<value>Validate</value>
|
||||
</data>
|
||||
<data name="Browse" xml:space="preserve">
|
||||
<value>Browse</value>
|
||||
</data>
|
||||
<data name="Count" xml:space="preserve">
|
||||
<value>Module Count</value>
|
||||
</data>
|
||||
<data name="Pages.Heading" xml:space="preserve">
|
||||
<value>Pages</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user