diff --git a/README.md b/README.md index 24840ab..396b656 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,9 @@ If you’re using this demo, please **★Star** this repository to show your int > [go/microservices-demo](http://go/microservices-demo) if you are using this > application. + +*If you're looking for the old Hipster Shop frontend interface, use the manifests in release [v0.1.4](https://github.com/GoogleCloudPlatform/microservices-demo/releases/v0.1.4).* + ## Screenshots | Home Page | Checkout Screen | diff --git a/kubernetes-manifests/frontend.yaml b/kubernetes-manifests/frontend.yaml index da1c7cc..faf461d 100644 --- a/kubernetes-manifests/frontend.yaml +++ b/kubernetes-manifests/frontend.yaml @@ -65,6 +65,8 @@ spec: value: "checkoutservice:5050" - name: AD_SERVICE_ADDR value: "adservice:9555" + - name: ENV_PLATFORM + value: "gcp" # - name: DISABLE_TRACING # value: "1" # - name: DISABLE_PROFILER diff --git a/src/adservice/.classpath b/src/adservice/.classpath deleted file mode 100644 index 93b77fa..0000000 --- a/src/adservice/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/adservice/.settings/org.eclipse.buildship.core.prefs b/src/adservice/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 382c6d4..0000000 --- a/src/adservice/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home=/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/src/frontend/handlers.go b/src/frontend/handlers.go index cb6ad33..a57e19c 100644 --- a/src/frontend/handlers.go +++ b/src/frontend/handlers.go @@ -89,7 +89,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) { "user_currency": currentCurrency(r), "currencies": currencies, "products": ps, - "cart_size": len(cart), + "cart_size": cartSize(cart), "banner_color": os.Getenv("BANNER_COLOR"), // illustrates canary deployments "ad": fe.chooseAd(r.Context(), []string{}, log), "platform_css": plat.css, @@ -106,6 +106,9 @@ func (plat *platformDetails) setPlatformDetails(env string) { } else if env == "onprem" { plat.provider = "On-Premises" plat.css = "onprem-platform" + } else if env == "azure" { + plat.provider = "Azure" + plat.css = "azure-platform" } else { plat.provider = "Google Cloud" plat.css = "gcp-platform" @@ -164,7 +167,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request) "currencies": currencies, "product": product, "recommendations": recommendations, - "cart_size": len(cart), + "cart_size": cartSize(cart), }); err != nil { log.Println(err) } @@ -237,7 +240,7 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request Quantity int32 Price *pb.Money } - items := make([]cartItemView, len(cart)) + items := make([]cartItemView, cartSize(cart)) totalPrice := pb.Money{CurrencyCode: currentCurrency(r)} for i, item := range cart { p, err := fe.getProduct(r.Context(), item.GetProductId()) @@ -267,7 +270,7 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request "user_currency": currentCurrency(r), "currencies": currencies, "recommendations": recommendations, - "cart_size": len(cart), + "cart_size": cartSize(cart), "shipping_cost": shippingCost, "total_cost": totalPrice, "items": items, @@ -418,6 +421,15 @@ func cartIDs(c []*pb.CartItem) []string { return out } +// get total # of items in cart +func cartSize(c []*pb.CartItem) int { + cartSize := 0 + for _, item := range c { + cartSize += int(item.GetQuantity()) + } + return cartSize +} + func renderMoney(money pb.Money) string { return fmt.Sprintf("%s %d.%02d", money.GetCurrencyCode(), money.GetUnits(), money.GetNanos()/10000000) } diff --git a/src/frontend/static/styles/styles.css b/src/frontend/static/styles/styles.css index e5caabd..a32b0a9 100755 --- a/src/frontend/static/styles/styles.css +++ b/src/frontend/static/styles/styles.css @@ -22,7 +22,7 @@ hr { display: flex; align-items: center; justify-content: center; - font-size: 10px; + font-size: 11px; margin-left: 7px; border-radius: 50%; } @@ -64,20 +64,23 @@ header .h-controls { header .h-control { display: flex; align-items: center; - font-size: 12px; + font-size: 14px; position: relative; margin-left: 40px; color: #605f64; + outline:none !important; } header .h-control:first-child { margin-left: 0; + outline:none !important; } header .h-control img { width: 20px; height: 20px; margin-right: 8px; + outline:none !important; } header .h-control input { @@ -89,49 +92,13 @@ header .h-control input { background-color: #f2f2f2; display: flex; align-items: center; + outline:none !important; } -header .h-form form { - font-size: 12px; - border: solid 1px #f2f2f2; - padding: 0 0px 0 0px; - width: 250px; - height: 24px; - flex-shrink: 0; - background-color: #f2f2f2; - display: flex; - align-items: center; -} - -header .h-form select { - background: transparent; - border-radius: 0; - border: solid 1px #f2f2f2; - width: 100px; - height: 20px; - flex-shrink: 0; - padding: 0 7px; - display: flex; - align-items: center; -} - -header .h-form option { - background: transparent; - border-radius: 0; - border: solid 1px #f2f2f2; - width: 100px; - height: 20px; - flex-shrink: 0; - padding: 0 7px; - display: flex; - align-items: center; -} - - header .h-control input:focus { - outline: 0; border: 0; box-shadow: 0; + outline:none !important; } header .icon { @@ -163,33 +130,36 @@ header .h-control select { padding: 0 7px; display: flex; align-items: center; + outline:none !important; } header .h-control::-webkit-input-placeholder { /* Chrome/Opera/Safari */ - font-size: 12px; + font-size: 14px; color: #605f64; } header .h-control::-moz-placeholder { /* Firefox 19+ */ - font-size: 12px; + font-size: 14px; color: #605f64; } header .h-control :-ms-input-placeholder { /* IE 10+ */ - font-size: 12px; + font-size: 14px; color: #605f64; } header .h-control :-moz-placeholder { /* Firefox 18- */ - font-size: 12px; + font-size: 14px; color: #605f64; } + + header .navbar.sub-navbar { height: 60px; background-color: #111111; @@ -561,6 +531,7 @@ main.home { .aws-platform, .onprem-platform, +.azure-platform, .gcp-platform { position: fixed; top: 0; @@ -588,6 +559,11 @@ main.home { background-color: #4285f4; } +.azure-platform, +.azure-platform .platform-flag { + background-color:#F25022; +} + .platform-flag { position: absolute; top: 98px; @@ -632,4 +608,16 @@ main.home { select { -webkit-appearance: none; -webkit-border-radius: 0px; +} + +form #currency_form { + border: none; + padding: 0 31px 0 31px; + width: 250px; + height: 24px; + flex-shrink: 0; + background-color: #f2f2f2; + display: flex; + align-items: center; + outline:none !important; } \ No newline at end of file diff --git a/src/frontend/templates/footer.html b/src/frontend/templates/footer.html index 60bca98..630f047 100755 --- a/src/frontend/templates/footer.html +++ b/src/frontend/templates/footer.html @@ -2,74 +2,8 @@