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

Implement MT Light Path #481

Merged
merged 3 commits into from
Jul 6, 2023
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
4 changes: 2 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
===============
Version History
===============
v5.22.1
v5.23.0
--------

* Implement MT Light Path `<https://github.com/lsst-ts/LOVE-frontend/pull/481>`_
* Move Authlist components to Observatory index `<https://github.com/lsst-ts/LOVE-frontend/pull/480>`_

v5.22.0
Expand Down
2 changes: 1 addition & 1 deletion love/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "love",
"version": "5.22.1",
"version": "5.23.0",
"private": true,
"dependencies": {
"@emotion/core": "^10.3.1",
Expand Down
50 changes: 50 additions & 0 deletions love/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,31 @@ export const stateToStyleLightpath = {
'UNKNOWN POSITION': 'invalid',
};

// CCCAmera
export const ccCameraImageReadinessDetailedStateToStyle = {
READY: 'ok',
'NOT READY': 'warning',
'GETTING READY': 'warning',
UNKNOWN: 'invalid',
};

export const ccCameraShutterDetailedStateToStyle = {
CLOSED: 'ok',
OPEN: 'ok',
CLOSING: 'warning',
OPENING: 'warning',
UNKNOWN: 'invalid',
};

export const ccCameraFilterChangerDetailedStateToStyle = {
UNLOADING: 'warning',
LOADING: 'warning',
LOADED: 'ok',
UNLOADED: 'warning',
ROTATING: 'warning',
UNKNOWN: 'invalid',
};

// MTM1M3
export const m1m3DetailedStateToStyle = {
'DISABLED STATE': 'warning',
Expand Down Expand Up @@ -928,6 +953,31 @@ export const cameraStates = {
},
};

// CCCAmera
export const ccCameraImageReadinessDetailedStateMap = {
1: 'READY',
2: 'NOT READY',
3: 'GETTING READY',
0: 'UNKNOWN',
};

export const ccCameraShutterDetailedStateMap = {
1: 'CLOSED',
2: 'OPEN',
3: 'CLOSING',
4: 'OPENING',
0: 'UNKNOWN',
};

export const ccCameraFilterChangerDetailedStateMap = {
1: 'UNLOADING',
2: 'LOADING',
3: 'LOADED',
4: 'UNLOADED',
5: 'ROTATING',
0: 'UNKNOWN',
};

// M1M3
export const m1m3DetailedStateMap = {
1: 'DISABLED STATE',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import SimonyiLightPath from './SimonyiLightPath';
import { getMTLightPathStatus } from '../../../redux/selectors';
import { addGroup, removeGroup } from '../../../redux/actions/ws';
import SubscriptionTableContainer from '../../GeneralPurpose/SubscriptionTable/SubscriptionTable.container';

export const schema = {
description:
'Diagram containing high-level information about the Simonyi mount sub-components, including M2, M1M3, Cameras, and mirror covers',
defaultSize: [22, 34],
props: {
title: {
type: 'string',
description: 'Name diplayed in the title bar (if visible)',
isPrivate: false,
default: 'Simonyi Lightpath',
},
lightPath: {
type: 'boolean',
description: 'Whether to display a representation of the light coming into the telescope',
isPrivate: false,
default: true,
},
},
allowOverflow: true,
};

const SimonyiLightPathContainer = ({ ...props }) => {
if (props.isRaw) {
return <SubscriptionTableContainer subscriptions={props.subscriptions}></SubscriptionTableContainer>;
}
return <SimonyiLightPath {...props} />;
};

const mapStateToProps = (state) => {
const mtLightPathStatus = getMTLightPathStatus(state);
return {
...mtLightPathStatus,
};
};

const mapDispatchToProps = (dispatch) => {
const subscriptions = [
'event-MTM2-0-m2AssemblyInPosition',
'telemetry-MTM2-0-position',
'event-MTM1M3-0-detailedState',
'event-MTMount-0-mirrorCoversMotionState',
'event-CCCamera-0-imageReadinessDetailedState',
'event-CCCamera-0-shutterDetailedState',
'event-CCCamera-0-raftsDetailedState',
'event-CCCamera-0-calibrationDetailedState',
'event-CCCamera-0-ccsCommandState',
'event-CCCamera-0-filterChangerDetailedState',
'event-CCCamera-0-offlineDetailedState',
'event-CCCamera-0-endSetFilter',
'event-MTCamera-0-imageReadinessDetailedState',
'event-MTCamera-0-shutterDetailedState',
'event-MTCamera-0-raftsDetailedState',
];
return {
subscriptions,
subscribeToStreams: () => {
subscriptions.forEach((s) => dispatch(addGroup(s)));
},
unsubscribeToStreams: () => {
subscriptions.forEach((s) => dispatch(removeGroup(s)));
},
};
};

SimonyiLightPathContainer.propTypes = {
/** Wheter the component is in raw mode */
isRaw: PropTypes.bool,
/** List of the component's subscriptions */
subscriptions: PropTypes.array,
};

export default connect(mapStateToProps, mapDispatchToProps)(SimonyiLightPathContainer);
Loading