Browse Source

Merge pull request #96 from abpframework/11949-Moving-Files

11949 moving files
pull/98/head
Galip Tolga Erdem 4 years ago
committed by GitHub
parent
commit
797fd3f462
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs
  2. 19
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml
  3. 13
      gateways/web-public/src/EShopOnAbp.WebPublicGateway/ocelot.json
  4. 18
      services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs
  5. 12
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/EShopOnAbp.CatalogService.HttpApi.Host.csproj
  6. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/asus.jpg
  7. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/beats.jpg
  8. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/bluecat.jpg
  9. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/lego.jpg
  10. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/nikon.jpg
  11. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/noimage.jpg
  12. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/oki.jpg
  13. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/playstation.jpg
  14. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/rampage.jpg
  15. 0
      services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/sunny.jpg

28
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs

@ -1,25 +1,32 @@
using EShopOnAbp.BasketService;
using EShopOnAbp.CatalogService;
using EShopOnAbp.Localization;
using EShopOnAbp.OrderingService;
using EShopOnAbp.PaymentService;
using EShopOnAbp.PaymentService.PaymentMethods;
using EShopOnAbp.PublicWeb.AnonymousUser;
using EShopOnAbp.PublicWeb.Components.Toolbar.Cart;
using EShopOnAbp.PublicWeb.Menus;
using EShopOnAbp.PublicWeb.PaymentMethods;
using EShopOnAbp.Shared.Hosting.AspNetCore;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
using StackExchange.Redis;
using System;
using System.Net.Http.Headers;
using EShopOnAbp.OrderingService;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Authentication.OpenIdConnect;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars;
using Volo.Abp.AspNetCore.SignalR;
@ -27,20 +34,14 @@ using Volo.Abp.AutoMapper;
using Volo.Abp.Caching;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.EventBus.RabbitMq;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.UI.Navigation;
using Volo.Abp.UI.Navigation.Urls;
using Yarp.ReverseProxy.Transforms;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
using EShopOnAbp.PublicWeb.Components.Toolbar.Cart;
using EShopOnAbp.PublicWeb.PaymentMethods;
using EShopOnAbp.PaymentService.PaymentMethods;
using EShopOnAbp.PublicWeb.AnonymousUser;
using Microsoft.Extensions.Configuration;
using Volo.Abp.VirtualFileSystem;
using Yarp.ReverseProxy.Transforms;
namespace EShopOnAbp.PublicWeb;
@ -77,7 +78,6 @@ public class EShopOnAbpPublicWebModule : AbpModule
public override void ConfigureServices(ServiceConfigurationContext context)
{
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
ConfigureBasketHttpClient(context);
@ -93,6 +93,12 @@ public class EShopOnAbpPublicWebModule : AbpModule
);
});
context.Services.Configure<AbpRemoteServiceOptions>(options =>
{
options.RemoteServices.Default =
new RemoteServiceConfiguration(configuration["RemoteServices:Default:BaseUrl"]);
});
Configure<AbpMultiTenancyOptions>(options => { options.IsEnabled = true; });
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "EShopOnAbp:"; });
@ -167,7 +173,7 @@ public class EShopOnAbpPublicWebModule : AbpModule
context.Services.AddStaticHttpClientProxies(
typeof(BasketServiceContractsModule).Assembly, remoteServiceConfigurationName: BasketServiceConstants.RemoteServiceName
);
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<EShopOnAbpPublicWebModule>();

19
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml

