Skip to content

Commit

Permalink
feat: add last seen column to drone status line
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-advantitge committed Nov 2, 2024
1 parent 07fc068 commit fe978a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/views/uavs/DroneStatusLine.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import {
getSemanticsForRSSI,
} from '~/model/enums';
import { getPreferredCoordinateFormatter } from '~/selectors/formatting';
import { formatCoordinateArray, formatRSSI } from '~/utils/formatting';
import { formatCoordinateArray, formatRSSI, shortTimeAgoFormatter } from '~/utils/formatting';

import TimeAgo from 'react-timeago';

/**
* Converts the absolute value of a heading deviation, in degrees, to the
Expand Down Expand Up @@ -123,6 +125,7 @@ const DroneStatusLine = ({
secondaryLabel,
text,
textSemantics,
lastUpdated,
}) => {
const classes = useStyles();
const { amsl, ahl, agl } = position || {};
Expand Down Expand Up @@ -187,6 +190,7 @@ const DroneStatusLine = ({
<StatusText status={headingDeviationToStatus(headingDeviation)}>
{padStart(!isNil(heading) ? Math.round(heading) + '°' : '', 5)}
</StatusText>
<TimeAgo formatter={(...args) => padStart(padEnd(shortTimeAgoFormatter(...args), 5), 6)} date={lastUpdated} />
{localPosition ? (
padEnd(localCoordinateFormatter(localPosition), 25)
) : position ? (
Expand Down Expand Up @@ -275,6 +279,7 @@ export default connect(
mode: uav ? uav.mode : undefined,
position: uav ? uav.position : undefined,
rssi: uav ? uav.rssi?.[0] : undefined,
lastUpdated: uav ? uav.lastUpdated : undefined,
...statusSummarySelector(state, ownProps.id),
};
};
Expand Down
7 changes: 7 additions & 0 deletions src/views/uavs/SortAndFilterHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ const COMMON_HEADER_TEXT_PARTS = Object.freeze([
width: 40,
},
},
{
label: 'Seen',
style:{
textAlign: 'left',
width: 40,
}
},
{
label: 'Position',
style: {
Expand Down

0 comments on commit fe978a2

Please sign in to comment.