Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert narrativelog date_begin and date_end TAI datetimes to UTC. #681

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version History
v6.5.0
------

* Convert narrativelog date_begin and date_end TAI datetimes to UTC. `<https://github.com/lsst-ts/LOVE-frontend/pull/681>`_
* Extend ScriptQueue ConfigPanel component to load scripts schemas on demand. `<https://github.com/lsst-ts/LOVE-frontend/pull/680>`_

v6.4.1
Expand Down
22 changes: 16 additions & 6 deletions love/src/components/OLE/NonExposure/NonExposure.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export default class NonExposure extends Component {
changeObsTimeLossSelect: PropTypes.func,
/** Function to handle the jira ticket filter */
changeJiraTicketsSelect: PropTypes.func,
/** Difference in seconds between UTC and TAI */
taiToUtc: PropTypes.number,
};

static defaultProps = {
Expand Down Expand Up @@ -160,24 +162,32 @@ export default class NonExposure extends Component {
}

getHeaders = () => {
const { taiToUtc } = this.props;

return [
{
field: 'date_begin',
title: 'Time of incident (UTC)',
type: 'string',
className: styles.tableHead,
render: (value) => moment(value).format(ISO_STRING_DATE_TIME_FORMAT),
render: (value) => moment(value).add(taiToUtc, 'seconds').format(ISO_STRING_DATE_TIME_FORMAT),
},
{
field: 'time_lost',
title: 'Obs. Time Loss',
type: 'string',
className: styles.tableHead,
render: (value, row) => (
<span title={formatOLETimeOfIncident(row.date_begin + 'Z', row.date_end + 'Z') + ' (UTC)'}>
{formatSecondsToDigital(value * 3600)}
</span>
),
render: (value, row) => {
const dateBeginUTC = moment(row.date_begin).add(taiToUtc, 'seconds');
const dateEndUTC = moment(row.date_end).add(taiToUtc, 'seconds');
const dateBeginUTCString = dateBeginUTC.format(ISO_STRING_DATE_TIME_FORMAT);
const dateEndUTCString = dateEndUTC.format(ISO_STRING_DATE_TIME_FORMAT);
return (
<span title={formatOLETimeOfIncident(dateBeginUTCString, dateEndUTCString) + ' (UTC)'}>
{formatSecondsToDigital(value * 3600)}
</span>
);
},
},
{
field: 'date_begin',
Expand Down
10 changes: 9 additions & 1 deletion love/src/components/OLE/OLE.container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import React from 'react';
import { connect } from 'react-redux';
import SubscriptionTableContainer from 'components/GeneralPurpose/SubscriptionTable/SubscriptionTable.container';
import { addGroup, removeGroup } from 'redux/actions/ws';
import { getTaiToUtc } from 'redux/selectors';
import OLE from './OLE';

export const schema = {
Expand Down Expand Up @@ -62,6 +63,13 @@ const OLEContainer = ({ subscribeToStreams, unsubscribeToStreams, ...props }) =>
);
};

const mapStateToProps = (state) => {
const taiToUtc = getTaiToUtc(state);
return {
taiToUtc,
};
};

const mapDispatchToProps = (dispatch) => {
const subscriptions = [];
return {
Expand All @@ -75,4 +83,4 @@ const mapDispatchToProps = (dispatch) => {
};
};

export default connect(null, mapDispatchToProps)(OLEContainer);
export default connect(mapStateToProps, mapDispatchToProps)(OLEContainer);
2 changes: 2 additions & 0 deletions love/src/components/OLE/OLE.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default class OLE extends Component {
}

getComponent(clickNewLog, tab) {
const { taiToUtc } = this.props;
if (clickNewLog === true) {
if (tab === 'exposure') {
return (
Expand Down Expand Up @@ -158,6 +159,7 @@ export default class OLE extends Component {
changeObsTimeLossSelect={(value) => this.changeObsTimeLossSelect(value)}
selectedJiraTickets={this.state.selectedJiraTickets}
changeJiraTicketsSelect={(value) => this.changeJiraTicketsSelect(value)}
taiToUtc={taiToUtc}
/>
);
}
Expand Down
Loading