mirror of https://github.com/abpframework/abp.git
129 changed files with 10347 additions and 7579 deletions
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApplicationPath |
|||
{ |
|||
public class AbpApplicationPathViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
var applicationPath = ViewContext.HttpContext.Request.PathBase.Value; |
|||
var model = new AbpApplicationPathViewComponentModel |
|||
{ |
|||
ApplicationPath = applicationPath == null ? "/" : applicationPath.EnsureEndsWith('/') |
|||
}; |
|||
|
|||
return View("~/Pages/Shared/Components/AbpApplicationPath/Default.cshtml",model); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApplicationPath |
|||
{ |
|||
public class AbpApplicationPathViewComponentModel |
|||
{ |
|||
public string ApplicationPath { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
@model Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpApplicationPath.AbpApplicationPathViewComponentModel |
|||
<script type="text/javascript"> |
|||
var abp = abp || {}; abp.appPath = '@Model.ApplicationPath'; |
|||
</script> |
|||
@ -0,0 +1,13 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Pages.Shared.Components.AbpPageSearchBox |
|||
{ |
|||
public class AbpPageSearchBoxViewComponent : AbpViewComponent |
|||
{ |
|||
public IViewComponentResult Invoke() |
|||
{ |
|||
return View("~/Pages/Shared/Components/AbpPageSearchBox/Default.cshtml"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
@using Localization.Resources.AbpUi |
|||
@using Microsoft.Extensions.Localization |
|||
@inject IStringLocalizer<AbpUiResource> L |
|||
<form method="post" class="page-search-form"> |
|||
<div class="input-group"> |
|||
<input class="form-control page-search-filter-text" placeholder="@L["Search"].Value"> |
|||
<div class="input-group-append"> |
|||
<abp-button button-type="Primary" type="submit"> |
|||
<i class="fa fa-search" aria-hidden="true"></i> |
|||
</abp-button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
@ -0,0 +1,167 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using Microsoft.AspNetCore.Mvc.ApplicationParts; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc |
|||
{ |
|||
/// <summary>
|
|||
/// This class is used to align order of the MVC Application Parts with the order of
|
|||
/// ABP module dependencies.
|
|||
/// </summary>
|
|||
public static class ApplicationPartSorter |
|||
{ |
|||
public static void Sort(ApplicationPartManager partManager, IModuleContainer moduleContainer) |
|||
{ |
|||
/* Performing a double Reverse() to preserve the original order for non-sorted parts |
|||
*/ |
|||
|
|||
var dependencyDictionary = CreateDependencyDictionary(partManager, moduleContainer); |
|||
|
|||
var sortedParts = partManager |
|||
.ApplicationParts |
|||
.Reverse() //First Revers
|
|||
.SortByDependencies(p => dependencyDictionary[p]); |
|||
|
|||
sortedParts.Reverse(); //Reverse again
|
|||
|
|||
//Replace the original parts with the sorted parts
|
|||
partManager.ApplicationParts.Clear(); |
|||
foreach (var applicationPart in sortedParts) |
|||
{ |
|||
partManager.ApplicationParts.Add(applicationPart); |
|||
} |
|||
} |
|||
|
|||
private static Dictionary<ApplicationPart, List<ApplicationPart>> CreateDependencyDictionary( |
|||
ApplicationPartManager partManager, IModuleContainer moduleContainer) |
|||
{ |
|||
var dependencyDictionary = new Dictionary<ApplicationPart, List<ApplicationPart>>(); |
|||
|
|||
foreach (var applicationPart in partManager.ApplicationParts) |
|||
{ |
|||
dependencyDictionary[applicationPart] = |
|||
CreateDependencyList(applicationPart, partManager, moduleContainer); |
|||
} |
|||
|
|||
return dependencyDictionary; |
|||
} |
|||
|
|||
private static List<ApplicationPart> CreateDependencyList( |
|||
ApplicationPart applicationPart, |
|||
ApplicationPartManager partManager, |
|||
IModuleContainer moduleContainer) |
|||
{ |
|||
var list = new List<ApplicationPart>(); |
|||
|
|||
if (applicationPart is AssemblyPart assemblyPart) |
|||
{ |
|||
AddDependencies(list, assemblyPart, partManager, moduleContainer); |
|||
} |
|||
else if (applicationPart is CompiledRazorAssemblyPart compiledRazorAssemblyPart) |
|||
{ |
|||
AddDependencies(list, compiledRazorAssemblyPart, partManager, moduleContainer); |
|||
} |
|||
|
|||
return list; |
|||
} |
|||
|
|||
private static void AddDependencies( |
|||
List<ApplicationPart> list, |
|||
AssemblyPart assemblyPart, |
|||
ApplicationPartManager partManager, |
|||
IModuleContainer moduleContainer) |
|||
{ |
|||
var dependedAssemblyParts = GetDependedAssemblyParts( |
|||
partManager, |
|||
moduleContainer, |
|||
assemblyPart |
|||
); |
|||
|
|||
list.AddRange(dependedAssemblyParts); |
|||
|
|||
foreach (var dependedAssemblyPart in dependedAssemblyParts) |
|||
{ |
|||
var viewsPart = GetViewsPartOrNull(partManager, dependedAssemblyPart); |
|||
if (viewsPart != null) |
|||
{ |
|||
list.Add(viewsPart); |
|||
} |
|||
} |
|||
} |
|||
|
|||
private static void AddDependencies( |
|||
List<ApplicationPart> list, |
|||
CompiledRazorAssemblyPart compiledRazorAssemblyPart, |
|||
ApplicationPartManager partManager, |
|||
IModuleContainer moduleContainer) |
|||
{ |
|||
if (!compiledRazorAssemblyPart.Name.EndsWith(".Views")) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
var originalAssemblyPart = GetOriginalAssemblyPartOrNull(compiledRazorAssemblyPart, partManager); |
|||
if (originalAssemblyPart == null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
list.Add(originalAssemblyPart); |
|||
} |
|||
|
|||
private static AssemblyPart[] GetDependedAssemblyParts( |
|||
ApplicationPartManager partManager, |
|||
IModuleContainer moduleContainer, |
|||
AssemblyPart assemblyPart) |
|||
{ |
|||
var moduleDescriptor = GetModuleDescriptorForAssemblyOrNull(moduleContainer, assemblyPart.Assembly); |
|||
if (moduleDescriptor == null) |
|||
{ |
|||
return Array.Empty<AssemblyPart>(); |
|||
} |
|||
|
|||
var moduleDependedAssemblies = moduleDescriptor |
|||
.Dependencies |
|||
.Select(d => d.Assembly) |
|||
.ToArray(); |
|||
|
|||
return partManager.ApplicationParts |
|||
.OfType<AssemblyPart>() |
|||
.Where(a => a.Assembly.IsIn(moduleDependedAssemblies)) |
|||
.Distinct() |
|||
.ToArray(); |
|||
} |
|||
|
|||
private static CompiledRazorAssemblyPart GetViewsPartOrNull(ApplicationPartManager partManager, |
|||
ApplicationPart assemblyPart) |
|||
{ |
|||
var viewsAssemblyName = assemblyPart.Name + ".Views"; |
|||
return partManager |
|||
.ApplicationParts |
|||
.OfType<CompiledRazorAssemblyPart>() |
|||
.FirstOrDefault(p => p.Name == viewsAssemblyName); |
|||
} |
|||
|
|||
private static AssemblyPart GetOriginalAssemblyPartOrNull( |
|||
CompiledRazorAssemblyPart compiledRazorAssemblyPart, |
|||
ApplicationPartManager partManager) |
|||
{ |
|||
var originalAssemblyName = compiledRazorAssemblyPart.Name.RemovePostFix(".Views"); |
|||
return partManager.ApplicationParts |
|||
.OfType<AssemblyPart>() |
|||
.FirstOrDefault(p => p.Name == originalAssemblyName); |
|||
} |
|||
|
|||
private static IAbpModuleDescriptor GetModuleDescriptorForAssemblyOrNull( |
|||
IModuleContainer moduleContainer, |
|||
Assembly assembly) |
|||
{ |
|||
return moduleContainer |
|||
.Modules |
|||
.FirstOrDefault(m => m.Assembly == assembly); |
|||
} |
|||
} |
|||
} |
|||
@ -1,2 +0,0 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@ -0,0 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -1,4 +1,4 @@ |
|||
@using Localization.Resources.AbpUi |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@inject IHtmlLocalizer<AbpUiResource> L |
|||
<a href="/Account/Login">@L["Login"]</a> |
|||
<a href="~/Account/Login">@L["Login"]</a> |
|||
|
|||
@ -1,2 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -0,0 +1,5 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@addTagHelper *, Volo.Docs.Admin.Web |
|||
@ -1,2 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -1,2 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -1,7 +1,8 @@ |
|||
namespace Volo.Abp.Users.MongoDB |
|||
{ |
|||
[Collection(MongoTestCollection.Name)] |
|||
public class ExternalUserLookupService_Tests : ExternalUserLookupService_Tests<AbpUsersMongoDbTestModule> |
|||
{ |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,7 +1,8 @@ |
|||
namespace Volo.Abp.Users.MongoDB |
|||
{ |
|||
[Collection(MongoTestCollection.Name)] |
|||
public class LocalUserLookupService_Tests : LocalUserLookupService_Tests<AbpUsersMongoDbTestModule> |
|||
{ |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using Mongo2Go; |
|||
|
|||
namespace Volo.Abp.Users.MongoDB |
|||
{ |
|||
public class MongoDbFixture : IDisposable |
|||
{ |
|||
private static readonly MongoDbRunner MongoDbRunner; |
|||
public static readonly string ConnectionString; |
|||
|
|||
static MongoDbFixture() |
|||
{ |
|||
MongoDbRunner = MongoDbRunner.Start(); |
|||
ConnectionString = MongoDbRunner.ConnectionString; |
|||
} |
|||
|
|||
public void Dispose() |
|||
{ |
|||
MongoDbRunner?.Dispose(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Xunit; |
|||
|
|||
namespace Volo.Abp.Users.MongoDB |
|||
{ |
|||
[CollectionDefinition(Name)] |
|||
public class MongoTestCollection : ICollectionFixture<MongoDbFixture> |
|||
{ |
|||
public const string Name = "MongoDB Collection"; |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue