From f39fdb92ca2ac23582a4eec6a5e386abdd6a0002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Thu, 13 Jul 2017 17:35:19 +0200 Subject: [PATCH 1/8] Fix Failing middleware and move it to Basket.api --- .../FailingMiddlewareAppBuilderExtensions.cs | 2 +- .../Middlewares/FailingMiddleware.cs | 13 +++++++++---- .../Middlewares/FailingOptions.cs | 3 ++- .../Middlewares/FailingStartupFilter.cs | 11 +++++------ .../FailingWebHostBuilderExtensions.cs | 11 +++-------- src/Services/Basket/Basket.API/Program.cs | 10 +++++++++- src/Services/Ordering/Ordering.API/Program.cs | 1 - src/Web/WebMVC/Controllers/OrderController.cs | 2 +- src/Web/WebMVC/ViewComponents/Cart.cs | 18 ++++++++++++++---- .../Shared/Components/Cart/Default.cshtml | 16 ++++++++++++---- src/Web/WebMVC/wwwroot/css/_variables.scss | 7 +++++++ .../WebMVC/wwwroot/css/app.component.min.css | 1 + .../basket-status/basket-status.component.css | 15 +++++++++++++++ .../basket-status.component.min.css | 1 + .../basket-status/basket-status.component.scss | 16 ++++++++++++++++ .../css/basket/basket.component.min.css | 1 + .../css/catalog/catalog.component.min.css | 1 + .../orders-detail.component.min.css | 1 + .../orders-new/orders-new.component.min.css | 1 + .../css/orders/orders.component.min.css | 1 + .../shared/components/header/header.min.css | 1 + .../css/shared/components/pager/pager.min.css | 1 + 22 files changed, 103 insertions(+), 31 deletions(-) rename src/Services/{Ordering/Ordering.API/Infrastructure/Middlewares => Basket/Basket.API/Infrastructure/Exceptions}/FailingMiddlewareAppBuilderExtensions.cs (93%) rename src/Services/{Ordering/Ordering.API => Basket/Basket.API}/Infrastructure/Middlewares/FailingMiddleware.cs (88%) rename src/Services/{Ordering/Ordering.API => Basket/Basket.API}/Infrastructure/Middlewares/FailingOptions.cs (60%) rename src/Services/{Ordering/Ordering.API => Basket/Basket.API}/Infrastructure/Middlewares/FailingStartupFilter.cs (57%) rename src/Services/{Ordering/Ordering.API => Basket/Basket.API}/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs (66%) create mode 100644 src/Web/WebMVC/wwwroot/css/app.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/basket/basket.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/catalog/catalog.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/orders/orders-detail/orders-detail.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/orders/orders-new/orders-new.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/orders/orders.component.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/shared/components/header/header.min.css create mode 100644 src/Web/WebMVC/wwwroot/css/shared/components/pager/pager.min.css diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddlewareAppBuilderExtensions.cs b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs similarity index 93% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddlewareAppBuilderExtensions.cs rename to src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs index 15bf596cc..935bb79a8 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddlewareAppBuilderExtensions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Exceptions/FailingMiddlewareAppBuilderExtensions.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public static class FailingMiddlewareAppBuilderExtensions { diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddleware.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs similarity index 88% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddleware.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs index 2c82547e2..05acd0d2c 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingMiddleware.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingMiddleware.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public class FailingMiddleware { @@ -26,8 +26,7 @@ namespace Ordering.API.Infrastructure.Middlewares return; } - - if (_mustFail) + if (MustFail(context)) { context.Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError; context.Response.ContentType = "text/plain"; @@ -42,7 +41,7 @@ namespace Ordering.API.Infrastructure.Middlewares private async Task ProcessConfigRequest(HttpContext context) { var enable = context.Request.Query.Keys.Any(k => k == "enable"); - var disable = context.Request.Query.Keys.Any(k => k == "disable"); + var disable = context.Request.Query.Keys.Any(k => k == "disable"); if (enable && disable) { @@ -74,5 +73,11 @@ namespace Ordering.API.Infrastructure.Middlewares await context.Response.WriteAsync(message); } + private bool MustFail(HttpContext context) + { + return _mustFail && + (_options.EndpointPaths.Any(x => x == context.Request.Path.Value) + || _options.EndpointPaths.Count == 0); + } } } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingOptions.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs similarity index 60% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingOptions.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs index a93a2b49b..b31207e00 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingOptions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingOptions.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public class FailingOptions { public string ConfigPath = "/Failing"; + public List EndpointPaths { get; set; } = new List(); } } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingStartupFilter.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingStartupFilter.cs similarity index 57% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingStartupFilter.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingStartupFilter.cs index 028239f2d..7d3b2ce18 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingStartupFilter.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingStartupFilter.cs @@ -1,23 +1,22 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -namespace Ordering.API.Infrastructure.Middlewares +namespace Basket.API.Infrastructure.Middlewares { public class FailingStartupFilter : IStartupFilter { - public FailingStartupFilter() + private readonly Action _options; + public FailingStartupFilter(Action optionsAction) { + _options = optionsAction; } public Action Configure(Action next) { return app => { - app.UseFailingMiddleware(); + app.UseFailingMiddleware(_options); next(app); }; } diff --git a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs similarity index 66% rename from src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs rename to src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs index 1c4979fae..99be1b182 100644 --- a/src/Services/Ordering/Ordering.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs +++ b/src/Services/Basket/Basket.API/Infrastructure/Middlewares/FailingWebHostBuilderExtensions.cs @@ -1,23 +1,18 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; -using Ordering.API.Infrastructure.Middlewares; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Hosting +namespace Basket.API.Infrastructure.Middlewares { public static class WebHostBuildertExtensions { - public static IWebHostBuilder UseFailing(this IWebHostBuilder builder, string path) + public static IWebHostBuilder UseFailing(this IWebHostBuilder builder, Action options) { builder.ConfigureServices(services => { - services.AddSingleton(new FailingStartupFilter()); + services.AddSingleton(new FailingStartupFilter(options)); }); return builder; } - } } diff --git a/src/Services/Basket/Basket.API/Program.cs b/src/Services/Basket/Basket.API/Program.cs index 74ab84c18..3eeeb2479 100644 --- a/src/Services/Basket/Basket.API/Program.cs +++ b/src/Services/Basket/Basket.API/Program.cs @@ -1,5 +1,7 @@ -using Microsoft.AspNetCore.Builder; +using Basket.API.Infrastructure.Middlewares; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using System.Collections.Generic; using System.IO; namespace Microsoft.eShopOnContainers.Services.Basket.API @@ -10,6 +12,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API { var host = new WebHostBuilder() .UseKestrel() + .UseFailing(options => + { + options.ConfigPath = "/Failing"; + options.EndpointPaths = new List() + { "/api/v1/basket/checkout", "/hc" }; + }) .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() diff --git a/src/Services/Ordering/Ordering.API/Program.cs b/src/Services/Ordering/Ordering.API/Program.cs index 752c15e80..ba92a2da9 100644 --- a/src/Services/Ordering/Ordering.API/Program.cs +++ b/src/Services/Ordering/Ordering.API/Program.cs @@ -10,7 +10,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API { var host = new WebHostBuilder() .UseKestrel() - .UseFailing("/Failing") .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() diff --git a/src/Web/WebMVC/Controllers/OrderController.cs b/src/Web/WebMVC/Controllers/OrderController.cs index 8f34c2282..11e688728 100644 --- a/src/Web/WebMVC/Controllers/OrderController.cs +++ b/src/Web/WebMVC/Controllers/OrderController.cs @@ -56,7 +56,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { ModelState.AddModelError("Error", "It was not possible to create a new order, please try later on. (Business Msg Due to Circuit-Breaker)"); } - return View(model); + return View("Create", model); } public async Task Cancel(string orderId) diff --git a/src/Web/WebMVC/ViewComponents/Cart.cs b/src/Web/WebMVC/ViewComponents/Cart.cs index 2db0e35b6..4e5aae38f 100644 --- a/src/Web/WebMVC/ViewComponents/Cart.cs +++ b/src/Web/WebMVC/ViewComponents/Cart.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Polly.CircuitBreaker; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents { @@ -17,11 +18,20 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents public async Task InvokeAsync(ApplicationUser user) { - var itemsInCart = await ItemsInCartAsync(user); - var vm = new CartComponentViewModel() + var vm = new CartComponentViewModel(); + try { - ItemsCount = itemsInCart - }; + var itemsInCart = await ItemsInCartAsync(user); + vm.ItemsCount = itemsInCart; + return View(vm); + } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + ViewBag.IsBasketInoperative = true; + vm.ItemsCount = 0; + } + return View(vm); } private async Task ItemsInCartAsync(ApplicationUser user) diff --git a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml index 4c8374f66..6ad90c81d 100644 --- a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml +++ b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml @@ -8,13 +8,21 @@ asp-area="" asp-controller="Cart" asp-action="Index"> -
-
- @Model.ItemsCount -
+ @if (ViewBag.IsBasketInoperative == true) + { +
+ @Model.ItemsCount +
+ } + else + { +
+ @Model.ItemsCount +
+ } diff --git a/src/Web/WebMVC/wwwroot/css/_variables.scss b/src/Web/WebMVC/wwwroot/css/_variables.scss index 0acfde727..4b989c185 100644 --- a/src/Web/WebMVC/wwwroot/css/_variables.scss +++ b/src/Web/WebMVC/wwwroot/css/_variables.scss @@ -11,6 +11,13 @@ $color-secondary-darker: darken($color-secondary, 20%); $color-secondary-bright: lighten($color-secondary, 10%); $color-secondary-brighter: lighten($color-secondary, 20%); +$color-warning: #ff0000; +$color-warning-dark: darken($color-warning, 5%); +$color-warning-darker: darken($color-warning, 20%); +$color-warning-bright: lighten($color-warning, 10%); +$color-warning-brighter: lighten($color-warning, 20%); + + $color-background-dark: #333333; $color-background-darker: #000000; $color-background-bright: #EEEEFF; diff --git a/src/Web/WebMVC/wwwroot/css/app.component.min.css b/src/Web/WebMVC/wwwroot/css/app.component.min.css new file mode 100644 index 000000000..fc9af00e8 --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/app.component.min.css @@ -0,0 +1 @@ +.esh-app-footer{background-color:#000;border-top:1px solid #eee;margin-top:2.5rem;padding-bottom:2.5rem;padding-top:2.5rem;width:100%;}.esh-app-footer-brand{height:50px;width:230px;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.css b/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.css index 32b556ab7..5155b88e5 100644 --- a/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.css +++ b/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.css @@ -31,6 +31,21 @@ width: 1.5rem; } +.esh-basketstatus-badge-inoperative { + background-color: #ff0000; + border-radius: 50%; + color: #FFFFFF; + display: block; + height: 1.5rem; + left: 50%; + position: absolute; + text-align: center; + top: 0; + transform: translateX(-38%); + transition: all 0.35s; + width: 1.5rem; +} + .esh-basketstatus:hover .esh-basketstatus-badge { background-color: transparent; color: #75b918; diff --git a/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.min.css b/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.min.css new file mode 100644 index 000000000..cc34f1576 --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.min.css @@ -0,0 +1 @@ +.esh-basketstatus{cursor:pointer;display:inline-block;float:right;position:relative;transition:all .35s;}.esh-basketstatus.is-disabled{opacity:.5;pointer-events:none;}.esh-basketstatus-image{height:36px;margin-top:.5rem;}.esh-basketstatus-badge{background-color:#83d01b;border-radius:50%;color:#fff;display:block;height:1.5rem;left:50%;position:absolute;text-align:center;top:0;transform:translateX(-38%);transition:all .35s;width:1.5rem;}.esh-basketstatus-badge-inoperative{background-color:#f00;border-radius:50%;color:#fff;display:block;height:1.5rem;left:50%;position:absolute;text-align:center;top:0;transform:translateX(-38%);transition:all .35s;width:1.5rem;}.esh-basketstatus:hover .esh-basketstatus-badge{background-color:transparent;color:#75b918;transition:all .35s;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.scss b/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.scss index d7c91e7a8..5dd28de99 100644 --- a/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.scss +++ b/src/Web/WebMVC/wwwroot/css/basket/basket-status/basket-status.component.scss @@ -33,6 +33,22 @@ width: $size; } + &-badge-inoperative { + $size: 1.5rem; + background-color: $color-warning; + border-radius: 50%; + color: $color-foreground-brighter; + display: block; + height: $size; + left: 50%; + position: absolute; + text-align: center; + top: 0; + transform: translateX(-38%); + transition: all $animation-speed-default; + width: $size; + } + &:hover &-badge { background-color: transparent; color: $color-secondary-dark; diff --git a/src/Web/WebMVC/wwwroot/css/basket/basket.component.min.css b/src/Web/WebMVC/wwwroot/css/basket/basket.component.min.css new file mode 100644 index 000000000..ddc57eaee --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/basket/basket.component.min.css @@ -0,0 +1 @@ +.esh-basket{min-height:80vh;}.esh-basket-titles{padding-bottom:1rem;padding-top:2rem;}.esh-basket-titles--clean{padding-bottom:0;padding-top:0;}.esh-basket-title{text-transform:uppercase;}.esh-basket-items--border{border-bottom:1px solid #eee;padding:.5rem 0;}.esh-basket-items--border:last-of-type{border-color:transparent;}.esh-basket-items-margin-left1{margin-left:1px;}.esh-basket-item{font-size:1rem;font-weight:300;}.esh-basket-item--middle{line-height:8rem;}@media screen and (max-width:1024px){.esh-basket-item--middle{line-height:1rem;}}.esh-basket-item--mark{color:#00a69c;}.esh-basket-image{height:8rem;}.esh-basket-input{line-height:1rem;width:100%;}.esh-basket-checkout{background-color:#83d01b;border:0;border-radius:0;color:#fff;display:inline-block;font-size:1rem;font-weight:400;margin-top:1rem;padding:1rem 1.5rem;text-align:center;text-transform:uppercase;transition:all .35s;}.esh-basket-checkout:hover{background-color:#4a760f;transition:all .35s;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/catalog/catalog.component.min.css b/src/Web/WebMVC/wwwroot/css/catalog/catalog.component.min.css new file mode 100644 index 000000000..f376f59e0 --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/catalog/catalog.component.min.css @@ -0,0 +1 @@ +.esh-catalog-hero{background-image:url("../../images/main_banner.png");background-size:cover;height:260px;width:100%;}.esh-catalog-title{position:relative;top:74.28571px;}.esh-catalog-filters{background-color:#00a69c;height:65px;}.esh-catalog-filter{-webkit-appearance:none;background-color:transparent;border-color:#00d9cc;color:#fff;cursor:pointer;margin-right:1rem;margin-top:.5rem;min-width:140px;outline-color:#83d01b;padding-bottom:0;padding-left:.5rem;padding-right:.5rem;padding-top:1.5rem;}.esh-catalog-filter option{background-color:#00a69c;}.esh-catalog-label{display:inline-block;position:relative;z-index:0;}.esh-catalog-label::before{color:rgba(255,255,255,.5);content:attr(data-title);font-size:.65rem;margin-left:.5rem;margin-top:.65rem;position:absolute;text-transform:uppercase;z-index:1;}.esh-catalog-label::after{background-image:url("../../images/arrow-down.png");content:'';height:7px;position:absolute;right:1.5rem;top:2.5rem;width:10px;z-index:1;}.esh-catalog-send{background-color:#83d01b;color:#fff;cursor:pointer;font-size:1rem;margin-top:-1.5rem;padding:.5rem;transition:all .35s;}.esh-catalog-send:hover{background-color:#4a760f;transition:all .35s;}.esh-catalog-items{margin-top:1rem;}.esh-catalog-item{margin-bottom:1.5rem;text-align:center;width:33%;display:inline-block;float:none !important;}@media screen and (max-width:1024px){.esh-catalog-item{width:50%;}}@media screen and (max-width:768px){.esh-catalog-item{width:100%;}}.esh-catalog-thumbnail{max-width:370px;width:100%;}.esh-catalog-button{background-color:#83d01b;border:0;color:#fff;cursor:pointer;font-size:1rem;height:3rem;margin-top:1rem;transition:all .35s;width:80%;}.esh-catalog-button.is-disabled{opacity:.5;pointer-events:none;}.esh-catalog-button:hover{background-color:#4a760f;transition:all .35s;}.esh-catalog-name{font-size:1rem;font-weight:300;margin-top:.5rem;text-align:center;text-transform:uppercase;}.esh-catalog-price{font-size:28px;font-weight:900;text-align:center;}.esh-catalog-price::before{content:'$';} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/orders/orders-detail/orders-detail.component.min.css b/src/Web/WebMVC/wwwroot/css/orders/orders-detail/orders-detail.component.min.css new file mode 100644 index 000000000..146afb2f3 --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/orders/orders-detail/orders-detail.component.min.css @@ -0,0 +1 @@ +.esh-orders_detail{min-height:80vh;}.esh-orders_detail-section{padding:1rem 0;}.esh-orders_detail-section--right{text-align:right;}.esh-orders_detail-titles{padding-bottom:1rem;padding-top:2rem;}.esh-orders_detail-title{text-transform:uppercase;}.esh-orders_detail-items--border{border-bottom:1px solid #eee;padding:.5rem 0;}.esh-orders_detail-items--border:last-of-type{border-color:transparent;}.esh-orders_detail-item{font-size:1rem;font-weight:300;}.esh-orders_detail-item--middle{line-height:8rem;}@media screen and (max-width:768px){.esh-orders_detail-item--middle{line-height:1rem;}}.esh-orders_detail-item--mark{color:#83d01b;}.esh-orders_detail-image{height:8rem;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/orders/orders-new/orders-new.component.min.css b/src/Web/WebMVC/wwwroot/css/orders/orders-new/orders-new.component.min.css new file mode 100644 index 000000000..ae4a15d26 --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/orders/orders-new/orders-new.component.min.css @@ -0,0 +1 @@ +.esh-orders_new{min-height:80vh;}.esh-orders_new-header{background-color:#00a69c;height:4rem;}.esh-orders_new-back{color:rgba(255,255,255,.4);line-height:4rem;text-decoration:none;text-transform:uppercase;transition:color .35s;}.esh-orders_new-back:hover{color:#fff;transition:color .35s;}.esh-orders_new-section{padding:1rem 0;}.esh-orders_new-section--right{text-align:right;}.esh-orders_new-placeOrder{background-color:#83d01b;border:0;border-radius:0;color:#fff;display:inline-block;font-size:1rem;font-weight:400;margin-top:1rem;padding:1rem 1.5rem;text-align:center;text-transform:uppercase;transition:all .35s;}.esh-orders_new-placeOrder:hover{background-color:#4a760f;transition:all .35s;}.esh-orders_new-titles{padding-bottom:1rem;padding-top:2rem;}.esh-orders_new-title{font-size:1.25rem;text-transform:uppercase;}.esh-orders_new-items--border{border-bottom:1px solid #eee;padding:.5rem 0;}.esh-orders_new-items--border:last-of-type{border-color:transparent;}.esh-orders_new-item{font-size:1rem;font-weight:300;}.esh-orders_new-item--middle{line-height:8rem;}@media screen and (max-width:768px){.esh-orders_new-item--middle{line-height:1rem;}}.esh-orders_new-item--mark{color:#83d01b;}.esh-orders_new-image{height:8rem;}.esh-orders_new-alert{margin-top:10px;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/orders/orders.component.min.css b/src/Web/WebMVC/wwwroot/css/orders/orders.component.min.css new file mode 100644 index 000000000..3bea6627c --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/orders/orders.component.min.css @@ -0,0 +1 @@ +.esh-orders{min-height:80vh;overflow-x:hidden;}.esh-orders-header{background-color:#00a69c;height:4rem;}.esh-orders-back{color:rgba(255,255,255,.4);line-height:4rem;text-decoration:none;text-transform:uppercase;transition:color .35s;}.esh-orders-back:hover{color:#fff;transition:color .35s;}.esh-orders-titles{padding-bottom:1rem;padding-top:2rem;}.esh-orders-title{text-transform:uppercase;}.esh-orders-items{height:2rem;line-height:2rem;position:relative;}.esh-orders-items:nth-of-type(2n+1):before{background-color:#eef;content:'';height:100%;left:0;margin-left:-100vw;position:absolute;top:0;width:200vw;z-index:-1;}.esh-orders-item{font-weight:300;}.esh-orders-item--hover{opacity:0;pointer-events:none;}.esh-orders-items:hover .esh-orders-item--hover{opacity:1;pointer-events:all;}.esh-orders-link{color:#83d01b;text-decoration:none;transition:color .35s;}.esh-orders-link:hover{color:#75b918;transition:color .35s;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/shared/components/header/header.min.css b/src/Web/WebMVC/wwwroot/css/shared/components/header/header.min.css new file mode 100644 index 000000000..6d6217d8d --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/shared/components/header/header.min.css @@ -0,0 +1 @@ +.esh-header{background-color:#00a69c;height:4rem;}.esh-header-back{color:rgba(255,255,255,.5);line-height:4rem;text-decoration:none;text-transform:uppercase;transition:color .35s;}.esh-header-back:hover{color:#fff;transition:color .35s;} \ No newline at end of file diff --git a/src/Web/WebMVC/wwwroot/css/shared/components/pager/pager.min.css b/src/Web/WebMVC/wwwroot/css/shared/components/pager/pager.min.css new file mode 100644 index 000000000..79a734e2d --- /dev/null +++ b/src/Web/WebMVC/wwwroot/css/shared/components/pager/pager.min.css @@ -0,0 +1 @@ +.esh-pager-wrapper{padding-top:1rem;text-align:center;}.esh-pager-item{margin:0 5vw;}.esh-pager-item.is-disabled{opacity:0;pointer-events:none;}.esh-pager-item--navigable{cursor:pointer;display:inline-block;}.esh-pager-item--navigable:hover{color:#83d01b;}@media screen and (max-width:1280px){.esh-pager-item{font-size:.85rem;}}@media screen and (max-width:1024px){.esh-pager-item{margin:0 2.5vw;}} \ No newline at end of file From 73be25e6cfd1e0db4fc6ca6786dee499200897df Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Thu, 13 Jul 2017 14:18:10 -0700 Subject: [PATCH 2/8] Minor re-order of services in docker-compose files --- docker-compose.override.yml | 13 +++++++------ docker-compose.prod.yml | 13 +++++++------ docker-compose.yml | 17 +++++++++-------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 1095691dc..7a482e1d6 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -7,12 +7,6 @@ version: '2.1' # An external IP or DNS name has to be used (instead localhost and the 10.0.75.1 IP) when testing the Web apps and the Xamarin apps from remote machines/devices using the same WiFi, for instance. services: - graceperiodmanager: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} basket.api: environment: @@ -83,6 +77,13 @@ services: ports: - "5110:80" + graceperiodmanager: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + webspa: environment: - ASPNETCORE_ENVIRONMENT=Development diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index fa2f1ccd8..00d939914 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -12,12 +12,6 @@ version: '2.1' # docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d services: - graceperiodmanager: - environment: - - ASPNETCORE_ENVIRONMENT=Production - - ASPNETCORE_URLS=http://0.0.0.0:80 - - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} basket.api: environment: @@ -81,6 +75,13 @@ services: ports: - "5110:80" + graceperiodmanager: + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word + - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} + webspa: environment: - ASPNETCORE_ENVIRONMENT=Production diff --git a/docker-compose.yml b/docker-compose.yml index 272843e9f..3d60489b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,6 @@ version: '2.1' services: - graceperiodmanager: - image: eshop/graceperiodmanager:${TAG:-latest} - build: - context: ./src/Services/GracePeriod/GracePeriodManager - dockerfile: Dockerfile - depends_on: - - sql.data - - rabbitmq basket.api: image: eshop/basket.api:${TAG:-latest} @@ -57,6 +49,15 @@ services: - identity.api - rabbitmq + graceperiodmanager: + image: eshop/graceperiodmanager:${TAG:-latest} + build: + context: ./src/Services/GracePeriod/GracePeriodManager + dockerfile: Dockerfile + depends_on: + - sql.data + - rabbitmq + webspa: image: eshop/webspa:${TAG:-latest} build: From c7c176c4c1596d71833ea4e317a6d7ded0ee80ca Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Thu, 13 Jul 2017 14:48:55 -0700 Subject: [PATCH 3/8] Changed HealthCheck Cache duration time (Zero == No Cache) configuration for the Basket microservice. This is better for demos and can be changed at any time. --- src/Services/Basket/Basket.API/Startup.cs | 4 +++- src/Web/WebStatus/Startup.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 13246e873..a473a29fc 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -58,7 +58,9 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API services.AddHealthChecks(checks => { - checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok"))); + checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask(HealthCheckResult.Healthy("Ok")), + TimeSpan.Zero //No cache for this HealthCheck, better just for demos + ); }); services.Configure(Configuration); diff --git a/src/Web/WebStatus/Startup.cs b/src/Web/WebStatus/Startup.cs index 82f7f16ea..244f81787 100644 --- a/src/Web/WebStatus/Startup.cs +++ b/src/Web/WebStatus/Startup.cs @@ -39,7 +39,7 @@ namespace WebStatus } checks.AddUrlCheckIfNotNull(Configuration["OrderingUrl"], TimeSpan.FromMinutes(minutes)); - checks.AddUrlCheckIfNotNull(Configuration["BasketUrl"], TimeSpan.FromMinutes(minutes)); + checks.AddUrlCheckIfNotNull(Configuration["BasketUrl"], TimeSpan.Zero); //No cache for this HealthCheck, better just for demos checks.AddUrlCheckIfNotNull(Configuration["CatalogUrl"], TimeSpan.FromMinutes(minutes)); checks.AddUrlCheckIfNotNull(Configuration["IdentityUrl"], TimeSpan.FromMinutes(minutes)); checks.AddUrlCheckIfNotNull(Configuration["LocationsUrl"], TimeSpan.FromMinutes(minutes)); From d42033a83b1e861344ebabd9ee801cd094ee677b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Fri, 14 Jul 2017 14:53:17 +0200 Subject: [PATCH 4/8] Added UI alert and circuit-breaker handlers for components that depend on Basket.api --- .../Resilience.Http/ResilientHttpClient.cs | 8 ++ src/Services/Basket/Basket.API/Program.cs | 4 +- src/Web/WebMVC/Controllers/CartController.cs | 81 +++++++---- src/Web/WebMVC/Startup.cs | 4 +- src/Web/WebMVC/ViewComponents/Cart.cs | 1 - src/Web/WebMVC/ViewComponents/CartList.cs | 16 ++- src/Web/WebMVC/Views/Catalog/Index.cshtml | 9 ++ .../Shared/Components/Cart/Default.cshtml | 15 +- .../Shared/Components/CartList/Default.cshtml | 132 ++++++++++-------- src/Web/WebMVC/WebMVC.csproj | 1 + .../wwwroot/images/cart-inoperative.png | Bin 0 -> 948 bytes 11 files changed, 178 insertions(+), 93 deletions(-) create mode 100644 src/Web/WebMVC/wwwroot/images/cart-inoperative.png diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs b/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs index 0798f85e3..d32660005 100644 --- a/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs +++ b/src/BuildingBlocks/Resilience/Resilience.Http/ResilientHttpClient.cs @@ -81,6 +81,14 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http var response = await _client.SendAsync(requestMessage); + // raise exception if HttpResponseCode 500 + // needed for circuit breaker to track fails + + if (response.StatusCode == HttpStatusCode.InternalServerError) + { + throw new HttpRequestException(); + } + return await response.Content.ReadAsStringAsync(); }); } diff --git a/src/Services/Basket/Basket.API/Program.cs b/src/Services/Basket/Basket.API/Program.cs index 3eeeb2479..7753ef537 100644 --- a/src/Services/Basket/Basket.API/Program.cs +++ b/src/Services/Basket/Basket.API/Program.cs @@ -14,9 +14,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API .UseKestrel() .UseFailing(options => { - options.ConfigPath = "/Failing"; - options.EndpointPaths = new List() - { "/api/v1/basket/checkout", "/hc" }; + options.ConfigPath = "/Failing"; }) .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) diff --git a/src/Web/WebMVC/Controllers/CartController.cs b/src/Web/WebMVC/Controllers/CartController.cs index 9e5aa0a91..a7bb84959 100644 --- a/src/Web/WebMVC/Controllers/CartController.cs +++ b/src/Web/WebMVC/Controllers/CartController.cs @@ -7,6 +7,7 @@ using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authentication; +using Polly.CircuitBreaker; namespace Microsoft.eShopOnContainers.WebMVC.Controllers { @@ -26,47 +27,79 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers public async Task Index() { - var user = _appUserParser.Parse(HttpContext.User); - var vm = await _basketSvc.GetBasket(user); - + try + { + var user = _appUserParser.Parse(HttpContext.User); + var vm = await _basketSvc.GetBasket(user); - return View(vm); + return View(vm); + } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + HandleBrokenCircuitException(); + } + + return View(); } [HttpPost] public async Task Index(Dictionary quantities, string action) { - var user = _appUserParser.Parse(HttpContext.User); - var basket = await _basketSvc.SetQuantities(user, quantities); - var vm = await _basketSvc.UpdateBasket(basket); - - if (action == "[ Checkout ]") + try { - var order = _basketSvc.MapBasketToOrder(basket); - return RedirectToAction("Create", "Order"); + var user = _appUserParser.Parse(HttpContext.User); + var basket = await _basketSvc.SetQuantities(user, quantities); + var vm = await _basketSvc.UpdateBasket(basket); + + if (action == "[ Checkout ]") + { + var order = _basketSvc.MapBasketToOrder(basket); + return RedirectToAction("Create", "Order"); + } } - - return View(vm); + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + HandleBrokenCircuitException(); + } + + return View(); } public async Task AddToCart(CatalogItem productDetails) { - if (productDetails.Id != null) + try { - var user = _appUserParser.Parse(HttpContext.User); - var product = new BasketItem() + if (productDetails.Id != null) { - Id = Guid.NewGuid().ToString(), - Quantity = 1, - ProductName = productDetails.Name, - PictureUrl = productDetails.PictureUri, - UnitPrice = productDetails.Price, - ProductId = productDetails.Id - }; - await _basketSvc.AddItemToBasket(user, product); + var user = _appUserParser.Parse(HttpContext.User); + var product = new BasketItem() + { + Id = Guid.NewGuid().ToString(), + Quantity = 1, + ProductName = productDetails.Name, + PictureUrl = productDetails.PictureUri, + UnitPrice = productDetails.Price, + ProductId = productDetails.Id + }; + await _basketSvc.AddItemToBasket(user, product); + } + return RedirectToAction("Index", "Catalog"); } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + HandleBrokenCircuitException(); + } + return RedirectToAction("Index", "Catalog"); } + + private void HandleBrokenCircuitException() + { + TempData["BasketInoperativeMsg"] = "Basket Service is inoperative, please try later on. (Business Msg Due to Circuit-Breaker)"; + } } } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index dfbe99652..75b7b1e9b 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -40,7 +40,8 @@ namespace Microsoft.eShopOnContainers.WebMVC // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc(); + services.AddMvc(); + services.AddSession(); if (Configuration.GetValue("IsClusterEnv") == bool.TrueString) { @@ -104,6 +105,7 @@ namespace Microsoft.eShopOnContainers.WebMVC app.UseExceptionHandler("/Catalog/Error"); } + app.UseSession(); app.UseStaticFiles(); app.UseCookieAuthentication(new CookieAuthenticationOptions diff --git a/src/Web/WebMVC/ViewComponents/Cart.cs b/src/Web/WebMVC/ViewComponents/Cart.cs index 4e5aae38f..05c7dac50 100644 --- a/src/Web/WebMVC/ViewComponents/Cart.cs +++ b/src/Web/WebMVC/ViewComponents/Cart.cs @@ -29,7 +29,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents { // Catch error when Basket.api is in circuit-opened mode ViewBag.IsBasketInoperative = true; - vm.ItemsCount = 0; } return View(vm); diff --git a/src/Web/WebMVC/ViewComponents/CartList.cs b/src/Web/WebMVC/ViewComponents/CartList.cs index 099cc8a3d..04a7a783a 100644 --- a/src/Web/WebMVC/ViewComponents/CartList.cs +++ b/src/Web/WebMVC/ViewComponents/CartList.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Polly.CircuitBreaker; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents { @@ -16,8 +17,19 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents public async Task InvokeAsync(ApplicationUser user) { - var item = await GetItemsAsync(user); - return View(item); + var vm = new Basket(); + try + { + vm = await GetItemsAsync(user); + return View(vm); + } + catch (BrokenCircuitException) + { + // Catch error when Basket.api is in circuit-opened mode + TempData["BasketInoperativeMsg"] = "Basket Service is inoperative, please try later on. (Business Msg Due to Circuit-Breaker)"; + } + + return View(vm); } private Task GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user); diff --git a/src/Web/WebMVC/Views/Catalog/Index.cshtml b/src/Web/WebMVC/Views/Catalog/Index.cshtml index ddac94196..23667500f 100644 --- a/src/Web/WebMVC/Views/Catalog/Index.cshtml +++ b/src/Web/WebMVC/Views/Catalog/Index.cshtml @@ -23,6 +23,15 @@
+
+
+ @if(TempData.ContainsKey("BasketInoperativeMsg")) + { + + } +
@if (Model.CatalogItems.Count() > 0) { diff --git a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml index 6ad90c81d..bffed722b 100644 --- a/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml +++ b/src/Web/WebMVC/Views/Shared/Components/Cart/Default.cshtml @@ -7,18 +7,21 @@ -
- -
+ asp-action="Index"> @if (ViewBag.IsBasketInoperative == true) { -
- @Model.ItemsCount +
+
+
+ X +
} else { +
+ +
@Model.ItemsCount
diff --git a/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml b/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml index 1f0d05320..091365e1e 100644 --- a/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml +++ b/src/Web/WebMVC/Views/Shared/Components/CartList/Default.cshtml @@ -5,67 +5,87 @@ }
-
-
Product
-
-
Price
-
Quantity
-
Cost
-
- - @for (int i = 0; i < Model.Items.Count; i++) + @if (TempData.ContainsKey("BasketInoperativeMsg")) { - var item = Model.Items[i]; +
+ + } + else + { +
+
+ @if (TempData.ContainsKey("BasketInoperativeMsg")) + { + + } -
-
-
- -
-
@item.ProductName
-
$ @item.UnitPrice.ToString("N2")
-
- - -
-
$ @Math.Round(item.Quantity * item.UnitPrice, 2).ToString("N2")
-
-
- -
+
Product
+
+
Price
+
Quantity
+
Cost
-
- @if (item.OldUnitPrice != 0) - { - - } + @for (int i = 0; i < Model.Items.Count; i++) + { + var item = Model.Items[i]; + +
+
+
+ +
+
@item.ProductName
+
$ @item.UnitPrice.ToString("N2")
+
+ + +
+
$ @Math.Round(item.Quantity * item.UnitPrice, 2).ToString("N2")
+
+
+ +
+
+ +
+ @if (item.OldUnitPrice != 0) + { + + } +
+
+ } + +
+
+
+
Total
+
+ +
+
+
$ @Model.Total()
+
+ +
+
+
+ +
+
+ +
+
-
- } +
-
-
-
-
Total
-
- -
-
-
$ @Model.Total()
-
- -
-
-
- -
-
- -
-
-
+ diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index c0cc08da0..f36270750 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -41,6 +41,7 @@ + diff --git a/src/Web/WebMVC/wwwroot/images/cart-inoperative.png b/src/Web/WebMVC/wwwroot/images/cart-inoperative.png new file mode 100644 index 0000000000000000000000000000000000000000..24a2e18f7ccc2b21de40c7af925303682499d321 GIT binary patch literal 948 zcmV;l155mgP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGmbN~PnbOGLGA9w%&02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E-^DS16z6k00SgRL_t(oN7a~LNK1lo&B2(J&+b z?8V%yK>Gtl5+P;aLs8L7L6L<~fjtCM=%I%mdN7DE$S9vA3ba2^AQC;y&5>E6J~TC9 zuoP^%wM|`~vvcq6*6#Ig?B3}I#`&JRyY0L4`~A*-zZu%v+9I$)AhXvyUvTHb5Cp}szfirt|1a4ki=`Pa-0X+0543Pn>iYq3~Z0SpZdvC;?klh8NZ%(``XKG^R;!hwqFIB%APxZzNhlN|tp`GX$IstcT1r~cEMh<1$O_=w z$OtQKNh}H$4O!EyFa(HGrxu1q5f+!@%qfb%;x08-xdysS!JI6uijF`;+V~5(gLc?B43(f{r1P`DCtbIva-S|iqU9f6-Bk# zJvB9~v}GY&ILG%HUQF-wcPybNd=!%^cevbckky_5mm?EF_KK z87w8U&$_zcy*gchb1 zTc;;j#YnjuWSg`qJ2gEGcDtRk%wf#Ug}S;rC@3i4D>2gQ28qnh%|-lvKWC}4u(%lU z`FxzolU6qnn4h1I{!>!54+7;?@Upv`pHW9J7^K$+D|SQ3Y$2Vvkx3+Nv$?IdxJ7n+ zH7D~b3AePyy&kpy>P^m)v!NDP+GcxdV@DkXHy^+6sIP3YE#T;-^Q@9X-GKEv2jCyy Wd-F7=>kc#k0000 Date: Fri, 14 Jul 2017 15:12:30 +0200 Subject: [PATCH 5/8] Updates to k8s --- k8s/deploy.ps1 | 1 + k8s/deployments.yaml | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/k8s/deploy.ps1 b/k8s/deploy.ps1 index 70a8ad817..0f6701c23 100644 --- a/k8s/deploy.ps1 +++ b/k8s/deploy.ps1 @@ -147,6 +147,7 @@ ExecKube -cmd 'create configmap urls ` --from-literal=MvcClientCatalogUrl=http://catalog ` --from-literal=MvcClientBasketUrl=http://basket ` --from-literal=WebSpaHealthCheckUrl=http://webspa/hc ` + --from-literal=MarketingHealthCheckUrl=http://marketing/hc ` --from-literal=SpaClientOrderingExternalUrl=http://$($externalDns)/ordering-api ` --from-literal=SpaClientCatalogExternalUrl=http://$($externalDns)/catalog-api ` --from-literal=SpaClientBasketExternalUrl=http://$($externalDns)/basket-api ` diff --git a/k8s/deployments.yaml b/k8s/deployments.yaml index 6eec27278..18006285f 100644 --- a/k8s/deployments.yaml +++ b/k8s/deployments.yaml @@ -74,7 +74,7 @@ spec: - name: AzureStorageEnabled valueFrom: configMapKeyRef: - name: urls + name: externalcfg key: CatalogAzureStorageEnabled - name: EventBusConnection valueFrom: @@ -541,6 +541,11 @@ spec: configMapKeyRef: name: urls key: OrderingHealthCheckUrl + - name: MarketingUrlHC + valueFrom: + configMapKeyRef: + name: urls + key: MarketingHealthCheckUrl ports: - containerPort: 80 imagePullSecrets: From e5164038047e166e50bdcc29f7f3167f14436dd0 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Tue, 18 Jul 2017 18:24:57 +0200 Subject: [PATCH 6/8] k8s errors fixed --- cli-windows/build-bits.ps1 | 6 +++++- k8s/conf_cloud.yml | 1 + k8s/conf_local.yml | 1 + k8s/deploy.ps1 | 7 +++++-- k8s/deployments.yaml | 14 ++++++++++++-- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/cli-windows/build-bits.ps1 b/cli-windows/build-bits.ps1 index 26651da5b..272227b3d 100644 --- a/cli-windows/build-bits.ps1 +++ b/cli-windows/build-bits.ps1 @@ -14,7 +14,11 @@ $projectPaths = @{Path="$rootPath\src\Services\Identity\Identity.API";Prj="Identity.API.csproj"}, @{Path="$rootPath\src\Services\Catalog\Catalog.API";Prj="Catalog.API.csproj"}, @{Path="$rootPath\src\Services\Ordering\Ordering.API";Prj="Ordering.API.csproj"}, - @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"} + @{Path="$rootPath\src\Services\Basket\Basket.API";Prj="Basket.API.csproj"}, + @{Path="$rootPath\src\Services\GracePeriod\GracePeriodManager";Prj="GracePeriodManager.csproj"}, + @{Path="$rootPath\src\Services\Location\Locations.API";Prj="Locations.API.csproj"}, + @{Path="$rootPath\src\Services\Marketing\Marketing.API";Prj="Marketing.API.csproj"}, + @{Path="$rootPath\src\Services\Payment\Payment.API";Prj="Payment.API.csproj"}, @{Path="$rootPath\src\Web\WebStatus";Prj="WebStatus.csproj"} $projectPaths | foreach { diff --git a/k8s/conf_cloud.yml b/k8s/conf_cloud.yml index a7f855095..ac8fd56fc 100644 --- a/k8s/conf_cloud.yml +++ b/k8s/conf_cloud.yml @@ -30,6 +30,7 @@ data: # GracePeriodManager entries GracePeriodTime: "5" # Grace period duration (time when you can cancel order) in minutes GracePeriodCheckUpdateTime: "60000" # Interval time to check new Order status (in milliseconds) + GracePeriodManagerBus: CONNECTION_STRING (NAME OF RABBITMQ CONTAINER OR Endpoint=sb://XXXX in case of using Azure) # Global entries UseAzureServiceBus: "TRUE" IF USE AZURE SB ("FALSE" FOR USING RABBITMQ) keystore: REDIS CONNECTION STRING FOR KEYSTORE \ No newline at end of file diff --git a/k8s/conf_local.yml b/k8s/conf_local.yml index 1193fc36d..1ac16bb28 100644 --- a/k8s/conf_local.yml +++ b/k8s/conf_local.yml @@ -23,5 +23,6 @@ data: PaymentBus: rabbitmq GracePeriodTime: "1" GracePeriodCheckUpdateTime: "60000" + GracePeriodManagerBus: rabbitmq UseAzureServiceBus: "False" keystore: keystore-data diff --git a/k8s/deploy.ps1 b/k8s/deploy.ps1 index 0f6701c23..a203b86bb 100644 --- a/k8s/deploy.ps1 +++ b/k8s/deploy.ps1 @@ -63,7 +63,7 @@ if ($buildImages) { docker-compose -p .. -f ../docker-compose.yml build Write-Host "Pushing images to $registry/$dockerOrg..." -ForegroundColor Yellow - $services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus") + $services = ("basket.api", "catalog.api", "identity.api", "ordering.api", "marketing.api","payment.api","locations.api", "webmvc", "webspa", "webstatus", "graceperiodmanager") foreach ($service in $services) { $imageFqdn = if ($useDockerHub) {"$dockerOrg/${service}"} else {"$registry/$dockerOrg/${service}"} @@ -136,7 +136,7 @@ ExecKube -cmd 'create configmap urls ` --from-literal=BasketHealthCheckUrl=http://basket/hc ` --from-literal=CatalogUrl=http://$($externalDns)/catalog-api ` --from-literal=CatalogHealthCheckUrl=http://catalog/hc ` - --from-literal=PicBaseUrl=http://$($externalDns)/catalog-api/api/v1/pic/ ` + --from-literal=PicBaseUrl=http://$($externalDns)/catalog-api/api/v1/catalog/items/[0]/pic/ ` --from-literal=IdentityUrl=http://$($externalDns)/identity ` --from-literal=IdentityHealthCheckUrl=http://identity/hc ` --from-literal=OrderingUrl=http://ordering ` @@ -152,6 +152,7 @@ ExecKube -cmd 'create configmap urls ` --from-literal=SpaClientCatalogExternalUrl=http://$($externalDns)/catalog-api ` --from-literal=SpaClientBasketExternalUrl=http://$($externalDns)/basket-api ` --from-literal=SpaClientIdentityExternalUrl=http://$($externalDns)/identity ` + --from-literal=LocationsHealthCheckUrl=http://locations/hc ` --from-literal=SpaClientExternalUrl=http://$($externalDns)' ExecKube -cmd 'label configmap urls app=eshop' @@ -181,6 +182,7 @@ ExecKube -cmd 'set image deployments/payment payment=${registryPath}${dockerOrg} ExecKube -cmd 'set image deployments/webmvc webmvc=${registryPath}${dockerOrg}/webmvc:$imageTag' ExecKube -cmd 'set image deployments/webstatus webstatus=${registryPath}${dockerOrg}/webstatus:$imageTag' ExecKube -cmd 'set image deployments/webspa webspa=${registryPath}${dockerOrg}/webspa:$imageTag' +ExecKube -cmd 'set image deployments/graceperiodmanager graceperiodmanager=${registryPath}${dockerOrg}/graceperiodmanager:$imageTag' Write-Host "Execute rollout..." -ForegroundColor Yellow ExecKube -cmd 'rollout resume deployments/basket' @@ -193,6 +195,7 @@ ExecKube -cmd 'rollout resume deployments/payment' ExecKube -cmd 'rollout resume deployments/webmvc' ExecKube -cmd 'rollout resume deployments/webstatus' ExecKube -cmd 'rollout resume deployments/webspa' +ExecKube -cmd 'rollout resume deployments/graceperiodmanager' Write-Host "WebSPA is exposed at http://$externalDns, WebMVC at http://$externalDns/webmvc, WebStatus at http://$externalDns/webstatus" -ForegroundColor Yellow diff --git a/k8s/deployments.yaml b/k8s/deployments.yaml index 18006285f..0092a747d 100644 --- a/k8s/deployments.yaml +++ b/k8s/deployments.yaml @@ -185,8 +185,8 @@ spec: template: metadata: labels: - app: graceperiodmanager - component: ordering + app: eshop + component: graceperiodmanager spec: containers: - name: graceperiodmanager @@ -455,6 +455,16 @@ spec: configMapKeyRef: name: urls key: OrderingHealthCheckUrl + - name: LocationsUrl + valueFrom: + configMapKeyRef: + name: urls + key: LocationsHealthCheckUrl + - name: MarketingUrl + valueFrom: + configMapKeyRef: + name: urls + key: MarketingHealthCheckUrl - name: mvc valueFrom: configMapKeyRef: From 7b4d995448e84890be498044b3fd97c7fc5656b0 Mon Sep 17 00:00:00 2001 From: Eduard Tomas Date: Tue, 18 Jul 2017 19:09:24 +0200 Subject: [PATCH 7/8] Invalid reference --- .../eShopOnContainers.Core.csproj | 5 - .../eShopOnContainers.Core/project.json | 1 + .../Resources/Resource.Designer.cs | 171 +++++++----------- 3 files changed, 62 insertions(+), 115 deletions(-) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj index fd8421e53..b6adbd8ba 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj @@ -290,11 +290,6 @@ Designer - - - ..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.6\Profile\Profile44\System.ComponentModel.Annotations.dll - - MSBuild:UpdateDesignTimeXaml diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json index dcca8ed8f..5038874fa 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/project.json @@ -10,6 +10,7 @@ "Newtonsoft.Json": "9.0.1", "SlideOverKit": "2.1.4", "Splat": "1.6.2", + "System.ComponentModel.Annotations": "4.3.0", "Xam.Plugin.Geolocator": "3.0.4", "Xam.Plugins.Settings": "2.6.0.12-beta", "Xamarin.FFImageLoading": "2.2.9", diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs index b33abfa07..12d1b3f5c 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/Resources/Resource.Designer.cs @@ -1,15 +1,15 @@ #pragma warning disable 1591 -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ -[assembly: Android.Runtime.ResourceDesignerAttribute("eShopOnContainers.TestRunner.Droid.Resource", IsApplication=true)] +[assembly: global::Android.Runtime.ResourceDesignerAttribute("eShopOnContainers.TestRunner.Droid.Resource", IsApplication=true)] namespace eShopOnContainers.TestRunner.Droid { @@ -26,7 +26,6 @@ namespace eShopOnContainers.TestRunner.Droid public static void UpdateIdValues() { - global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.actionBarSize; global::AndroidHUD.Resource.Attribute.ahBarColor = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.ahBarColor; global::AndroidHUD.Resource.Attribute.ahBarLength = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.ahBarLength; global::AndroidHUD.Resource.Attribute.ahBarWidth = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.ahBarWidth; @@ -64,8 +63,9 @@ namespace eShopOnContainers.TestRunner.Droid global::AndroidHUD.Resource.Styleable.ProgressWheel_ahText = global::eShopOnContainers.TestRunner.Droid.Resource.Styleable.ProgressWheel_ahText; global::AndroidHUD.Resource.Styleable.ProgressWheel_ahTextColor = global::eShopOnContainers.TestRunner.Droid.Resource.Styleable.ProgressWheel_ahTextColor; global::AndroidHUD.Resource.Styleable.ProgressWheel_ahTextSize = global::eShopOnContainers.TestRunner.Droid.Resource.Styleable.ProgressWheel_ahTextSize; - global::Splat.Resource.String.library_name = global::eShopOnContainers.TestRunner.Droid.Resource.String.library_name; global::ModernHttpClient.Resource.String.library_name = global::eShopOnContainers.TestRunner.Droid.Resource.String.library_name; + global::Splat.Resource.String.library_name = global::eShopOnContainers.TestRunner.Droid.Resource.String.library_name; + global::Xamarin.Forms.Platform.Android.Resource.Attribute.actionBarSize = global::eShopOnContainers.TestRunner.Droid.Resource.Attribute.actionBarSize; } public partial class Animation @@ -4295,8 +4295,7 @@ namespace eShopOnContainers.TestRunner.Droid public partial class Styleable { - public static int[] ActionBar = new int[] - { + public static int[] ActionBar = new int[] { 2130772007, 2130772009, 2130772010, @@ -4406,15 +4405,13 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 5 public const int ActionBar_titleTextStyle = 5; - public static int[] ActionBarLayout = new int[] - { + public static int[] ActionBarLayout = new int[] { 16842931}; // aapt resource value: 0 public const int ActionBarLayout_android_layout_gravity = 0; - public static int[] ActionMenuItemView = new int[] - { + public static int[] ActionMenuItemView = new int[] { 16843071}; // aapt resource value: 0 @@ -4422,8 +4419,7 @@ namespace eShopOnContainers.TestRunner.Droid public static int[] ActionMenuView; - public static int[] ActionMode = new int[] - { + public static int[] ActionMode = new int[] { 2130772007, 2130772013, 2130772014, @@ -4449,8 +4445,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int ActionMode_titleTextStyle = 1; - public static int[] ActivityChooserView = new int[] - { + public static int[] ActivityChooserView = new int[] { 2130772035, 2130772036}; @@ -4460,8 +4455,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 0 public const int ActivityChooserView_initialActivityCount = 0; - public static int[] AlertDialog = new int[] - { + public static int[] AlertDialog = new int[] { 16842994, 2130772037, 2130772038, @@ -4487,8 +4481,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int AlertDialog_singleChoiceItemLayout = 4; - public static int[] AppBarLayout = new int[] - { + public static int[] AppBarLayout = new int[] { 16842964, 2130772032, 2130772215}; @@ -4502,8 +4495,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int AppBarLayout_expanded = 2; - public static int[] AppBarLayout_LayoutParams = new int[] - { + public static int[] AppBarLayout_LayoutParams = new int[] { 2130772216, 2130772217}; @@ -4513,8 +4505,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int AppBarLayout_LayoutParams_layout_scrollInterpolator = 1; - public static int[] AppCompatImageView = new int[] - { + public static int[] AppCompatImageView = new int[] { 16843033, 2130772042}; @@ -4524,8 +4515,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int AppCompatImageView_srcCompat = 1; - public static int[] AppCompatTextView = new int[] - { + public static int[] AppCompatTextView = new int[] { 16842804, 2130772043}; @@ -4535,8 +4525,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int AppCompatTextView_textAllCaps = 1; - public static int[] AppCompatTheme = new int[] - { + public static int[] AppCompatTheme = new int[] { 16842839, 16842926, 2130772044, @@ -4986,8 +4975,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 3 public const int AppCompatTheme_windowNoTitle = 3; - public static int[] BottomSheetBehavior_Params = new int[] - { + public static int[] BottomSheetBehavior_Params = new int[] { 2130772218, 2130772219}; @@ -4997,15 +4985,13 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 0 public const int BottomSheetBehavior_Params_behavior_peekHeight = 0; - public static int[] ButtonBarLayout = new int[] - { + public static int[] ButtonBarLayout = new int[] { 2130772154}; // aapt resource value: 0 public const int ButtonBarLayout_allowStacking = 0; - public static int[] CardView = new int[] - { + public static int[] CardView = new int[] { 16843071, 16843072, 2130771995, @@ -5059,8 +5045,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 11 public const int CardView_contentPaddingTop = 11; - public static int[] CollapsingAppBarLayout_LayoutParams = new int[] - { + public static int[] CollapsingAppBarLayout_LayoutParams = new int[] { 2130772220, 2130772221}; @@ -5070,8 +5055,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int CollapsingAppBarLayout_LayoutParams_layout_collapseParallaxMultiplier = 1; - public static int[] CollapsingToolbarLayout = new int[] - { + public static int[] CollapsingToolbarLayout = new int[] { 2130772009, 2130772222, 2130772223, @@ -5129,8 +5113,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 10 public const int CollapsingToolbarLayout_toolbarId = 10; - public static int[] CompoundButton = new int[] - { + public static int[] CompoundButton = new int[] { 16843015, 2130772155, 2130772156}; @@ -5144,8 +5127,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int CompoundButton_buttonTintMode = 2; - public static int[] CoordinatorLayout = new int[] - { + public static int[] CoordinatorLayout = new int[] { 2130772235, 2130772236}; @@ -5155,8 +5137,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int CoordinatorLayout_statusBarBackground = 1; - public static int[] CoordinatorLayout_LayoutParams = new int[] - { + public static int[] CoordinatorLayout_LayoutParams = new int[] { 16842931, 2130772237, 2130772238, @@ -5178,8 +5159,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 3 public const int CoordinatorLayout_LayoutParams_layout_keyline = 3; - public static int[] DesignTheme = new int[] - { + public static int[] DesignTheme = new int[] { 2130772241, 2130772242, 2130772243}; @@ -5193,8 +5173,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int DesignTheme_textColorError = 2; - public static int[] DrawerArrowToggle = new int[] - { + public static int[] DrawerArrowToggle = new int[] { 2130772157, 2130772158, 2130772159, @@ -5228,8 +5207,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int DrawerArrowToggle_thickness = 7; - public static int[] FloatingActionButton = new int[] - { + public static int[] FloatingActionButton = new int[] { 2130772032, 2130772213, 2130772214, @@ -5263,8 +5241,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int FloatingActionButton_useCompatPadding = 7; - public static int[] ForegroundLinearLayout = new int[] - { + public static int[] ForegroundLinearLayout = new int[] { 16843017, 16843264, 2130772249}; @@ -5278,8 +5255,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int ForegroundLinearLayout_foregroundInsidePadding = 2; - public static int[] LinearLayoutCompat = new int[] - { + public static int[] LinearLayoutCompat = new int[] { 16842927, 16842948, 16843046, @@ -5317,8 +5293,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int LinearLayoutCompat_showDividers = 7; - public static int[] LinearLayoutCompat_Layout = new int[] - { + public static int[] LinearLayoutCompat_Layout = new int[] { 16842931, 16842996, 16842997, @@ -5336,8 +5311,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int LinearLayoutCompat_Layout_android_layout_width = 1; - public static int[] ListPopupWindow = new int[] - { + public static int[] ListPopupWindow = new int[] { 16843436, 16843437}; @@ -5347,8 +5321,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int ListPopupWindow_android_dropDownVerticalOffset = 1; - public static int[] MediaRouteButton = new int[] - { + public static int[] MediaRouteButton = new int[] { 16843071, 16843072, 2130771994}; @@ -5362,8 +5335,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int MediaRouteButton_externalRouteEnabledDrawable = 2; - public static int[] MenuGroup = new int[] - { + public static int[] MenuGroup = new int[] { 16842766, 16842960, 16843156, @@ -5389,8 +5361,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int MenuGroup_android_visible = 2; - public static int[] MenuItem = new int[] - { + public static int[] MenuItem = new int[] { 16842754, 16842766, 16842960, @@ -5460,8 +5431,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 13 public const int MenuItem_showAsAction = 13; - public static int[] MenuView = new int[] - { + public static int[] MenuView = new int[] { 16842926, 16843052, 16843053, @@ -5495,8 +5465,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 7 public const int MenuView_preserveIconSpacing = 7; - public static int[] NavigationView = new int[] - { + public static int[] NavigationView = new int[] { 16842964, 16842973, 16843039, @@ -5538,8 +5507,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int NavigationView_menu = 4; - public static int[] PopupWindow = new int[] - { + public static int[] PopupWindow = new int[] { 16843126, 2130772173}; @@ -5549,15 +5517,13 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 1 public const int PopupWindow_overlapAnchor = 1; - public static int[] PopupWindowBackgroundState = new int[] - { + public static int[] PopupWindowBackgroundState = new int[] { 2130772174}; // aapt resource value: 0 public const int PopupWindowBackgroundState_state_above_anchor = 0; - public static int[] ProgressWheel = new int[] - { + public static int[] ProgressWheel = new int[] { 2130772284, 2130772285, 2130772286, @@ -5607,8 +5573,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int ProgressWheel_ahTextSize = 2; - public static int[] RecyclerView = new int[] - { + public static int[] RecyclerView = new int[] { 16842948, 2130771968, 2130771969, @@ -5630,22 +5595,19 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int RecyclerView_stackFromEnd = 4; - public static int[] ScrimInsetsFrameLayout = new int[] - { + public static int[] ScrimInsetsFrameLayout = new int[] { 2130772256}; // aapt resource value: 0 public const int ScrimInsetsFrameLayout_insetForeground = 0; - public static int[] ScrollingViewBehavior_Params = new int[] - { + public static int[] ScrollingViewBehavior_Params = new int[] { 2130772257}; // aapt resource value: 0 public const int ScrollingViewBehavior_Params_behavior_overlapTop = 0; - public static int[] SearchView = new int[] - { + public static int[] SearchView = new int[] { 16842970, 16843039, 16843296, @@ -5715,8 +5677,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 12 public const int SearchView_voiceIcon = 12; - public static int[] SnackbarLayout = new int[] - { + public static int[] SnackbarLayout = new int[] { 16843039, 2130772032, 2130772258}; @@ -5730,8 +5691,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int SnackbarLayout_maxActionInlineWidth = 2; - public static int[] Spinner = new int[] - { + public static int[] Spinner = new int[] { 16842930, 16843126, 16843131, @@ -5753,8 +5713,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int Spinner_popupTheme = 4; - public static int[] SwitchCompat = new int[] - { + public static int[] SwitchCompat = new int[] { 16843044, 16843045, 16843074, @@ -5796,8 +5755,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 3 public const int SwitchCompat_track = 3; - public static int[] TabItem = new int[] - { + public static int[] TabItem = new int[] { 16842754, 16842994, 16843087}; @@ -5811,8 +5769,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int TabItem_android_text = 2; - public static int[] TabLayout = new int[] - { + public static int[] TabLayout = new int[] { 2130772259, 2130772260, 2130772261, @@ -5878,8 +5835,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 9 public const int TabLayout_tabTextColor = 9; - public static int[] TextAppearance = new int[] - { + public static int[] TextAppearance = new int[] { 16842901, 16842902, 16842903, @@ -5917,8 +5873,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 8 public const int TextAppearance_textAllCaps = 8; - public static int[] TextInputLayout = new int[] - { + public static int[] TextInputLayout = new int[] { 16842906, 16843088, 2130772275, @@ -5964,8 +5919,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int TextInputLayout_hintTextAppearance = 2; - public static int[] Toolbar = new int[] - { + public static int[] Toolbar = new int[] { 16842927, 16843072, 2130772009, @@ -6067,8 +6021,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 23 public const int Toolbar_titleTextColor = 23; - public static int[] View = new int[] - { + public static int[] View = new int[] { 16842752, 16842970, 2130772210, @@ -6090,8 +6043,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 4 public const int View_theme = 4; - public static int[] ViewBackgroundHelper = new int[] - { + public static int[] ViewBackgroundHelper = new int[] { 16842964, 2130772213, 2130772214}; @@ -6105,8 +6057,7 @@ namespace eShopOnContainers.TestRunner.Droid // aapt resource value: 2 public const int ViewBackgroundHelper_backgroundTintMode = 2; - public static int[] ViewStubCompat = new int[] - { + public static int[] ViewStubCompat = new int[] { 16842960, 16842994, 16842995}; From 292f93ab244533ea73602065b86a05ab200f33ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Tom=C3=A1s?= Date: Wed, 19 Jul 2017 13:49:27 +0200 Subject: [PATCH 8/8] Added geolocator plugin to TestRunner.Droid proj --- .../MainApplication.cs | 63 +++++++++++++++++++ .../eShopOnContainers.TestRunner.Droid.csproj | 20 +++++- .../packages.config | 3 + 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs new file mode 100644 index 000000000..770fedc82 --- /dev/null +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/MainApplication.cs @@ -0,0 +1,63 @@ +using System; + +using Android.App; +using Android.OS; +using Android.Runtime; +using Plugin.CurrentActivity; + +namespace eShopOnContainers.TestRunner.Droid +{ + //You can specify additional application information in this attribute + [Application] + public class MainApplication : Application, Application.IActivityLifecycleCallbacks + { + public MainApplication(IntPtr handle, JniHandleOwnership transer) + :base(handle, transer) + { + } + + public override void OnCreate() + { + base.OnCreate(); + RegisterActivityLifecycleCallbacks(this); + //A great place to initialize Xamarin.Insights and Dependency Services! + } + + public override void OnTerminate() + { + base.OnTerminate(); + UnregisterActivityLifecycleCallbacks(this); + } + + public void OnActivityCreated(Activity activity, Bundle savedInstanceState) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivityDestroyed(Activity activity) + { + } + + public void OnActivityPaused(Activity activity) + { + } + + public void OnActivityResumed(Activity activity) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivitySaveInstanceState(Activity activity, Bundle outState) + { + } + + public void OnActivityStarted(Activity activity) + { + CrossCurrentActivity.Current.Activity = activity; + } + + public void OnActivityStopped(Activity activity) + { + } + } +} \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj index f1867bb67..527ff23f4 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/eShopOnContainers.TestRunner.Droid.csproj @@ -51,6 +51,21 @@ + + ..\..\..\..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll + + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.dll + + + ..\..\..\..\packages\Xam.Plugin.Geolocator.3.0.4\lib\MonoAndroid10\Plugin.Geolocator.Abstractions.dll + + + ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.dll + + + ..\..\..\..\packages\Plugin.Permissions.1.1.7\lib\MonoAndroid10\Plugin.Permissions.Abstractions.dll + @@ -194,12 +209,15 @@ + - + + Designer + diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config index 8262c106d..c2eacca73 100755 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.TestRunner.Droid/packages.config @@ -13,6 +13,8 @@ + + @@ -58,6 +60,7 @@ +