From f3ff8b5013b450d6b9861130671a83c5afa9c5a4 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Wed, 2 Dec 2020 16:21:11 -0500 Subject: [PATCH 1/5] Create ItemHeaderView component w/o docs --- .../ItemHeaderView/ItemHeaderView.js | 93 +++++++++++++++++++ .../ItemHeaderView/ItemHeaderView.md | 0 src/components/ItemHeaderView/index.js | 1 + 3 files changed, 94 insertions(+) create mode 100644 src/components/ItemHeaderView/ItemHeaderView.js create mode 100644 src/components/ItemHeaderView/ItemHeaderView.md create mode 100644 src/components/ItemHeaderView/index.js diff --git a/src/components/ItemHeaderView/ItemHeaderView.js b/src/components/ItemHeaderView/ItemHeaderView.js new file mode 100644 index 0000000..798a3fb --- /dev/null +++ b/src/components/ItemHeaderView/ItemHeaderView.js @@ -0,0 +1,93 @@ +import React, { useMemo } from "react"; +import PropTypes from "prop-types"; +import { useTable, useFlexLayout, useFilters } from "react-table"; +import { TableContainer, Table, TableHead, TableRow, TableCell, TableBody, TextField, useTheme, makeStyles } from "@material-ui/core"; + +export default function ItemHeaderView({ data }) { + + const theme = useTheme(); + const useStyles = makeStyles({ + HeaderCell_root: { + paddingBottom: theme.spacing(2), + borderBottomWidth: 0 + }, + ContentCell_root: { + wordBreak: "break-word" + }, + bandedRows: { + '&:nth-of-type(even)': { + backgroundColor: theme.palette.type === 'light' ? theme.palette.grey[50] : theme.palette.grey[700], + } + } + }); + const classes = useStyles(); + + const columns = useMemo(() => [ + { Header: 'Type', accessor: 'type', Cell: ({ value }) => {value} , width: 1 }, + { Header: 'Content', accessor: 'content', width: 2 } + ], []); + + const defaultColumn = { + Filter: ({ column: { Header, setFilter } }) => ( + setFilter(event.target.value) } + type="search" + size="small" + variant="outlined" + color="secondary" + fullWidth + /> + ) + } + + const tableInstance = useTable({ columns, data, defaultColumn }, useFlexLayout, useFilters); + const { + getTableProps, + getTableBodyProps, + headerGroups, + rows, + prepareRow + } = tableInstance; + + return ( + + + + {headerGroups.map(headerGroup => ( + + {headerGroup.headers.map(column => ( + + {column.render('Filter')} + + ))} + + ))} + + + {rows.map( (row) => { + prepareRow(row); + return ( + + {row.cells.map( (cell) => ( + + {cell.render("Cell")} + + ))} + + ); + })} + +
+
+ ); +}; + +ItemHeaderView.propTypes = { + /** An array of object containing header type and content. */ + "data": PropTypes.array +}; + +ItemHeaderView.defaultProps = { + "data": [] +} \ No newline at end of file diff --git a/src/components/ItemHeaderView/ItemHeaderView.md b/src/components/ItemHeaderView/ItemHeaderView.md new file mode 100644 index 0000000..e69de29 diff --git a/src/components/ItemHeaderView/index.js b/src/components/ItemHeaderView/index.js new file mode 100644 index 0000000..f47b29b --- /dev/null +++ b/src/components/ItemHeaderView/index.js @@ -0,0 +1 @@ +export { default } from "./ItemHeaderView"; \ No newline at end of file From f4dac2f5bf40adc7de015834b36765f559e42c75 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Wed, 2 Dec 2020 16:21:30 -0500 Subject: [PATCH 2/5] Add tabbed conversation and header view --- src/components/ItemView/ItemView.js | 35 ++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/components/ItemView/ItemView.js b/src/components/ItemView/ItemView.js index 5ec157a..8bd7eda 100644 --- a/src/components/ItemView/ItemView.js +++ b/src/components/ItemView/ItemView.js @@ -1,10 +1,15 @@ -import React from 'react'; +import React, { useState } from 'react'; import PropTypes from "prop-types"; -import { Paper, makeStyles, useTheme } from '@material-ui/core'; +import { Paper, AppBar, Tab, makeStyles, useTheme } from '@material-ui/core'; +// Import these tab components from @material-ui/lab instead of @material-ui/core for automatic a11y props +// See: https://material-ui.com/components/tabs/#experimental-api +import { TabContext, TabList, TabPanel } from '@material-ui/lab'; import ItemMetadataView from "../ItemMetadataView/" import ItemBodyView from "../ItemBodyView"; +import ItemHeaderView from "../ItemHeaderView"; export default function ItemView({ activeItem }){ + const [activeTab, setActiveTab] = useState('Conversation'); const theme = useTheme(); const useStyles = makeStyles({ @@ -12,15 +17,35 @@ export default function ItemView({ activeItem }){ paddingTop: theme.spacing(1), paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), - border: "none" + border: "none", + }, + "tabPanelPadding": { + padding: `${theme.spacing(2)}px ${theme.spacing(2)}px` } }); const classes = useStyles(); -return( + const handleTabChange = (event, newValue) => { + setActiveTab(newValue); + }; + + return( - + + + + + + + + + + + + + + ); }; From a6d820f8316fa349f265d1b12c8d709222150d5c Mon Sep 17 00:00:00 2001 From: Jacob Daniel Bennett Date: Wed, 2 Dec 2020 19:10:47 -0500 Subject: [PATCH 3/5] Header date format implementation --- api/ECNQueue.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/api/ECNQueue.py b/api/ECNQueue.py index 6d73768..28a3058 100644 --- a/api/ECNQueue.py +++ b/api/ECNQueue.py @@ -228,8 +228,24 @@ def __parseHeaders(self) -> list: message = email.message_from_string(headerString) headers = [] + dateHeaders=[ + "QStatus-Updated-Time", + "Status-Updated-Time", + "Edited-Time", + "QTime-Updated-Time", + "Merged-Time", + "Time-Updated-Time", + "Replied-Time", + "Assigned-To-Updated-Time", + "QAssigned-To-Updated-Time", + "Date", + "Sent" + ] + + + for key in message.keys(): - headers.append({"type": key, "content": message[key]}) + headers.append({"type": key, "content": self.__getFormattedDate(message[key]) if key in dateHeaders else message[key]}) return headers From 78b1ebf9f2dca3eb6bbb8828253d5979deff80a4 Mon Sep 17 00:00:00 2001 From: "Bennett, Jacob Daniel" Date: Wed, 2 Dec 2020 20:17:51 -0500 Subject: [PATCH 4/5] Update ECNQueue.py --- api/ECNQueue.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/ECNQueue.py b/api/ECNQueue.py index 28a3058..2cfcf98 100644 --- a/api/ECNQueue.py +++ b/api/ECNQueue.py @@ -242,8 +242,6 @@ def __parseHeaders(self) -> list: "Sent" ] - - for key in message.keys(): headers.append({"type": key, "content": self.__getFormattedDate(message[key]) if key in dateHeaders else message[key]}) @@ -1347,4 +1345,4 @@ def loadQueues() -> list: for queue in getValidQueues(): queues.append(Queue(queue)) - return queues \ No newline at end of file + return queues From e8bc3c58e11d8e8763be0855fc0f87e8d6a8baf5 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Wed, 2 Dec 2020 21:45:49 -0500 Subject: [PATCH 5/5] Remove extra padding for use inside tabs --- src/components/ItemBodyView/ItemBodyView.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ItemBodyView/ItemBodyView.js b/src/components/ItemBodyView/ItemBodyView.js index 4e5edce..08a57f9 100644 --- a/src/components/ItemBodyView/ItemBodyView.js +++ b/src/components/ItemBodyView/ItemBodyView.js @@ -13,8 +13,9 @@ export default function ItemBodyView({ item }) { const useStyles = makeStyles(() => ({ "Timeline-root": { - paddingLeft: "0", - paddingRight: "0", + padding: "0", + marginTop: "0", + marginBottom: "0", }, "TimelineContent-root": { paddingRight: "0",