@ -2,8 +2,11 @@
@using EShopOnAbp.Localization
@using Microsoft.Extensions.Localization
@using System.Globalization
@using Microsoft.Extensions.Options
@using Volo.Abp.Http.Client
@model EShopOnAbp.PublicWeb.Pages.IndexModel
@inject IStringLocalizer<EShopOnAbpResource> L
@inject IOptions<AbpRemoteServiceOptions> options
@{
const int productsColumnSize = 4; // TODO: update abp-column helper to plain html for proper row and columns css
@ -11,12 +14,12 @@
}
@section styles{
<abp-style src="/Pages/index.css"/>
<abp-style src="/Pages/index.css" />
}
@section scripts {
<abp-script src="/client-proxies/basket-proxy.js"/>
<abp-script src="/Pages/index.js"/>
<abp-script src="/client-proxies/basket-proxy.js" />
<abp-script src="/Pages/index.js" />
}
@if (Model.HasRemoteServiceError)
@ -28,7 +31,7 @@
<div class="col-lg-12">
<h3 class="pt-5 pb-4 text-center">@pageHeader</h3>
<div class="product-list">
@for (int i = 0; i < Math.Ceiling(Model.Products.Count / (double) productsColumnSize); i++)
@for (int i = 0; i < Math.Ceiling(Model.Products.Count / (double)productsColumnSize); i++)
{
<abp-row>
@for (int j = 0; j < productsColumnSize; j++)
@ -38,7 +41,7 @@
{
var product = Model.Products[(i * productsColumnSize) + j];
var productPrice = product.Price.ToString("C", new CultureInfo("en-US"));
string productImage = !product.ImageName.IsNullOrEmpty() ? $"/product-images/{product.ImageName}" : "/product-images/@product.ImageName";
string productImage = !product.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{product.ImageName}" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/@product.ImageName";
string buyText = L["Index:AddToBasket"];
<div class="product-list-item" data-product-id="@product.Id.ToString()">
<div class="col">
@ -47,10 +50,10 @@
<em class="d-block text-muted">@product.Code - @L["StockCount"]: @product.StockCount</em>
</div>
</div>
<img src="@productImage"/>
<img src="@productImage" />
<div class="row mt-5 ">
@if(product.StockCount > 0)
{
@if (product.StockCount > 0)
{
<abp-button class="add-basket-button" button-type="Warning" text="@buyText" data-product-id="@product.Id.ToString()"></abp-button>
}
else

13
gateways/web-public/src/EShopOnAbp.WebPublicGateway/ocelot.json

@ -52,6 +52,19 @@
"TimeoutValue": 2500
}
},
{
"ServiceKey": "Catalog Service",
"DownstreamPathTemplate": "/product-images/{everything}",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 44354
}
],
"UpstreamPathTemplate": "/product-images/{everything}",
"UpstreamHttpMethod": [ "Get" ]
},
{
"ServiceKey": "Basket Service",
"DownstreamPathTemplate": "/api/basket/{everything}",

18
services/basket/src/EShopOnAbp.BasketService/BasketServiceModule.cs

@ -28,18 +28,18 @@ namespace EShopOnAbp.BasketService;
typeof(BasketServiceContractsModule),
typeof(EShopOnAbpSharedHostingMicroservicesModule)
)]
public class BasketServiceModule : AbpModule
public class BasketServiceModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = hostingEnvironment.IsDevelopment();
var configuration = context.Services.GetConfiguration();
ConfigureAutoMapper();
ConfigureAspNetCoreRouting(context);
ConfigureAspNetCoreRouting();
ConfigureGrpc(context);
ConfigureDistributedCache();
ConfigureVirtualFileSystem();
@ -48,7 +48,7 @@ public class BasketServiceModule : AbpModule
ConfigureAutoApiControllers();
}
private void ConfigureAspNetCoreRouting(ServiceConfigurationContext context)
private void ConfigureAspNetCoreRouting()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
@ -91,7 +91,7 @@ public class BasketServiceModule : AbpModule
app.UseUnitOfWork();
app.UseConfiguredEndpoints();
}
private void ConfigureSwagger(ServiceConfigurationContext context, IConfiguration configuration)
{
SwaggerConfigurationHelper.ConfigureWithAuth(
@ -105,7 +105,7 @@ public class BasketServiceModule : AbpModule
apiTitle: "Basket Service API"
);
}
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
JwtBearerConfigurationHelper.Configure(context, "BasketService");
@ -128,7 +128,7 @@ public class BasketServiceModule : AbpModule
.AllowCredentials();
});
});
Configure<AbpAntiForgeryOptions>(options => { options.AutoValidate = false; });
}
@ -142,12 +142,12 @@ public class BasketServiceModule : AbpModule
private void ConfigureGrpc(ServiceConfigurationContext context)
{
context.Services.AddGrpcClient<ProductPublic.ProductPublicClient>((services, options) =>
context.Services.AddGrpcClient<ProductPublic.ProductPublicClient>((services, options) =>
{
var remoteServiceOptions = services.GetRequiredService<IOptionsMonitor<AbpRemoteServiceOptions>>().CurrentValue;
var catalogServiceConfiguration = remoteServiceOptions.RemoteServices.GetConfigurationOrDefault("Catalog");
var catalogGrpcUrl = catalogServiceConfiguration.GetOrDefault("GrpcUrl");
options.Address = new Uri(catalogGrpcUrl);
});
}

12
services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/EShopOnAbp.CatalogService.HttpApi.Host.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\..\common.props" />
@ -30,4 +30,14 @@
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<None Remove="wwwroot\product-images\*.jpg" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\product-images\*.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
</Project>

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/asus.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/asus.jpg

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/beats.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/beats.jpg

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/bluecat.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/bluecat.jpg

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/lego.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/lego.jpg

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/nikon.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/nikon.jpg

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/noimage.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/noimage.jpg

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/oki.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/oki.jpg

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/playstation.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/playstation.jpg

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/rampage.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/rampage.jpg

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

0
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/product-images/sunny.jpg → services/catalog/src/EShopOnAbp.CatalogService.HttpApi.Host/wwwroot/product-images/sunny.jpg

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Loading…
Cancel
Save