From 6e32f1f462c5e2d6b1d760c3a1886b720a2653ee Mon Sep 17 00:00:00 2001 From: damien-duignan Date: Wed, 3 Jun 2020 15:26:33 +0200 Subject: [PATCH 1/5] Fix styles --- client/public/favicon.ico | Bin 3870 -> 1529 bytes client/public/index.html | 2 +- client/src/App.js | 4 ++- client/src/components/ErrorMessage.js | 13 +++++++++- client/src/components/Products.js | 6 ++--- client/src/index.css | 34 ++++++++++++++++++++------ 6 files changed, 46 insertions(+), 13 deletions(-) diff --git a/client/public/favicon.ico b/client/public/favicon.ico index a11777cc471a4344702741ab1c8a588998b1311a..7e38c3fc21cea68780f78b13d0b018e23b0d6272 100644 GIT binary patch literal 1529 zcmVPx)vq?ljR9FecS6ggUMHv3)oV~U5%62I&mkJizg`h}dZ4Aa>FyaN0LWv|q1rz0g z1dW#%QHdxh>Vskok#bS6_<|IH;EVA^AA~435w=S!H3VDRu3XmMclV6nKc{DJ-EF%{ z<79W|oSA?A@02D-{Atb3(q%pfVAQOkwgB@C^VY!P3()6+ty>O*5y zE5;&NTCuXi&?2ja5KE<`O7t!gf}}J|e4!Cu@R9u(ZbE-dGxP&({)7I}^p8lOsA5^E zO}D>_ojxfvEsp?bfu>U|m<+zsFoGoH{%|DpZoq%EEvu?OR>}K0G=U@2*hMM z(KO=%Jai_~3X43~(RAooDnUKfVDX&V4cN&Z667Yy;Qz9*i-ah|M(QSbDsJ|4HJwb> zG>ia)You?7tudGBu9MaCyV9X+LVFk_t|ya7h=Ix8<&VN{hXHQCHQ@1t03}2SKB@iF z*Ld8Ti4rLCE-$f>I02#Q9Bkv#%xt+5CRr2kHMTPbLe^|HK^qY?;|I<#*cf9l)(|Yh z49(+RF$)eqjmMl@Z+Z*L>J?-+LVH1%?@+U{0FvbiFv}P`9FCA-Wa=)-R>)yYrlir_ zl@3&|WtsYYU@%0Lv!+wg#C!^YNJfoa!I;3-N<{c}F0Z3ixOjm6fk9eu$1M8l^UbvL z!xyO_ZvwG3#@ZN*F&SIqgGC74Io8Fz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`UO1I!BtJR_2~7AbkbSm%XQqxEPkz6BTGWx8e}nQ=w7bZ|eVP4?*Tb!$(R)iC z9)&%bS*u(lXqzitAN)Oo=&Ytn>%Hzjc<5liuPi>zC_nw;Z0AE3Y$Jao_Q90R-gl~5 z_xAb2J%eArrC1CN4G$}-zVvCqF1;H;abAu6G*+PDHSYFx@Tdbfox*uEd3}BUyYY-l zTfEsOqsi#f9^FoLO;ChK<554qkri&Av~SIM*{fEYRE?vH7pTAOmu2pz3X?Wn*!ROX ztd54huAk&mFBemMooL33RV-*1f0Q3_(7hl$<#*|WF9P!;r;4_+X~k~uKEqdzZ$5Al zV63XN@)j$FN#cCD;ek1R#l zv%pGrhB~KWgoCj%GT?%{@@o(AJGt*PG#l3i>lhmb_twKH^EYvacVY-6bsCl5*^~L0 zonm@lk2UvvTKr2RS%}T>^~EYqdL1q4nD%0n&Xqr^cK^`J5W;lRRB^R-O8b&HENO||mo0xaD+S=I8RTlIfVgqN@SXDr2&-)we--K7w= zJVU8?Z+7k9dy;s;^gDkQa`0nz6N{T?(A&Iz)2!DEecLyRa&FI!id#5Z7B*O2=PsR0 zEvc|8{NS^)!d)MDX(97Xw}m&kEO@5jqRaDZ!+%`wYOI<23q|&js`&o4xvjP7D_xv@ z5hEwpsp{HezI9!~6O{~)lLR@oF7?J7i>1|5a~UuoN=q&6N}EJPV_GD`&M*v8Y`^2j zKII*d_@Fi$+i*YEW+Hbzn{iQk~yP z>7N{S4)r*!NwQ`(qcN#8SRQsNK6>{)X12nbF`*7#ecO7I)Q$uZsV+xS4E7aUn+U(K baj7?x%VD!5Cxk2YbYLNVeiXvvpMCWYo=by@ diff --git a/client/public/index.html b/client/public/index.html index 56df0fb..d13e7cb 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -19,7 +19,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - Product Inventory + Task list diff --git a/client/src/App.js b/client/src/App.js index d7fbcbf..c021e26 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -31,6 +31,7 @@ class App extends React.Component { }).catch(err => { this.setState({ errorMessage: err.message, + productsLoading: false }); }); @@ -49,7 +50,8 @@ class App extends React.Component { render() { return (
-

Product Inventory

+

Humanitec Sample App

+

Task list

diff --git a/client/src/components/ErrorMessage.js b/client/src/components/ErrorMessage.js index 5296378..dcccb72 100644 --- a/client/src/components/ErrorMessage.js +++ b/client/src/components/ErrorMessage.js @@ -1,9 +1,20 @@ +/* eslint-disable no-template-curly-in-string */ import React from 'react'; export function ErrorMessage(props) { return (
- {props.message} + This sample-app is intended to be used with sample-service. To add tasks to your task list: +
    +
  • Add a sample-service module to your app on Humanitec.
  • + +
  • In your sample-service configuration, add a database.
  • + +
  • In Variables, define an environment variable for your database connection with a key CONNECTION_STRING and value: {'${externals.postgres.host};${externals.postgres.name};${externals.postgres.username};${externals.postgres.password};${externals.postgres.port}'}
  • + +
  • Deploy your changes and reload this page
  • +
+
); } diff --git a/client/src/components/Products.js b/client/src/components/Products.js index 14325aa..f3dd377 100644 --- a/client/src/components/Products.js +++ b/client/src/components/Products.js @@ -61,9 +61,9 @@ export class ProductCreator extends React.Component { render() { return (
- - - + + +
); } diff --git a/client/src/index.css b/client/src/index.css index edb9917..8161733 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -11,16 +11,29 @@ code { font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; } -.products-app>h1 { - margin: 16px; + +.products-app { + max-width: 1400px; + margin: 0 auto; +} +.products-app > h1 { font-size: 1.75rem; line-height: 2rem; font-weight: 500; letter-spacing: .0125em; text-decoration: inherit; text-transform: inherit; + margin-bottom: 16px; margin-top: 0; } +.products-app > h2 { + font-size: 1.75rem; + line-height: 2rem; + font-weight: 500; + letter-spacing: .0125em; + text-decoration: inherit; + text-transform: inherit; +} .new-product { padding: 16px; border-radius: 4px; @@ -28,20 +41,19 @@ code { box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0,0,0,.12); box-sizing: border-box; margin-top: 16px; - margin-left: 16px; - margin-right: 16px; margin-bottom: 32px; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; + max-width: 700px; } .new-product .title { font-size: 1.25rem; line-height: 2rem; font-weight: 500; letter-spacing: .0125em; - width: 40rem; + width: 100%; border: none; border-bottom: 1px solid #555; margin-bottom: 8px; @@ -95,12 +107,20 @@ code { } .error-message { font-size: 1.2rem; - color: red; - font-weight: bold; font-family: monospace; padding: 16px; background-color: white; + line-height: 1.3; } .hidden-error-message { display: none; } +.highlight { + background-color: rgba(9, 30, 66, 0.08);; + padding: 0 3px; + word-wrap: break-word; +} + +.bold { + font-weight: bold; +} \ No newline at end of file From 28bedc0686814efeabc845e7ad0dc294877b91b6 Mon Sep 17 00:00:00 2001 From: damien-duignan Date: Wed, 3 Jun 2020 15:31:53 +0200 Subject: [PATCH 2/5] Add github ci --- .github/workflows/walhall-ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/walhall-ci.yml diff --git a/.github/workflows/walhall-ci.yml b/.github/workflows/walhall-ci.yml new file mode 100644 index 0000000..184757a --- /dev/null +++ b/.github/workflows/walhall-ci.yml @@ -0,0 +1,19 @@ +name: Walhall CI + +on: + push: + branches: + - deploy + +jobs: + push-to-humanitec-dev: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Build and Push to Humanitec Dev + uses: humanitec/build-push-to-humanitec@v1 + with: + humanitec-token: ${{ secrets.HUMANITEC_TOKEN_DEV }} + organization: damien85 + humanitec-registry: dev-registry.humanitec.io + humanitec-api: dev-api.humanitec.io \ No newline at end of file From d13e6143f57e7c051a0981abaa8ef63819e8e9c1 Mon Sep 17 00:00:00 2001 From: damien-duignan Date: Wed, 3 Jun 2020 16:22:27 +0200 Subject: [PATCH 3/5] Remove last variable --- client/src/components/ErrorMessage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/ErrorMessage.js b/client/src/components/ErrorMessage.js index dcccb72..29de746 100644 --- a/client/src/components/ErrorMessage.js +++ b/client/src/components/ErrorMessage.js @@ -10,7 +10,7 @@ export function ErrorMessage(props) {
  • In your sample-service configuration, add a database.
  • -
  • In Variables, define an environment variable for your database connection with a key CONNECTION_STRING and value: {'${externals.postgres.host};${externals.postgres.name};${externals.postgres.username};${externals.postgres.password};${externals.postgres.port}'}
  • +
  • In Variables, define an environment variable for your database connection with a key CONNECTION_STRING and value: {'${externals.postgres.host};${externals.postgres.name};${externals.postgres.username};${externals.postgres.password}'}
  • Deploy your changes and reload this page
  • From 96bb99eedcf59c250f1efe9a8d6b67eb79aa8356 Mon Sep 17 00:00:00 2001 From: damien-duignan Date: Tue, 9 Jun 2020 12:42:24 +0200 Subject: [PATCH 4/5] Update styles --- client/src/components/ErrorMessage.js | 2 +- client/src/index.css | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/client/src/components/ErrorMessage.js b/client/src/components/ErrorMessage.js index 29de746..915fe0d 100644 --- a/client/src/components/ErrorMessage.js +++ b/client/src/components/ErrorMessage.js @@ -10,7 +10,7 @@ export function ErrorMessage(props) {
  • In your sample-service configuration, add a database.
  • -
  • In Variables, define an environment variable for your database connection with a key CONNECTION_STRING and value: {'${externals.postgres.host};${externals.postgres.name};${externals.postgres.username};${externals.postgres.password}'}
  • +
  • In Variables, define an environment variable for your database connection with a key CONNECTION_STRING and value: {'postgresql://${externals.postgres.username}:${externals.postgres.password}@${externals.postgres.host}:${externals.postgres.port}/${externals.postgres.name}'}
  • Deploy your changes and reload this page
  • diff --git a/client/src/index.css b/client/src/index.css index 8161733..0eff040 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -75,10 +75,6 @@ code { align-self: flex-end; } -.products { - padding: 16px; -} - .products .product { padding: 16px; border-radius: 4px; From 1391749f3760406a47a49d366bec1460197c4af1 Mon Sep 17 00:00:00 2001 From: damien-duignan Date: Tue, 9 Jun 2020 12:44:18 +0200 Subject: [PATCH 5/5] Update default URL --- README.md | 4 ++-- server/app.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index be6ba4c..f2d9892 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ You can configure the product frontend with the following environment variables: | Variable | Description | |---|---| -| `PRODUCT_BE_SERVER_URL` | The URL for accessing the `product-be` service. | +| `PUBLIC_SERVER_URL` | The URL for accessing the `product-be` service. | | `PORT` | The port number where the server should be exposed. Default is `8080`. | @@ -25,7 +25,7 @@ You can run the `product-fe` package in development mode by executing the follow ```bash # Start the server $ cd server -$ PRODUCT_BE_SERVER_URL="http://localhost:8080" PORT=3001 node bin/www +$ PUBLIC_SERVER_URL="http://localhost:8080" PORT=3001 node bin/www ``` ```bash diff --git a/server/app.js b/server/app.js index 581260a..4659d0a 100644 --- a/server/app.js +++ b/server/app.js @@ -5,8 +5,7 @@ const path = require("path"); const logger = require("morgan"); // Environmental variable for configuring backend -const PRODUCT_BE_SERVER_URL=process.env.PRODUCT_BE_SERVER_URL || "PRODUCT_BE_SERVER_URL"; - +const PUBLIC_SERVER_URL=process.env.PUBLIC_SERVER_URL || "http://sample-service:8080"; const app = express(); @@ -16,7 +15,7 @@ app.use(express.json()); app.use(express.static(path.join(__dirname, "public"))); -app.use("/api", proxy(PRODUCT_BE_SERVER_URL)); +app.use("/api", proxy(PUBLIC_SERVER_URL)); app.use("/", express.static("public")); @@ -30,7 +29,7 @@ app.use(function(err, req, res, next) { if (req.path.startsWith("/api/")) { // error from Proxy const proxiedPath = req.path.substring("/api/".length); - console.error(`Unable to complete request: "${PRODUCT_BE_SERVER_URL}/${proxiedPath}"`); + console.error(`Unable to complete request: "${PUBLIC_SERVER_URL}/${proxiedPath}"`); if (err.code === "ENOTFOUND") { console.error(`Unable to find host "${err.host}"`); } else if (err.code === "ECONNREFUSED") {