Skip to content

Commit

Permalink
bugfix/timeseries-edit-error (#249)
Browse files Browse the repository at this point in the history
* remove ability to edit time field on timeseries table
* update to new update/create api keyes
  • Loading branch information
KevinJJackson authored Dec 6, 2024
1 parent 737ffc6 commit e59c590
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/app-pages/instrument/alert/alert-editor-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export default connect(
}}
/>
</div>
{alert.update_date && (
{alert.updated_at && (
<div className='text-right mt-3'>
<small>{`Last Updated at ${alert.update_date}`}</small>
<small>{`Last Updated at ${alert.updated_at}`}</small>
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app-pages/instrument/alert/alert-entry.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/app-pages/instrument/alert/alert-note-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className='modal-content' style={{ overflowY: 'auto' }}>
Expand Down
4 changes: 2 additions & 2 deletions src/app-pages/instrument/details.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down
8 changes: 4 additions & 4 deletions src/app-pages/instrument/instrument-display.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export default connect(
<div className='row mb-2'>
<div className='col-4 text-right font-weight-light'>Created On</div>
<div className='col'>
{item.create_date
? new Date(item.create_date).toLocaleDateString()
{item.created_at
? new Date(item.created_at).toLocaleDateString()
: 'N/A'}
</div>
</div>
Expand All @@ -105,8 +105,8 @@ export default connect(
Last Modified On
</div>
<div className='col'>
{item.update_date
? new Date(item.update_date).toLocaleDateString()
{item.updated_at
? new Date(item.updated_at).toLocaleDateString()
: 'N/A'}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app-pages/instrument/timeseries/timeseries.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})),
Expand Down
4 changes: 2 additions & 2 deletions src/app-pages/profile/userProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ const AlertConfigList = connect(
header: 'Alert Type',
isSortable: true,
}, {
key: 'create_date',
key: 'created_at',
header: 'Created On',
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 <span>{formatted}</span>;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <span>{formatted}</span>;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ const SubmittalsTable = connect(
header: 'Alert Type',
isSortable: true,
}, {
key: 'create_date',
key: 'created_at',
header: 'Submittal Create Date',
render: data => (
<span>{DateTime.fromISO(data?.create_date).toFormat('MMM dd, yyyy HH:mm:ss')}</span>
<span>{DateTime.fromISO(data?.created_at).toFormat('MMM dd, yyyy HH:mm:ss')}</span>
),
}, {
key: 'due_at',
Expand Down
12 changes: 6 additions & 6 deletions src/app-services/collections/survey123.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e59c590

Please sign in to comment.