Merge pull request #11124 from abpframework/auto-merge/rel-5-0/751

Merge branch dev with rel-5.0
pull/11126/head^2
maliming 4 years ago committed by GitHub
commit c0418008df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,7 @@ namespace Volo.Abp.Http.Client.Web.Conventions;
public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
{
protected readonly IClientProxyApiDescriptionFinder ClientProxyApiDescriptionFinder;
protected readonly List<ControllerModel> ControllerWithAttributeRoute;
protected readonly List<ActionModel> ActionWithAttributeRoute;
public AbpHttpClientProxyServiceConvention(
@ -30,6 +31,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
: base(options, conventionalRouteBuilder)
{
ClientProxyApiDescriptionFinder = clientProxyApiDescriptionFinder;
ControllerWithAttributeRoute = new List<ControllerModel>();
ActionWithAttributeRoute = new List<ActionModel>();
}
@ -51,15 +53,6 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
{
controller.ControllerName = controller.ControllerName.RemovePostFix("ClientProxy");
var moduleApiDescription = FindModuleApiDescriptionModel(controller);
if (moduleApiDescription != null && !moduleApiDescription.RootPath.IsNullOrWhiteSpace())
{
var selector = controller.Selectors.FirstOrDefault();
selector?.EndpointMetadata.Add(new AreaAttribute(moduleApiDescription.RootPath));
controller.RouteValues.Add(new KeyValuePair<string, string>("area", moduleApiDescription.RootPath));
}
var controllerApiDescription = FindControllerApiDescriptionModel(controller);
if (controllerApiDescription != null &&
!controllerApiDescription.ControllerGroupName.IsNullOrWhiteSpace())
@ -77,6 +70,14 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
{
RemoveEmptySelectors(controller.Selectors);
var moduleApiDescription = FindModuleApiDescriptionModel(controller);
if (moduleApiDescription != null && !moduleApiDescription.RootPath.IsNullOrWhiteSpace())
{
var selector = controller.Selectors.FirstOrDefault();
selector?.EndpointMetadata.Add(new AreaAttribute(moduleApiDescription.RootPath));
controller.RouteValues.Add(new KeyValuePair<string, string>("area", moduleApiDescription.RootPath));
}
var controllerType = controller.ControllerType.AsType();
var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault<RemoteServiceAttribute>(controllerType.GetTypeInfo());
if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(controllerType))
@ -111,15 +112,14 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
return;;
}
ControllerWithAttributeRoute.Add(controller);
ActionWithAttributeRoute.Add(action);
if (!action.Selectors.Any())
{
var abpServiceSelectorModel = new SelectorModel
{
AttributeRouteModel = new AttributeRouteModel(
new RouteAttribute(template: actionApiDescriptionModel.Url)
),
AttributeRouteModel = new AttributeRouteModel(new RouteAttribute(template: actionApiDescriptionModel.Url)),
ActionConstraints = { new HttpMethodActionConstraint(new[] { actionApiDescriptionModel.HttpMethod }) }
};
@ -142,9 +142,7 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
if (selector.AttributeRouteModel == null)
{
selector.AttributeRouteModel = new AttributeRouteModel(
new RouteAttribute(template: actionApiDescriptionModel.Url)
);
selector.AttributeRouteModel = new AttributeRouteModel(new RouteAttribute(template: actionApiDescriptionModel.Url));
}
if (!selector.ActionConstraints.OfType<HttpMethodActionConstraint>().Any())
@ -157,14 +155,17 @@ public class AbpHttpClientProxyServiceConvention : AbpServiceConvention
protected virtual void ConfigureClientProxyApiExplorer(ControllerModel controller)
{
if (controller.ApiExplorer.GroupName.IsNullOrEmpty())
if (ControllerWithAttributeRoute.Contains(controller))
{
controller.ApiExplorer.GroupName = controller.ControllerName;
}
if (controller.ApiExplorer.GroupName.IsNullOrEmpty())
{
controller.ApiExplorer.GroupName = controller.ControllerName;
}
if (controller.ApiExplorer.IsVisible == null)
{
controller.ApiExplorer.IsVisible = IsVisibleRemoteService(controller.ControllerType);
if (controller.ApiExplorer.IsVisible == null)
{
controller.ApiExplorer.IsVisible = IsVisibleRemoteService(controller.ControllerType);
}
}
foreach (var action in controller.Actions)

@ -56,6 +56,17 @@
"@angular/platform-browser": "12.2.13",
"@angular/platform-browser-dynamic": "12.2.13",
"@angular/router": "12.2.13",
"@abp/ng.account": "~5.0.1",
"@abp/ng.account.core": "~5.0.1",
"@abp/ng.core": "~5.0.1",
"@abp/ng.feature-management": "~5.0.1",
"@abp/ng.identity": "~5.0.1",
"@abp/ng.permission-management": "~5.0.1",
"@abp/ng.schematics": "~5.0.1",
"@abp/ng.setting-management": "~5.0.1",
"@abp/ng.tenant-management": "~5.0.1",
"@abp/ng.theme.basic": "~5.0.1",
"@abp/ng.theme.shared": "~5.0.1",
"@fortawesome/fontawesome-free": "^5.15.4",
"@ng-bootstrap/ng-bootstrap": "11.0.0-beta.2",
"@ngneat/spectator": "^8.0.3",

@ -198,6 +198,5 @@ describe('DynamicLayoutComponent', () => {
spectator.detectComponentChanges();
expect(spectator.query('abp-layout-empty')).toBeFalsy();
expect(spectator.query('abp-dynamic-layout').children[0].tagName).toEqual('ROUTER-OUTLET');
});
});

Loading…
Cancel
Save