From 7dc3c006287f1be1a78a3d80732589236ceae592 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 4 May 2023 12:50:28 -0700 Subject: [PATCH 1/3] Revert "Merged in feature/IO-1722-job-size-color (pull request #746)" This reverts commit 7594f53e88ed44552bd2becec848bad81da37592, reversing changes made to b8619573422255051886b3419b264fc4a250ed25. --- ...ard-kanban-card-color-legend.component.jsx | 39 ------------------- ...production-board-kanban-card.component.jsx | 31 --------------- ...n-board-kanban.card-settings.component.jsx | 7 ---- .../production-board-kanban.component.jsx | 7 ---- .../shop-info.scheduling.component.jsx | 9 ----- client/src/translations/en_us/common.json | 7 +--- 6 files changed, 2 insertions(+), 98 deletions(-) delete mode 100644 client/src/components/production-board-kanban-card/production-board-kanban-card-color-legend.component.jsx diff --git a/client/src/components/production-board-kanban-card/production-board-kanban-card-color-legend.component.jsx b/client/src/components/production-board-kanban-card/production-board-kanban-card-color-legend.component.jsx deleted file mode 100644 index e9cc0f4e0..000000000 --- a/client/src/components/production-board-kanban-card/production-board-kanban-card-color-legend.component.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Col, List, Space, Typography } from "antd"; -import React from "react"; -import { useTranslation } from "react-i18next"; - -const CardColorLegend = ({ bodyshop, cardSettings }) => { - const { t } = useTranslation(); - const data = bodyshop.ssbuckets.map((size) => ({ - label: size.label, - color: size.color?.hex ?? "white", - })); - - return ( - - {t("production.labels.legend")} - ( - - -
-
{item.label}
-
-
- )} - /> - - ); -}; - -export default CardColorLegend; diff --git a/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx b/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx index cb955a9c6..750204fb5 100644 --- a/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx +++ b/client/src/components/production-board-kanban-card/production-board-kanban-card.component.jsx @@ -18,28 +18,6 @@ import moment from "moment"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.component"; -const cardColor = (ssbuckets, totalHrs) => { - const bucket = ssbuckets.filter( - (bucket) => - bucket.gte <= totalHrs && (!!bucket.lt ? bucket.lt > totalHrs : true) - )[0]; - - if (bucket.color) { - return bucket.color.hex; - } - - return ""; -}; - -function getContrastYIQ(hexColor) { - const r = parseInt(hexColor.substr(1, 2), 16); - const g = parseInt(hexColor.substr(3, 2), 16); - const b = parseInt(hexColor.substr(5, 2), 16); - const yiq = (r * 299 + g * 587 + b * 114) / 1000; - - return yiq >= 128 ? "black" : "white"; -} - export default function ProductionBoardCard( technician, card, @@ -76,19 +54,10 @@ export default function ProductionBoardCard( .isSame(moment(card.scheduled_completion), "day") && "production-completion-soon")); - const totalHrs = - card.labhrs.aggregate.sum.mod_lb_hrs + card.larhrs.aggregate.sum.mod_lb_hrs; - const bgColor = cardColor(bodyshop.ssbuckets, totalHrs); - return ( diff --git a/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx b/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx index bc7f83494..25c77e307 100644 --- a/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx +++ b/client/src/components/production-board-kanban/production-board-kanban.card-settings.component.jsx @@ -104,13 +104,6 @@ export default function ProductionBoardKanbanCardSettings({ > - - - } /> - - {cardSettings.cardcolor && ( - - )} - - - - - - { diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 1819fadbe..f52178267 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -508,8 +508,7 @@ "id": "ID", "label": "Label", "lt": "Less than (hrs)", - "target": "Target (count)", - "color": "Job Color" + "target": "Target (count)" }, "state": "Province/State", "state_tax_id": "Provincial/State Tax ID (PST, QST)", @@ -2386,9 +2385,7 @@ "sublets": "Sublets", "totalhours": "Total Hrs ", "touchtime": "T/T", - "viewname": "View Name", - "legend": "Legend:", - "cardcolor": "Card Colors" + "viewname": "View Name" }, "successes": { "removed": "Job removed from production." From abe5fadeeaa705a19755b8e4c202da883bbedc91 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 4 May 2023 13:25:45 -0700 Subject: [PATCH 2/3] Resolve health check --- client/src/utils/RenderTemplate.js | 2 +- server.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index 21ad1e30b..f8b837817 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -27,7 +27,7 @@ export default async function RenderTemplate( jsreport.serverUrl = "https://reports3.test.imex.online/"; } const jsrAuth = (await axios.post("/utils/jsr")).data; - console.log("🚀 ~ file: RenderTemplate.js:30 ~ jsrAuth:", jsrAuth); + jsreport.headers["Authorization"] = jsrAuth; //Query assets that match the template name. Must be in format <>.query diff --git a/server.js b/server.js index 6a0c9e20a..e30d4ec07 100644 --- a/server.js +++ b/server.js @@ -247,9 +247,9 @@ app.post("/search", fb.validateFirebaseIdToken, os.search); var cdkGetMake = require("./server/cdk/cdk-get-makes"); app.post("/cdk/getvehicles", fb.validateFirebaseIdToken, cdkGetMake.default); -// app.get("/", async function (req, res) { -// res.status(200).send("Access Forbidden."); -// }); +app.get("/", async function (req, res) { + res.status(200).send("Access Forbidden."); +}); server.listen(port, (error) => { if (error) throw error; From 2586855f111553ae153d6e1116be7a69d0321bf7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 4 May 2023 13:33:16 -0700 Subject: [PATCH 3/3] Add firebase auth to JSR call. --- client/src/utils/RenderTemplate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index f8b837817..f103111cf 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -3,7 +3,7 @@ import { notification } from "antd"; import jsreport from "@jsreport/browser-client"; import _ from "lodash"; import moment from "moment"; -//import { auth } from "../firebase/firebase.utils"; +import { auth } from "../firebase/firebase.utils"; import { setEmailOptions } from "../redux/email/email.actions"; import { store } from "../redux/store"; import client from "../utils/GraphQLClient"; @@ -309,8 +309,8 @@ export const GenerateDocuments = async (templates) => { const fetchContextData = async (templateObject, jsrAuth) => { const bodyshop = store.getState().user.bodyshop; - // jsreport.headers["Authorization"] = - // "Bearer " + (await auth.currentUser.getIdToken()); + jsreport.headers["FirebaseAuthorization"] = + "Bearer " + (await auth.currentUser.getIdToken()); const folders = await cleanAxios.get(`${server}/odata/folders`, { headers: { Authorization: jsrAuth },