Skip to content

Commit

Permalink
Show dates only for channels
Browse files Browse the repository at this point in the history
  • Loading branch information
ugyballoons committed Sep 26, 2024
1 parent da346b1 commit c318a46
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
6 changes: 0 additions & 6 deletions python/lsst/ts/rubintv/templates/mosaic.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
Latest Mosaic
{% endblock pagesubtitle %}

{% block undertitle %}
{% if date %}
<div id="header-date">{{ date }}</div>
{% endif %}
{% endblock undertitle %}

{% block breadcrumb %}
<a href="{{ url_for('home') }}">
Home
Expand Down
39 changes: 20 additions & 19 deletions src/js/components/MosaicView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import {
metadataType,
mosaicSingleView,
} from "./componentPropTypes"
import { simpleGet } from "../modules/utils"

const commonColumns = ["seqNum"]

export default function MosaicView({ locationName, camera, initialDate }) {
export default function MosaicView({ locationName, camera }) {
const [historicalBusy, setHistoricalBusy] = useState(null)
const [currentMeta, setCurrentMeta] = useState({})
const [date, setDate] = useState(initialDate)

const initialViews = camera.mosaic_view_meta.map((view) => ({
...view,
Expand All @@ -23,7 +21,7 @@ export default function MosaicView({ locationName, camera, initialDate }) {

useEffect(() => {
function handleMetadataChange(event) {
const { datestamp, data, dataType } = event.detail
const { data, dataType } = event.detail
if (Object.entries(data).length < 1 || dataType !== "metadata") {
return
}
Expand Down Expand Up @@ -51,7 +49,7 @@ export default function MosaicView({ locationName, camera, initialDate }) {

useEffect(() => {
function handleChannelEvent(event) {
const { datestamp, data } = event.detail
const { data } = event.detail
if (!data) {
return
}
Expand All @@ -70,9 +68,6 @@ export default function MosaicView({ locationName, camera, initialDate }) {

return (
<div className="viewsArea">
<h3 className="viewsTitle">
Mosaic View: <span className="date">{date}</span>
</h3>
<ul className="views">
{views.map((view) => {
return (
Expand All @@ -93,7 +88,6 @@ export default function MosaicView({ locationName, camera, initialDate }) {
MosaicView.propTypes = {
locationName: PropTypes.string,
camera: cameraType,
initialDate: PropTypes.string,
}

function ChannelView({ locationName, camera, view, currentMeta }) {
Expand All @@ -103,9 +97,14 @@ function ChannelView({ locationName, camera, view, currentMeta }) {
} catch (error) {
return <h3>Channel {view.channel} not found</h3>
}
const { latestEvent: { day_obs: dayObs }} = view
return (
<>
<h3 className="channel">{channel.title}</h3>
<h3 className="channel">{channel.title}
{ dayObs && (
<span>: { dayObs }</span>
) }
</h3>
<ChannelImage
locationName={locationName}
camera={camera}
Expand Down Expand Up @@ -162,15 +161,17 @@ function ChannelMetadata({ view, metadata }) {
const metadatum = metadata[seqNum] || {}
return (
<table className="viewMeta" id={`table-${channel}`}>
{columns.map((column) => {
const value = metadatum[column] ? metadatum[column] : "No value set"
return (
<tr key={column} className="viewMetaCol">
<th scope="row" className="colName">{column}</th>
<td className="colValue">{value}</td>
</tr>
)
})}
<tbody>
{columns.map((column) => {
const value = metadatum[column] ? metadatum[column] : "No value set"
return (
<tr key={column} className="viewMetaCol">
<th scope="row" className="colName">{column}</th>
<td className="colValue">{value}</td>
</tr>
)
})}
</tbody>
</table>
)
}
Expand Down
2 changes: 0 additions & 2 deletions src/js/pages/mosaic-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { _getById } from "../modules/utils"
;(function () {
const locationName = window.APP_DATA.locationName || ""
const camera = window.APP_DATA.camera || {}
const date = window.APP_DATA.date || ""
const ws = new WebsocketClient()
ws.subscribe("historicalStatus")
ws.subscribe("service", "camera", locationName, camera.name)
Expand All @@ -22,7 +21,6 @@ import { _getById } from "../modules/utils"
<MosaicView
locationName={locationName}
camera={camera}
initialDate={date}
/>
</React.StrictMode>
)
Expand Down

0 comments on commit c318a46

Please sign in to comment.