Added time ago formatter + schema changes for BOD-198

This commit is contained in:
Patrick Fic
2020-08-20 14:43:59 -07:00
parent af0b08e7f1
commit 97629a91fb
9 changed files with 95 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ import { Button, notification, Table, Input } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import { TimeAgoFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import OwnerFindModalContainer from "../owner-find-modal/owner-find-modal.container";
@@ -109,7 +109,7 @@ export default function JobsAvailableComponent({
sortOrder:
state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order,
render: (text, record) => (
<DateTimeFormatter>{record.updated_at}</DateTimeFormatter>
<TimeAgoFormatter>{record.updated_at}</TimeAgoFormatter>
),
//width: "12%",
//ellipsis: true

View File

@@ -7,7 +7,7 @@ import { Button, notification, Table, Input } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateTimeFormatter } from "../../utils/DateFormatter";
import { TimeAgoFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import JobsFindModalContainer from "../jobs-find-modal/jobs-find-modal.container";
@@ -124,7 +124,7 @@ export default function JobsAvailableSupplementComponent({
sortOrder:
state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order,
render: (text, record) => (
<DateTimeFormatter>{record.updated_at}</DateTimeFormatter>
<TimeAgoFormatter>{record.updated_at}</TimeAgoFormatter>
),
//width: "12%",
//ellipsis: true

View File

@@ -64,6 +64,8 @@ export function* isUserAuthenticated() {
return;
}
console.log(yield auth.currentUser.getIdToken(true));
LogRocket.identify(user.email);
yield put(
signInSuccess({

View File

@@ -1,14 +1,24 @@
import React from "react";
import moment from "moment";
import Moment from "react-moment";
import { Tooltip } from "antd";
export function DateFormatter(props) {
return props.children ? (
<Moment format="MM/DD/YYYY ">{props.children}</Moment>
) : null;
}
export function DateTimeFormatter(props) {
return props.children ? (
<Moment format="MM/DD/YYYY @ HH:mm">{props.children}</Moment>
) : null;
}
export function TimeAgoFormatter(props) {
const m = moment(props.children);
return props.children ? (
<Tooltip placement="top" title={m.format("MM/DD/YYY hh:mm A")}>
{m.fromNow()}
</Tooltip>
) : null;
}

View File

@@ -0,0 +1,5 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."available_jobs" drop constraint "available_jobs_clm_no_bodyshopid_key";
type: run_sql

View File

@@ -0,0 +1,6 @@
- args:
cascade: false
read_only: false
sql: alter table "public"."available_jobs" add constraint "available_jobs_clm_no_bodyshopid_key"
unique ("clm_no", "bodyshopid");
type: run_sql

View File

@@ -0,0 +1,24 @@
- args:
role: user
table:
name: available_jobs
schema: public
type: drop_update_permission
- args:
permission:
columns: []
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: available_jobs
schema: public
type: create_update_permission

View File

@@ -0,0 +1,33 @@
- args:
role: user
table:
name: available_jobs
schema: public
type: drop_update_permission
- args:
permission:
columns:
- cieca_id
- clm_amt
- est_data
- issupplement
- ownr_name
- source_system
- supplement_number
- uploaded_by
- vehicle_info
filter:
bodyshop:
associations:
_and:
- user:
authid:
_eq: X-Hasura-User-Id
- active:
_eq: true
set: {}
role: user
table:
name: available_jobs
schema: public
type: create_update_permission

View File

@@ -316,7 +316,16 @@ tables:
update_permissions:
- role: user
permission:
columns: []
columns:
- cieca_id
- clm_amt
- est_data
- issupplement
- ownr_name
- source_system
- supplement_number
- uploaded_by
- vehicle_info
filter:
bodyshop:
associations: