Skip to content

Commit

Permalink
Show metadata as table
Browse files Browse the repository at this point in the history
  • Loading branch information
ugyballoons committed Sep 26, 2024
1 parent 2482cd2 commit 5f2f0e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
16 changes: 7 additions & 9 deletions src/js/components/MosaicView.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, { useState, useEffect } from "react"
import PropTypes from "prop-types"
import { WebsocketClient } from "../modules/ws-service-client"
import {
cameraType,
channelDataType,
eventType,
metadataType,
mosaicSingleView,
Expand Down Expand Up @@ -159,21 +157,21 @@ ChannelImage.propTypes = {
}

function ChannelMetadata({ view, metadata }) {
const { metaColumns: viewColumns, latestEvent: {seq_num: seqNum} } = view
const { channel, metaColumns: viewColumns, latestEvent: {seq_num: seqNum} } = view
const columns = [...commonColumns, ...viewColumns]
const metadatum = metadata[seqNum] || {}
return (
<ul className="viewMeta">
<table className="viewMeta" id={`table-${channel}`}>
{columns.map((column) => {
const value = metadatum[column] ? metadatum[column] : "No value set"
return (
<li key={column} className="viewMetaCol">
<div className="colName">{column}</div>
<div className="colValue">{value}</div>
</li>
<tr key={column} className="viewMetaCol">
<th scope="row" className="colName">{column}</th>
<td className="colValue">{value}</td>
</tr>
)
})}
</ul>
</table>
)
}
ChannelMetadata.propTypes = {
Expand Down
18 changes: 14 additions & 4 deletions src/sass/style.sass
Original file line number Diff line number Diff line change
Expand Up @@ -544,19 +544,29 @@ section
justify-content: space-between
gap: 1em


.view
width: 100%

.viewImage
width: 100%
background: rgba(255,255,255,0.3)
aspect-ratio: 1

.viewMeta
width: 100%
margin-top: 1em
border-collapse: separate
border-spacing: 0 0.1em

.colName
width: min-content

.viewMetaCol
.colValue
font-family: 'Red Hat Mono', monospace

.placeholder
background: rgba(0,0,0,0.3)
display: flex
justify-content: center
align-items: center

.colName
flex-basis: 52%

0 comments on commit 5f2f0e5

Please sign in to comment.