From 75b1ed44e816b2efc136fe8ccd928fbc22377c94 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 3 Aug 2020 13:43:39 -0700 Subject: [PATCH] Removed productionview view from Hasura and replaced with standard GQL queries. BOD-243 --- ...production-board-kanban-card.component.jsx | 45 ++++++++---- .../production-board-kanban.container.jsx | 2 +- ...roduction-list-columns.alert.component.jsx | 12 ++-- .../production-list-table.container.jsx | 2 +- client/src/graphql/jobs.queries.js | 69 ++++++------------- .../down.yaml | 1 + .../up.yaml | 5 ++ hasura/migrations/metadata.yaml | 67 ------------------ 8 files changed, 68 insertions(+), 135 deletions(-) create mode 100644 hasura/migrations/1596487312718_drop_view_public_productionview/down.yaml create mode 100644 hasura/migrations/1596487312718_drop_view_public_productionview/up.yaml 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 9d215ae90..6d1cc2258 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 @@ -7,35 +7,54 @@ import { Link } from "react-router-dom"; import "./production-board-card.styles.scss"; export default function ProductionBoardCard(card) { - // console.log("card", card); return ( + } ${card.v_model_desc || ""}`} + > -
{`${card.ownr_fn || ""} ${ +
{`${card.ownr_fn || ""} ${ card.ownr_ln || "" } ${card.ownr_co_nm || ""}`}
-
{card.clm_no || ""}
+
{card.clm_no || ""}
-
{card.ins_co_nm || ""}
+
{card.ins_co_nm || ""}
-
-
{`B: ${card.labhrs || "?"}`}
-
{`R: ${card.labhrs || "?"}`}
+
+
+
{`B: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}
+
{`R: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}
+
+
+
{`B: ${ + card.employee_body_rel + ? `${card.employee_body_rel.first_name} ${card.employee_body_rel.last_name}` + : "" + }`}
+
{`P: ${ + card.employee_prep_rel + ? `${card.employee_prep_rel.first_name} ${card.employee_prep_rel.last_name}` + : "" + }`}
+
{`R: ${ + card.employee_refinish_rel + ? `${card.employee_refinish_rel.first_name} ${card.employee_refinish_rel.last_name}` + : "" + }`}
+
@@ -44,10 +63,10 @@ export default function ProductionBoardCard(card) { {card.scheduled_completion} -
- +
+ - +
diff --git a/client/src/components/production-board-kanban/production-board-kanban.container.jsx b/client/src/components/production-board-kanban/production-board-kanban.container.jsx index fa9e507fe..55950c5bf 100644 --- a/client/src/components/production-board-kanban/production-board-kanban.container.jsx +++ b/client/src/components/production-board-kanban/production-board-kanban.container.jsx @@ -20,7 +20,7 @@ export function ProductionBoardKanbanContainer({ bodyshop }) { return ( ); } diff --git a/client/src/components/production-list-columns/production-list-columns.alert.component.jsx b/client/src/components/production-list-columns/production-list-columns.alert.component.jsx index 5ab493d2c..f8df5fa5e 100644 --- a/client/src/components/production-list-columns/production-list-columns.alert.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.alert.component.jsx @@ -13,7 +13,7 @@ export default function ProductionListColumnAlert({ record }) { const handleAlertToggle = (e) => { logImEXEvent("production_toggle_alert"); - e.stopPropagation(); + //e.stopPropagation(); updateAlert({ variables: { jobId: record.id, @@ -36,21 +36,23 @@ export default function ProductionListColumnAlert({ record }) { - + {record.production_vars && record.production_vars.alert ? t("production.labels.alertoff") : t("production.labels.alerton")} } - trigger={["contextMenu"]}> + trigger={["contextMenu"]} + >
+ }} + > {record.production_vars && record.production_vars.alert ? ( - + ) : null}
diff --git a/client/src/components/production-list-table/production-list-table.container.jsx b/client/src/components/production-list-table/production-list-table.container.jsx index fc31dfa9c..4b03ace3f 100644 --- a/client/src/components/production-list-table/production-list-table.container.jsx +++ b/client/src/components/production-list-table/production-list-table.container.jsx @@ -34,7 +34,7 @@ export function ProductionListTableContainer({ bodyshop }) { return ( ); diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index d6dff50e2..2c932ac91 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -50,53 +50,9 @@ export const QUERY_ALL_ACTIVE_JOBS = gql` } `; -export const QUERY_JOBS_IN_PRODUCTION = gql` - query QUERY_JOBS_IN_PRODUCTION { - productionview { - id - status - ro_number - est_number - ownr_fn - ownr_ln - v_model_yr - v_model_desc - clm_no - v_make_desc - v_color - plate_no - actual_in - scheduled_completion - scheduled_delivery - ins_co_nm - clm_total - ownr_ph1 - special_coverage_policy - production_vars - labhrs - larhrs - employee_body_rel { - id - first_name - last_name - } - employee_refinish_rel { - id - first_name - last_name - } - employee_prep_rel{ - id - first_name - last_name - } - } - } -`; - export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql` subscription SUBSCRIPTION_JOBS_IN_PRODUCTION($statusList: [String!]!) { - productionview(where: { status: { _in: $statusList } }) { + jobs(where: { status: { _in: $statusList } }) { id status ro_number @@ -117,9 +73,6 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql` ownr_ph1 special_coverage_policy production_vars - labhrs - larhrs - partcount kanbanparent employee_body_rel { id @@ -136,6 +89,26 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql` first_name last_name } + partcount: joblines_aggregate { + nodes { + status + } + } + + labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) { + aggregate { + sum { + mod_lb_hrs + } + } + } + larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) { + aggregate { + sum { + mod_lb_hrs + } + } + } } } `; diff --git a/hasura/migrations/1596487312718_drop_view_public_productionview/down.yaml b/hasura/migrations/1596487312718_drop_view_public_productionview/down.yaml new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/hasura/migrations/1596487312718_drop_view_public_productionview/down.yaml @@ -0,0 +1 @@ +[] diff --git a/hasura/migrations/1596487312718_drop_view_public_productionview/up.yaml b/hasura/migrations/1596487312718_drop_view_public_productionview/up.yaml new file mode 100644 index 000000000..6e88a06bd --- /dev/null +++ b/hasura/migrations/1596487312718_drop_view_public_productionview/up.yaml @@ -0,0 +1,5 @@ +- args: + cascade: false + read_only: false + sql: DROP VIEW "public"."productionview"; + type: run_sql diff --git a/hasura/migrations/metadata.yaml b/hasura/migrations/metadata.yaml index 6d3066a50..7aa332be6 100644 --- a/hasura/migrations/metadata.yaml +++ b/hasura/migrations/metadata.yaml @@ -3421,73 +3421,6 @@ tables: _eq: X-Hasura-User-Id - active: _eq: true -- table: - schema: public - name: productionview - object_relationships: - - name: bodyshop - using: - manual_configuration: - remote_table: - schema: public - name: bodyshops - column_mapping: - shopid: id - - name: employee_body_rel - using: - manual_configuration: - remote_table: - schema: public - name: employees - column_mapping: - employee_body: id - - name: employee_refinish_rel - using: - manual_configuration: - remote_table: - schema: public - name: employees - column_mapping: - employee_refinish: id - select_permissions: - - role: user - permission: - columns: - - id - - status - - ro_number - - est_number - - ownr_fn - - ownr_ln - - v_model_yr - - v_model_desc - - clm_no - - v_make_desc - - v_color - - plate_no - - actual_in - - scheduled_completion - - scheduled_delivery - - ins_co_nm - - clm_total - - ownr_ph1 - - special_coverage_policy - - production_vars - - labhrs - - larhrs - - shopid - - partcount - - kanbanparent - filter: - bodyshop: - associations: - _and: - - user: - authid: - _eq: X-Hasura-User-Id - - active: - _eq: true - allow_aggregations: true - table: schema: public name: scoreboard