Removed productionview view from Hasura and replaced with standard GQL queries. BOD-243

This commit is contained in:
Patrick Fic
2020-08-03 13:43:39 -07:00
parent 3a8b4ddf5a
commit 75b1ed44e8
8 changed files with 68 additions and 135 deletions

View File

@@ -7,35 +7,54 @@ import { Link } from "react-router-dom";
import "./production-board-card.styles.scss"; import "./production-board-card.styles.scss";
export default function ProductionBoardCard(card) { export default function ProductionBoardCard(card) {
// console.log("card", card);
return ( return (
<Card <Card
className='react-kanban-card imex-kanban-card tight-antd-rows' className="react-kanban-card imex-kanban-card tight-antd-rows"
style={{ margin: ".2rem 0rem" }} style={{ margin: ".2rem 0rem" }}
size='small' size="small"
title={`${card.ro_number || card.est_number} - ${card.v_model_yr} ${ title={`${card.ro_number || card.est_number} - ${card.v_model_yr} ${
card.v_make_desc || "" card.v_make_desc || ""
} ${card.v_model_desc || ""}`}> } ${card.v_model_desc || ""}`}
>
<Row> <Row>
<Col span={24}> <Col span={24}>
<div className='ellipses'>{`${card.ownr_fn || ""} ${ <div className="ellipses">{`${card.ownr_fn || ""} ${
card.ownr_ln || "" card.ownr_ln || ""
} ${card.ownr_co_nm || ""}`}</div> } ${card.ownr_co_nm || ""}`}</div>
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col span={12}> <Col span={12}>
<div className='ellipses'>{card.clm_no || ""}</div> <div className="ellipses">{card.clm_no || ""}</div>
</Col> </Col>
<Col span={12}> <Col span={12}>
<div className='ellipses'>{card.ins_co_nm || ""}</div> <div className="ellipses">{card.ins_co_nm || ""}</div>
</Col> </Col>
</Row> </Row>
<Row> <Row>
<Col span={24}> <Col span={24}>
<div className='imex-flex-row imex-flex-row__flex-space-around'> <div className="imex-flex-row imex-flex-row__flex-space-around">
<div>{`B: ${card.labhrs || "?"}`}</div> <div className="mex-flex-row__margin">
<div>{`R: ${card.labhrs || "?"}`}</div> <div>{`B: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}</div>
<div>{`R: ${card.labhrs.aggregate.sum.mod_lb_hrs || "?"}`}</div>
</div>
<div className="mex-flex-row__margin">
<div>{`B: ${
card.employee_body_rel
? `${card.employee_body_rel.first_name} ${card.employee_body_rel.last_name}`
: ""
}`}</div>
<div>{`P: ${
card.employee_prep_rel
? `${card.employee_prep_rel.first_name} ${card.employee_prep_rel.last_name}`
: ""
}`}</div>
<div>{`R: ${
card.employee_refinish_rel
? `${card.employee_refinish_rel.first_name} ${card.employee_refinish_rel.last_name}`
: ""
}`}</div>
</div>
</div> </div>
</Col> </Col>
</Row> </Row>
@@ -44,10 +63,10 @@ export default function ProductionBoardCard(card) {
<DateTimeFormatter>{card.scheduled_completion}</DateTimeFormatter> <DateTimeFormatter>{card.scheduled_completion}</DateTimeFormatter>
</Col> </Col>
</Row> </Row>
<div className='imex-flex-row imex-flex-row__flex-space-around'> <div className="imex-flex-row imex-flex-row__flex-space-around">
<ProductionAlert record={card} key='alert' /> <ProductionAlert record={card} key="alert" />
<Link to={`/manage/jobs/${card.id}`}> <Link to={`/manage/jobs/${card.id}`}>
<EyeFilled key='setting' /> <EyeFilled key="setting" />
</Link> </Link>
</div> </div>
</Card> </Card>

View File

@@ -20,7 +20,7 @@ export function ProductionBoardKanbanContainer({ bodyshop }) {
return ( return (
<ProductionBoardKanbanComponent <ProductionBoardKanbanComponent
loading={loading} loading={loading}
data={data ? data.productionview : []} data={data ? data.jobs : []}
/> />
); );
} }

View File

@@ -13,7 +13,7 @@ export default function ProductionListColumnAlert({ record }) {
const handleAlertToggle = (e) => { const handleAlertToggle = (e) => {
logImEXEvent("production_toggle_alert"); logImEXEvent("production_toggle_alert");
e.stopPropagation(); //e.stopPropagation();
updateAlert({ updateAlert({
variables: { variables: {
jobId: record.id, jobId: record.id,
@@ -36,21 +36,23 @@ export default function ProductionListColumnAlert({ record }) {
<Dropdown <Dropdown
overlay={ overlay={
<Menu> <Menu>
<Menu.Item key='toggleAlert' onClick={handleAlertToggle}> <Menu.Item key="toggleAlert" onClick={handleAlertToggle}>
{record.production_vars && record.production_vars.alert {record.production_vars && record.production_vars.alert
? t("production.labels.alertoff") ? t("production.labels.alertoff")
: t("production.labels.alerton")} : t("production.labels.alerton")}
</Menu.Item> </Menu.Item>
</Menu> </Menu>
} }
trigger={["contextMenu"]}> trigger={["contextMenu"]}
>
<div <div
style={{ style={{
//width: "100%", //width: "100%",
height: "19px", height: "19px",
}}> }}
>
{record.production_vars && record.production_vars.alert ? ( {record.production_vars && record.production_vars.alert ? (
<ExclamationCircleFilled className='production-alert' /> <ExclamationCircleFilled className="production-alert" />
) : null} ) : null}
</div> </div>
</Dropdown> </Dropdown>

View File

@@ -34,7 +34,7 @@ export function ProductionListTableContainer({ bodyshop }) {
return ( return (
<ProductionListTable <ProductionListTable
loading={loading} loading={loading}
data={data ? data.productionview : []} data={data ? data.jobs : []}
columnState={columnState} columnState={columnState}
/> />
); );

View File

@@ -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` export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
subscription SUBSCRIPTION_JOBS_IN_PRODUCTION($statusList: [String!]!) { subscription SUBSCRIPTION_JOBS_IN_PRODUCTION($statusList: [String!]!) {
productionview(where: { status: { _in: $statusList } }) { jobs(where: { status: { _in: $statusList } }) {
id id
status status
ro_number ro_number
@@ -117,9 +73,6 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
ownr_ph1 ownr_ph1
special_coverage_policy special_coverage_policy
production_vars production_vars
labhrs
larhrs
partcount
kanbanparent kanbanparent
employee_body_rel { employee_body_rel {
id id
@@ -136,6 +89,26 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql`
first_name first_name
last_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
}
}
}
} }
} }
`; `;

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: DROP VIEW "public"."productionview";
type: run_sql

View File

@@ -3421,73 +3421,6 @@ tables:
_eq: X-Hasura-User-Id _eq: X-Hasura-User-Id
- active: - active:
_eq: true _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: - table:
schema: public schema: public
name: scoreboard name: scoreboard