From e59c5902b821773cdea9a61b6df2e270c306acc9 Mon Sep 17 00:00:00 2001 From: Kevin Jackson <30411845+KevinJJackson@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:17:38 -0500 Subject: [PATCH] bugfix/timeseries-edit-error (#249) * remove ability to edit time field on timeseries table * update to new update/create api keyes --- package.json | 2 +- src/app-pages/instrument/alert/alert-editor-form.jsx | 4 ++-- src/app-pages/instrument/alert/alert-entry.jsx | 2 +- src/app-pages/instrument/alert/alert-note-form.jsx | 4 ++-- src/app-pages/instrument/details.jsx | 4 ++-- src/app-pages/instrument/instrument-display.jsx | 8 ++++---- src/app-pages/instrument/timeseries/timeseries.jsx | 2 +- src/app-pages/profile/userProfile.jsx | 4 ++-- .../qa-qc/components/tables/alertConfigList.jsx | 6 +++--- .../qa-qc/components/tables/evaluationList.jsx | 6 +++--- .../qa-qc/components/tables/submittalsTable.jsx | 4 ++-- src/app-services/collections/survey123.ts | 12 ++++++------ 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index b0f50890..3f0df46b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hhd-ui", - "version": "0.18.4", + "version": "0.18.5", "private": true, "dependencies": { "@ag-grid-community/client-side-row-model": "^30.0.3", diff --git a/src/app-pages/instrument/alert/alert-editor-form.jsx b/src/app-pages/instrument/alert/alert-editor-form.jsx index 673c4a2b..1c067ccb 100644 --- a/src/app-pages/instrument/alert/alert-editor-form.jsx +++ b/src/app-pages/instrument/alert/alert-editor-form.jsx @@ -64,9 +64,9 @@ export default connect( }} /> - {alert.update_date && ( + {alert.updated_at && (
- {`Last Updated at ${alert.update_date}`} + {`Last Updated at ${alert.updated_at}`}
)} diff --git a/src/app-pages/instrument/alert/alert-entry.jsx b/src/app-pages/instrument/alert/alert-entry.jsx index 8f854128..1a6573cd 100644 --- a/src/app-pages/instrument/alert/alert-entry.jsx +++ b/src/app-pages/instrument/alert/alert-entry.jsx @@ -20,7 +20,7 @@ const AlertEntry = connect( }) => { const [isHovered, setIsHovered] = useState(false); - const timeAgo = formatDistance(new Date(item.create_date), Date.now()); + const timeAgo = formatDistance(new Date(item.created_at), Date.now()); const userAlert = userAlerts.find(a => a.id === item.id); const isRead = userAlert ? userAlert.read : false; diff --git a/src/app-pages/instrument/alert/alert-note-form.jsx b/src/app-pages/instrument/alert/alert-note-form.jsx index 3773a59c..d664d876 100644 --- a/src/app-pages/instrument/alert/alert-note-form.jsx +++ b/src/app-pages/instrument/alert/alert-note-form.jsx @@ -4,11 +4,11 @@ import { format } from 'date-fns'; import { ModalFooter, ModalHeader } from '../../../app-components/modal'; const AlertNoteForm = ({ item }) => { - const { name, body, create_date, note = '' } = item; + const { name, body, created_at, note = '' } = item; const [noteValue, setNoteValue] = useState(note); - const formattedDate = format(new Date(create_date), 'MMM dd, yyyy HH:mm:ss'); + const formattedDate = format(new Date(created_at), 'MMM dd, yyyy HH:mm:ss'); return (
diff --git a/src/app-pages/instrument/details.jsx b/src/app-pages/instrument/details.jsx index 6c6582da..4f7e3c63 100644 --- a/src/app-pages/instrument/details.jsx +++ b/src/app-pages/instrument/details.jsx @@ -19,8 +19,8 @@ import Settings from './settings'; import SetInitialTimeModal from './setInitialTimeModal'; const sortAlertsByDate = alerts => alerts.sort((a, b) => { - if (a.create_date > b.create_date) return -1; - if (b.create_date > a.create_date) return 1; + if (a.created_at > b.created_at) return -1; + if (b.created_at > a.created_at) return 1; return 0; }); diff --git a/src/app-pages/instrument/instrument-display.jsx b/src/app-pages/instrument/instrument-display.jsx index 79accb0a..73d3ce38 100644 --- a/src/app-pages/instrument/instrument-display.jsx +++ b/src/app-pages/instrument/instrument-display.jsx @@ -94,8 +94,8 @@ export default connect(
Created On
- {item.create_date - ? new Date(item.create_date).toLocaleDateString() + {item.created_at + ? new Date(item.created_at).toLocaleDateString() : 'N/A'}
@@ -105,8 +105,8 @@ export default connect( Last Modified On
- {item.update_date - ? new Date(item.update_date).toLocaleDateString() + {item.updated_at + ? new Date(item.updated_at).toLocaleDateString() : 'N/A'}
diff --git a/src/app-pages/instrument/timeseries/timeseries.jsx b/src/app-pages/instrument/timeseries/timeseries.jsx index 231637e1..903903f6 100644 --- a/src/app-pages/instrument/timeseries/timeseries.jsx +++ b/src/app-pages/instrument/timeseries/timeseries.jsx @@ -56,7 +56,7 @@ const getColumnDefs = (measurements, activeTimeseries, updateMeasurement) => { resizable: true, sortable: true, filter: true, - editable: true, + editable: key !== 'time', cellEditor: getCellEditor(key), onCellValueChanged: cell => updateMeasurement(cell), })), diff --git a/src/app-pages/profile/userProfile.jsx b/src/app-pages/profile/userProfile.jsx index 211a694c..73f25741 100644 --- a/src/app-pages/profile/userProfile.jsx +++ b/src/app-pages/profile/userProfile.jsx @@ -30,13 +30,13 @@ const buildAlertContent = (alerts = [], onClick = () => {}) => { return ( <> {alerts.map(alert => { - const { project_name, instruments, name, body, read, create_date } = alert; + const { project_name, instruments, name, body, read, created_at } = alert; return instruments.map(instrument => { const { instrument_name, instrument_id } = instrument; const url = `/${urlify(project_name)}/instruments/${urlify(instrument_name)}`; - const timeAgo = formatDistance(new Date(create_date), Date.now()); + const timeAgo = formatDistance(new Date(created_at), Date.now()); return (
{ - const { create_date } = data; - const formatted = DateTime.fromISO(create_date).toFormat('LLL dd, yyyy'); + const { created_at } = data; + const formatted = DateTime.fromISO(created_at).toFormat('LLL dd, yyyy'); return {formatted}; }, diff --git a/src/app-pages/project/qa-qc/components/tables/evaluationList.jsx b/src/app-pages/project/qa-qc/components/tables/evaluationList.jsx index ee531bf5..65f690a8 100644 --- a/src/app-pages/project/qa-qc/components/tables/evaluationList.jsx +++ b/src/app-pages/project/qa-qc/components/tables/evaluationList.jsx @@ -39,12 +39,12 @@ const EvaluationList = connect( header: 'Body', isSortable: true, }, { - key: 'create_date', + key: 'created_at', header: 'Evaluation Date', isSortable: true, render: (data) => { - const { create_date } = data; - const formatted = DateTime.fromISO(create_date).toFormat('LLL dd, yyyy'); + const { created_at } = data; + const formatted = DateTime.fromISO(created_at).toFormat('LLL dd, yyyy'); return {formatted}; }, diff --git a/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx b/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx index a578b624..0f86a9c2 100644 --- a/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx +++ b/src/app-pages/project/qa-qc/components/tables/submittalsTable.jsx @@ -63,10 +63,10 @@ const SubmittalsTable = connect( header: 'Alert Type', isSortable: true, }, { - key: 'create_date', + key: 'created_at', header: 'Submittal Create Date', render: data => ( - {DateTime.fromISO(data?.create_date).toFormat('MMM dd, yyyy HH:mm:ss')} + {DateTime.fromISO(data?.created_at).toFormat('MMM dd, yyyy HH:mm:ss')} ), }, { key: 'due_at', diff --git a/src/app-services/collections/survey123.ts b/src/app-services/collections/survey123.ts index e5346031..17dfd21d 100644 --- a/src/app-services/collections/survey123.ts +++ b/src/app-services/collections/survey123.ts @@ -5,18 +5,18 @@ import { apiGet, apiPost, apiPut, apiDelete } from '../fetch-helpers'; import { TimeseriesPostParams, Timeseries, postTimeseriesMutation } from './timeseries'; interface Survey123 { - create_date?: string; - creator_id?: string; - creator_username?: string; + created_at?: string; + created_by?: string; + created_by_username?: string; errors?: string[]; id?: string; name?: string; project_id?: string; fields?: Survey123EquivalencyTableRow[]; slug?: string; - update_date?: string; - updater_id?: string; - updater_username?: string; + updated_at?: string; + updated_by?: string; + updated_by_username?: string; }; interface Survey123EquivalencyTableRow {