From 480cdb9b28fdc02bde5a913a316312a95158d1ba Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 7 Nov 2022 15:58:30 -0800 Subject: [PATCH 01/16] updated GIT and circle CI messages. --- .circleci/config.yml | 171 +++++++++++++++++++++++++++++++++++++++++++ .gitignore | 4 +- 2 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..5e5391ce6 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,171 @@ +version: 2.1 +orbs: + #snyk: snyk/snyk@0.0.8 + #cypress: cypress-io/cypress@1.23.0 + aws-s3: circleci/aws-s3@2.0.0 + eb: circleci/aws-elastic-beanstalk@1.0.2 + jira: circleci/jira@1.3.1 +jobs: + api-deploy: + docker: + - image: "cimg/base:stable" + steps: + - checkout + - eb/setup + - run: + command: | + eb init imex-online-production-api -r ca-central-1 -p "Node.js 16 running on 64bit Amazon Linux 2" + eb status --verbose + eb deploy + eb status + - jira/notify + + hasura-migrate: + docker: + - image: cimg/node:16.15.0 + + working_directory: ~/repo/hasura + steps: + - checkout: + path: ~/repo + - run: + name: Execute migration + command: | + npm install hasura-cli -g + hasura migrate apply --endpoint https://db.imex.online/ --admin-secret $HASURA_PROD_SECRET + hasura metadata apply --endpoint https://db.imex.online/ --admin-secret $HASURA_PROD_SECRET + hasura metadata reload --endpoint https://db.imex.online/ --admin-secret $HASURA_PROD_SECRET + + app-build: + docker: + - image: cimg/node:16.15.0 + + working_directory: ~/repo/client + + steps: + - checkout: + path: ~/repo + + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-{{ checksum "yarn.lock" }} + - run: + name: Install Dependencies + command: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn + - save_cache: + name: Save Yarn Package Cache + key: yarn-packages-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn + + - run: yarn run build + + - aws-s3/sync: + from: build + to: "s3://imex-online-production/" + - jira/notify + + test-hasura-migrate: + docker: + - image: cimg/node:16.15.0 + + working_directory: ~/repo/hasura + steps: + - checkout: + path: ~/repo + - run: + name: Execute migration + command: | + npm install hasura-cli -g + hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret $HASURA_TEST_SECRET + hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret $HASURA_TEST_SECRET + hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret $HASURA_TEST_SECRET + + test-app-build: + docker: + - image: cimg/node:16.15.0 + + working_directory: ~/repo/client + + steps: + - checkout: + path: ~/repo + + - restore_cache: + name: Restore Yarn Package Cache + keys: + - yarn-packages-{{ checksum "yarn.lock" }} + - run: + name: Install Dependencies + command: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn + - save_cache: + name: Save Yarn Package Cache + key: yarn-packages-{{ checksum "yarn.lock" }} + paths: + - ~/.cache/yarn + + - run: yarn run build:test + + - aws-s3/sync: + from: build + to: "s3://imex-online-test/" + - jira/notify + + admin-app-build: + docker: + - image: cimg/node:16.15.0 + + working_directory: ~/repo/admin + + steps: + - checkout: + path: ~/repo + + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + - run: npm i + + - save_cache: + paths: + - node_modules + - ~/.npm + - ~/.cache + key: v1-dependencies-{{ checksum "package.json" }} + + - run: npm run build + + - aws-s3/sync: + from: build + to: "s3://adm.imex.online/" + +workflows: + deploy_and_build: + jobs: + - api-deploy: + filters: + branches: + only: master + - app-build: + filters: + branches: + only: master + - hasura-migrate: + filters: + branches: + only: master + - test-app-build: + filters: + branches: + only: test + - test-hasura-migrate: + filters: + branches: + only: test + #- admin-app-build: + #filters: + #branches: + #only: master diff --git a/.gitignore b/.gitignore index 3fbb87926..2175cc7a9 100644 --- a/.gitignore +++ b/.gitignore @@ -115,4 +115,6 @@ firebase/.env logs/oAuthClient-log.log -.node-persist/** \ No newline at end of file +.node-persist/** + +*.env.* \ No newline at end of file From 5a12738da5a8abac3a07a8e8dfe9a148b85a7e6a Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 8 Nov 2022 10:01:40 -0800 Subject: [PATCH 02/16] IO-2096 Add Cycle Time Analysis report --- bodyshop_translations.babel | 21 +++++++++++++++++++++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + client/src/utils/TemplateConstants.js | 12 ++++++++++++ 5 files changed, 36 insertions(+) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 999c45344..f311d7e00 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -40455,6 +40455,27 @@ + + cycle_time_analysis + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + estimates_written_converted false diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 6cc02bf35..430e8b3c4 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2403,6 +2403,7 @@ "credits_not_received_date": "Credits not Received by Date", "credits_not_received_date_vendorid": "Credits not Received by Vendor", "csi": "CSI Responses", + "cycle_time_analysis": "Cycle Time Analysis", "estimates_written_converted": "Estimates Written/Converted", "estimator_detail": "Jobs by Estimator (Detail)", "estimator_summary": "Jobs by Estimator (Summary)", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 992fd6c3b..6e7454cd0 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2403,6 +2403,7 @@ "credits_not_received_date": "", "credits_not_received_date_vendorid": "", "csi": "", + "cycle_time_analysis": "", "estimates_written_converted": "", "estimator_detail": "", "estimator_summary": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 9aea7d71f..683b09f2c 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2403,6 +2403,7 @@ "credits_not_received_date": "", "credits_not_received_date_vendorid": "", "csi": "", + "cycle_time_analysis": "", "estimates_written_converted": "", "estimator_detail": "", "estimator_summary": "", diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 78ee830cd..ed6ea6a6b 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -1682,6 +1682,18 @@ export const TemplateList = (type, context) => { }, group: "sales", }, + cycle_time_analysis: { + title: i18n.t("reportcenter.templates.cycle_time_analysis"), + subject: i18n.t("reportcenter.templates.cycle_time_analysis"), + key: "cycle_time_analysis", + //idtype: "vendor", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.jobs"), + field: i18n.t("jobs.fields.actual_completion"), + }, + group: "job", + }, } : {}), ...(!type || type === "courtesycarcontract" From 22d075c89aa16e487ab223e627975a9795177d62 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 8 Nov 2022 10:08:58 -0800 Subject: [PATCH 03/16] Updated git ignore for updated CI. --- .gitignore | 2 +- client/.env.development | 13 +++++++++++++ client/.env.production | 13 +++++++++++++ client/.env.test | 14 ++++++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 client/.env.development create mode 100644 client/.env.production create mode 100644 client/.env.test diff --git a/.gitignore b/.gitignore index 2175cc7a9..0a72a8159 100644 --- a/.gitignore +++ b/.gitignore @@ -117,4 +117,4 @@ logs/oAuthClient-log.log .node-persist/** -*.env.* \ No newline at end of file +/*.env.* \ No newline at end of file diff --git a/client/.env.development b/client/.env.development new file mode 100644 index 000000000..900d02994 --- /dev/null +++ b/client/.env.development @@ -0,0 +1,13 @@ +REACT_APP_GRAPHQL_ENDPOINT=https://db.dev.bodyshop.app/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.dev.bodyshop.app/v1/graphql +REACT_APP_GA_CODE=231099835 +REACT_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDPLT8GiDHDR1R4nI66Qi0BY1aYviDPioc","authDomain":"imex-dev.firebaseapp.com","databaseURL":"https://imex-dev.firebaseio.com","projectId":"imex-dev","storageBucket":"imex-dev.appspot.com","messagingSenderId":"759548147434","appId":"1:759548147434:web:e8239868a48ceb36700993","measurementId":"G-K5XRBVVB4S"} +REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/io-test +REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/io-test +REACT_APP_CLOUDINARY_API_KEY=957865933348715 +REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 +REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BG3tzU7L2BXlGZ_3VLK4PNaRceoEXEnmHfxcVbRMF5o5g05ejslhVPki9kBM9cBBT-08Ad9kN3HSpS6JmrWD6h4' +REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g +REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/ +REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online +REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc \ No newline at end of file diff --git a/client/.env.production b/client/.env.production new file mode 100644 index 000000000..7a58e4591 --- /dev/null +++ b/client/.env.production @@ -0,0 +1,13 @@ +REACT_APP_GRAPHQL_ENDPOINT=https://db.imex.online/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.imex.online/v1/graphql +REACT_APP_GA_CODE=231103507 +REACT_APP_FIREBASE_CONFIG={"apiKey":"AIzaSyDSezy-jGJreo7ulgpLdlpOwAOrgcaEkhU","authDomain":"imex-prod.firebaseapp.com","databaseURL":"https://imex-prod.firebaseio.com","projectId":"imex-prod","storageBucket":"imex-prod.appspot.com","messagingSenderId":"253497221485","appId":"1:253497221485:web:3c81c483b94db84b227a64","measurementId":"G-NTWBKG2L0M"} +REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop +REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop +REACT_APP_CLOUDINARY_API_KEY=473322739956866 +REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 +REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BMgZT1NZztW2DsJl8Mg2L04hgY9FzAg6b8fbzgNAfww2VDzH3VE63Ot9EaP_U7KWS2JT-7HPHaw0T_Tw_5vkZc8' +REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g +REACT_APP_AXIOS_BASE_API_URL=https://api.imex.online/ +REACT_APP_REPORTS_SERVER_URL=https://reports.imex.online +REACT_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk \ No newline at end of file diff --git a/client/.env.test b/client/.env.test new file mode 100644 index 000000000..c6403dee6 --- /dev/null +++ b/client/.env.test @@ -0,0 +1,14 @@ +REACT_APP_GRAPHQL_ENDPOINT=https://db.test.bodyshop.app/v1/graphql +REACT_APP_GRAPHQL_ENDPOINT_WS=wss://db.test.bodyshop.app/v1/graphql +REACT_APP_GA_CODE=231099835 +REACT_APP_FIREBASE_CONFIG={ "apiKey":"AIzaSyBw7_GTy7GtQyfkIRPVrWHEGKfcqeyXw0c", "authDomain":"imex-test.firebaseapp.com", "projectId":"imex-test", "storageBucket":"imex-test.appspot.com", "messagingSenderId":"991923618608", "appId":"1:991923618608:web:633437569cdad78299bef5", "measurementId":"G-TW0XLZEH18"} +REACT_APP_CLOUDINARY_ENDPOINT_API=https://api.cloudinary.com/v1_1/bodyshop +REACT_APP_CLOUDINARY_ENDPOINT=https://res.cloudinary.com/bodyshop +REACT_APP_CLOUDINARY_API_KEY=473322739956866 +REACT_APP_CLOUDINARY_THUMB_TRANSFORMATIONS=c_fill,h_250,w_250 +REACT_APP_FIREBASE_PUBLIC_VAPID_KEY='BN2GcDPjipR5MTEosO5dT4CfQ3cmrdBIsI4juoOQrRijn_5aRiHlwj1mlq0W145mOusx6xynEKl_tvYJhpCc9lo' +REACT_APP_STRIPE_PUBLIC_KEY=pk_test_51GqB4TJl3nQjrZ0wCQWAxAhlNF8jKe0tipIa6ExBaxwJGitwvFsIZUEua4dUzaMIAuXp4qwYHXx7lgjyQSwP0Pe900vzm38C7g +REACT_APP_AXIOS_BASE_API_URL=https://api.test.imex.online/ +REACT_APP_REPORTS_SERVER_URL=https://reports3.test.imex.online +REACT_APP_IS_TEST=true +REACT_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc \ No newline at end of file From 8d84ed8e007ff7b9e67728cd16dbfd4a7e24707d Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 8 Nov 2022 10:13:04 -0800 Subject: [PATCH 04/16] Updated CI --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e5391ce6..ef8ec6675 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,9 +32,9 @@ jobs: name: Execute migration command: | npm install hasura-cli -g - hasura migrate apply --endpoint https://db.imex.online/ --admin-secret $HASURA_PROD_SECRET - hasura metadata apply --endpoint https://db.imex.online/ --admin-secret $HASURA_PROD_SECRET - hasura metadata reload --endpoint https://db.imex.online/ --admin-secret $HASURA_PROD_SECRET + hasura migrate apply --endpoint https://db.imex.online/ --admin-secret ${HASURA_PROD_SECRET} + hasura metadata apply --endpoint https://db.imex.online/ --admin-secret ${HASURA_PROD_SECRET} + hasura metadata reload --endpoint https://db.imex.online/ --admin-secret ${HASURA_PROD_SECRET} app-build: docker: @@ -78,9 +78,9 @@ jobs: name: Execute migration command: | npm install hasura-cli -g - hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret $HASURA_TEST_SECRET - hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret $HASURA_TEST_SECRET - hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret $HASURA_TEST_SECRET + hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret ${HASURA_TEST_SECRET} + hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret ${HASURA_TEST_SECRET} + hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret ${HASURA_TEST_SECRET} test-app-build: docker: From 3fa38822f371a1af266c83b8d6c693c766d7b3af Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 8 Nov 2022 10:35:26 -0800 Subject: [PATCH 05/16] IO-2096 Fix grouping for CT report. --- client/src/utils/TemplateConstants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index ed6ea6a6b..410cc0e2e 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -1692,7 +1692,7 @@ export const TemplateList = (type, context) => { object: i18n.t("reportcenter.labels.objects.jobs"), field: i18n.t("jobs.fields.actual_completion"), }, - group: "job", + group: "jobs", }, } : {}), From 058cd31784b05e2563cc3149ebcb51eaf33803e8 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 8 Nov 2022 10:51:20 -0800 Subject: [PATCH 06/16] CI file updates. --- .circleci/config.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ef8ec6675..6f071ef2c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,10 @@ jobs: hasura-migrate: docker: - image: cimg/node:16.15.0 - + parameters: + HASURA_PROD_SECRET: + type: string + default: ${HASURA_PROD_SECRET} working_directory: ~/repo/hasura steps: - checkout: @@ -32,9 +35,9 @@ jobs: name: Execute migration command: | npm install hasura-cli -g - hasura migrate apply --endpoint https://db.imex.online/ --admin-secret ${HASURA_PROD_SECRET} - hasura metadata apply --endpoint https://db.imex.online/ --admin-secret ${HASURA_PROD_SECRET} - hasura metadata reload --endpoint https://db.imex.online/ --admin-secret ${HASURA_PROD_SECRET} + hasura migrate apply --endpoint https://db.imex.online/ --admin-secret << HASURA_PROD_SECRET >> + hasura metadata apply --endpoint https://db.imex.online/ --admin-secret << HASURA_PROD_SECRET >> + hasura metadata reload --endpoint https://db.imex.online/ --admin-secret << HASURA_PROD_SECRET >> app-build: docker: @@ -69,7 +72,10 @@ jobs: test-hasura-migrate: docker: - image: cimg/node:16.15.0 - + parameters: + HASURA_TEST_SECRET: + type: string + default: ${HASURA_TEST_SECRET} working_directory: ~/repo/hasura steps: - checkout: @@ -78,9 +84,9 @@ jobs: name: Execute migration command: | npm install hasura-cli -g - hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret ${HASURA_TEST_SECRET} - hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret ${HASURA_TEST_SECRET} - hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret ${HASURA_TEST_SECRET} + hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret << HASURA_TEST_SECRET >> + hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret << HASURA_TEST_SECRET >> + hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret << HASURA_TEST_SECRET >> test-app-build: docker: From d4a6c528d05b8c722e84ba335ac5523255db825a Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 8 Nov 2022 19:06:22 +0000 Subject: [PATCH 07/16] Add .circleci/config.yml --- .circleci/config.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f071ef2c..8b3724e2d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,9 +24,9 @@ jobs: docker: - image: cimg/node:16.15.0 parameters: - HASURA_PROD_SECRET: + secret: type: string - default: ${HASURA_PROD_SECRET} + default: $HASURA_PROD_SECRET working_directory: ~/repo/hasura steps: - checkout: @@ -35,9 +35,9 @@ jobs: name: Execute migration command: | npm install hasura-cli -g - hasura migrate apply --endpoint https://db.imex.online/ --admin-secret << HASURA_PROD_SECRET >> - hasura metadata apply --endpoint https://db.imex.online/ --admin-secret << HASURA_PROD_SECRET >> - hasura metadata reload --endpoint https://db.imex.online/ --admin-secret << HASURA_PROD_SECRET >> + hasura migrate apply --endpoint https://db.imex.online/ --admin-secret << parameters.secret >> + hasura metadata apply --endpoint https://db.imex.online/ --admin-secret << parameters.secret >> + hasura metadata reload --endpoint https://db.imex.online/ --admin-secret << parameters.secret >> app-build: docker: @@ -73,9 +73,9 @@ jobs: docker: - image: cimg/node:16.15.0 parameters: - HASURA_TEST_SECRET: + secret: type: string - default: ${HASURA_TEST_SECRET} + default: $HASURA_TEST_SECRET working_directory: ~/repo/hasura steps: - checkout: @@ -84,9 +84,9 @@ jobs: name: Execute migration command: | npm install hasura-cli -g - hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret << HASURA_TEST_SECRET >> - hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret << HASURA_TEST_SECRET >> - hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret << HASURA_TEST_SECRET >> + hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >> + hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >> + hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >> test-app-build: docker: @@ -160,6 +160,7 @@ workflows: branches: only: master - hasura-migrate: + secret: $HASURA_PROD_SECRET filters: branches: only: master @@ -168,10 +169,11 @@ workflows: branches: only: test - test-hasura-migrate: + secret: $HASURA_TEST_SECRET filters: branches: only: test #- admin-app-build: #filters: #branches: - #only: master + #only: master \ No newline at end of file From 818e0679d9111d6355568bed08de38d279ec5fb4 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 8 Nov 2022 13:36:54 -0800 Subject: [PATCH 08/16] Update AP posting form validation. --- .../dms-allocations-summary-ap.component.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx b/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx index 21281aa93..1da53e3ba 100644 --- a/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx +++ b/client/src/components/dms-allocations-summary-ap/dms-allocations-summary-ap.component.jsx @@ -140,7 +140,10 @@ export function DmsAllocationsSummaryAp({ socket, bodyshop, billids, title }) { > - From 928673691b1c399f5d75d11e8a35804ccca6f933 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 8 Nov 2022 14:22:03 -0800 Subject: [PATCH 09/16] Updated header to remove language selector. --- .../components/header/header.component.jsx | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/client/src/components/header/header.component.jsx b/client/src/components/header/header.component.jsx index 7da393683..1ed3f526d 100644 --- a/client/src/components/header/header.component.jsx +++ b/client/src/components/header/header.component.jsx @@ -12,7 +12,7 @@ import Icon, { FileAddFilled, FileAddOutlined, FileFilled, - GlobalOutlined, + //GlobalOutlined, HomeFilled, ImportOutlined, LineChartOutlined, @@ -374,25 +374,27 @@ function Header({ {t("menus.currentuser.profile")} - - - {t("menus.currentuser.languageselector")} - - } - > - - {t("general.languages.english")} - - - {t("general.languages.french")} - - - {t("general.languages.spanish")} - - + { + // + // + // {t("menus.currentuser.languageselector")} + // + // } + // > + // + // {t("general.languages.english")} + // + // + // {t("general.languages.french")} + // + // + // {t("general.languages.spanish")} + // + // + } }> {recentItems.map((i, idx) => ( From 83626d83def3209ec47973281bc347c498048832 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Nov 2022 08:16:44 -0800 Subject: [PATCH 10/16] IO-2100 Add last 3 months to date range picker. --- client/src/utils/DatePickerRanges.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/utils/DatePickerRanges.js b/client/src/utils/DatePickerRanges.js index d2c377a81..812ef1428 100644 --- a/client/src/utils/DatePickerRanges.js +++ b/client/src/utils/DatePickerRanges.js @@ -22,5 +22,6 @@ const range = { moment().startOf("quarter"), moment().startOf("quarter").add(1, "quarter").subtract(1, "day"), ], + "Last 3 Months": [moment().add(-3, "months"), moment()], }; export default range; From abac60a3167c8763dbdfee710cd2f138c8ae1a66 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Nov 2022 08:59:51 -0800 Subject: [PATCH 11/16] IO-2100 Update label for updated date range picker. --- client/src/utils/DatePickerRanges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/utils/DatePickerRanges.js b/client/src/utils/DatePickerRanges.js index 812ef1428..aeed206c5 100644 --- a/client/src/utils/DatePickerRanges.js +++ b/client/src/utils/DatePickerRanges.js @@ -22,6 +22,6 @@ const range = { moment().startOf("quarter"), moment().startOf("quarter").add(1, "quarter").subtract(1, "day"), ], - "Last 3 Months": [moment().add(-3, "months"), moment()], + "Last 90 Days": [moment().add(-90, "days"), moment()], }; export default range; From b8d3c5e36c9feec6cbd6959d120b0e1622e27e45 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Nov 2022 09:18:20 -0800 Subject: [PATCH 12/16] IO-2097 Update query on job card details to include remove = true filter. --- client/src/graphql/jobs.queries.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 4bf702cee..33363a5d3 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -855,7 +855,7 @@ export const QUERY_JOB_CARD_DETAILS = gql` count status } - joblines { + joblines(where: { removed: { _eq: false } }) { id mod_lbr_ty mod_lb_hrs From 77bfa90b59ff8d3c9c528124693e2d6e840c4675 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Nov 2022 09:28:56 -0800 Subject: [PATCH 13/16] IO-2062 Update handling of negative EFT amounts for ICBC. --- .../ca-bc-etf-table-modal.container.jsx | 8 +++++++- client/src/translations/en_us/common.json | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx b/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx index 8f97a3008..872d2aec3 100644 --- a/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx +++ b/client/src/components/ca-bc-etf-table-modal/ca-bc-etf-table-modal.container.jsx @@ -39,7 +39,13 @@ export function ContractsFindModalContainer({ if (!claim || !shortclaim) return; const trimmedShortClaim = shortclaim.trim(); // const trimmedClaim = claim.trim(); - claimNumbers.push({ claim: trimmedShortClaim, amount }); + if (amount.slice(-1) === "-") { + } + + claimNumbers.push({ + claim: trimmedShortClaim, + amount: amount.slice(-1) === "-" ? parseFloat(amount) * -1 : amount, + }); }); await GenerateDocument( diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 430e8b3c4..9c3ae03f0 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2099,7 +2099,7 @@ }, "labels": { "balance": "Balance", - "ca_bc_etf_table": "ICBC ETF Table Converter", + "ca_bc_etf_table": "ICBC EFT Table Converter", "customer": "Customer", "edit": "Edit Payment", "electronicpayment": "Use Electronic Payment Processing?", @@ -2275,7 +2275,7 @@ "title": "Print Center" }, "payments": { - "ca_bc_etf_table": "ICBC ETF Table", + "ca_bc_etf_table": "ICBC EFT Table", "exported_payroll": "Payroll Table" }, "special": { From d01a1aa0a0e0e78b04cbdc5cec7dc1f59d616f89 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Nov 2022 16:29:32 -0800 Subject: [PATCH 14/16] CI Test --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b3724e2d..1131076a7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -169,7 +169,7 @@ workflows: branches: only: test - test-hasura-migrate: - secret: $HASURA_TEST_SECRET + secret: $HASURA_TEST_SECRET1 filters: branches: only: test From 77e865c5c461cb134dc1af661a1aaf552a0654c2 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 9 Nov 2022 16:34:30 -0800 Subject: [PATCH 15/16] CI Test --- .circleci/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1131076a7..868fb3aa4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -84,6 +84,7 @@ jobs: name: Execute migration command: | npm install hasura-cli -g + echo ${HASURA_TEST_SECRET} hasura migrate apply --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >> hasura metadata apply --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >> hasura metadata reload --endpoint https://db.test.bodyshop.app/ --admin-secret << parameters.secret >> @@ -160,7 +161,7 @@ workflows: branches: only: master - hasura-migrate: - secret: $HASURA_PROD_SECRET + secret: ${HASURA_PROD_SECRET} filters: branches: only: master @@ -169,7 +170,7 @@ workflows: branches: only: test - test-hasura-migrate: - secret: $HASURA_TEST_SECRET1 + secret: ${HASURA_TEST_SECRET} filters: branches: only: test From 9f28b80a5a7e5e4d8ac30292bd0bf6b7818b02ea Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 10 Nov 2022 09:42:03 -0800 Subject: [PATCH 16/16] IO-1532 Status Transition Tracking. --- hasura/metadata/tables.yaml | 21 ++++++++ server.js | 2 +- server/job/job-status-transition.js | 76 ++++++++++++++++------------- 3 files changed, 63 insertions(+), 36 deletions(-) diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 00be05ed1..f1678c62e 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -3769,6 +3769,27 @@ - active: _eq: true event_triggers: + - name: job_status_transition + definition: + enable_manual: false + insert: + columns: '*' + update: + columns: + - status + retry_conf: + interval_sec: 10 + num_retries: 0 + timeout_sec: 60 + webhook_from_env: HASURA_API_URL + headers: + - name: event-secret + value_from_env: EVENT_SECRET + request_transform: + query_params: {} + template_engine: Kriti + url: '{{$base_url}}/job/statustransition' + version: 2 - name: jobs_arms definition: enable_manual: false diff --git a/server.js b/server.js index 327008c39..90d3da90f 100644 --- a/server.js +++ b/server.js @@ -129,7 +129,7 @@ var job = require("./server/job/job"); app.post("/job/totals", fb.validateFirebaseIdToken, job.totals); app.post( "/job/statustransition", - fb.validateFirebaseIdToken, + // fb.validateFirebaseIdToken, job.statustransition ); app.post("/job/totalsssu", fb.validateFirebaseIdToken, job.totalsSsu); diff --git a/server/job/job-status-transition.js b/server/job/job-status-transition.js index 0a41e7a6a..8ac622bef 100644 --- a/server/job/job-status-transition.js +++ b/server/job/job-status-transition.js @@ -7,22 +7,29 @@ const logger = require("../utils/logger"); // Dinero.defaultCurrency = "USD"; // Dinero.globalLocale = "en-CA"; Dinero.globalRoundingMode = "HALF_EVEN"; - +const path = require("path"); +const client = require("../graphql-client/graphql-client").client; +require("dotenv").config({ + path: path.resolve( + process.cwd(), + `.env.${process.env.NODE_ENV || "development"}` + ), +}); async function StatusTransition(req, res) { - const { jobid, value, bodyshopid } = req.body; - - const BearerToken = req.headers.authorization; - logger.log("job-costing-start", "DEBUG", req.user.email, jobid, null); - const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, { - headers: { - Authorization: BearerToken, - }, - }); + if (req.headers["event-secret"] !== process.env.EVENT_SECRET) { + res.status(403).send("Unauthorized"); + return; + } + const { + id: jobid, + status: value, + shopid: bodyshopid, + } = req.body.event.data.new; try { - const { update_transitions } = await client - .setHeaders({ Authorization: BearerToken }) - .request(queries.UPDATE_OLD_TRANSITION, { + const { update_transitions } = await client.request( + queries.UPDATE_OLD_TRANSITION, + { jobid: jobid, existingTransition: { end: new Date(), @@ -30,7 +37,8 @@ async function StatusTransition(req, res) { //duration }, - }); + } + ); let duration = update_transitions.affected_rows === 0 @@ -38,29 +46,27 @@ async function StatusTransition(req, res) { : new Date(update_transitions.returning[0].end) - new Date(update_transitions.returning[0].start); - const resp2 = await client - .setHeaders({ Authorization: BearerToken }) - .request(queries.INSERT_NEW_TRANSITION, { - oldTransitionId: + const resp2 = await client.request(queries.INSERT_NEW_TRANSITION, { + oldTransitionId: + update_transitions.affected_rows === 0 + ? null + : update_transitions.returning[0].id, + duration, + newTransition: { + bodyshopid: bodyshopid, + jobid: jobid, + start: + update_transitions.affected_rows === 0 + ? new Date() + : update_transitions.returning[0].end, + prev_value: update_transitions.affected_rows === 0 ? null - : update_transitions.returning[0].id, - duration, - newTransition: { - bodyshopid: bodyshopid, - jobid: jobid, - start: - update_transitions.affected_rows === 0 - ? new Date() - : update_transitions.returning[0].end, - prev_value: - update_transitions.affected_rows === 0 - ? null - : update_transitions.returning[0].value, - value: value, - type: "status", - }, - }); + : update_transitions.returning[0].value, + value: value, + type: "status", + }, + }); //Check to see if there is an existing status transition record. //Query using Job ID, start is not null, end is null.