Merge pull request 'more accurate system status' (#25) from bugfix/dashboard into develop

Reviewed-on: #25
This commit is contained in:
2025-12-17 09:46:26 +00:00
3 changed files with 19 additions and 12 deletions

View File

@@ -53,7 +53,7 @@ const RegionSelector = ({
const getMagnificationLevel = () => {
const test = socket.data;
if (!socket.data) return null;
console.log(test);
if (!test || !test.magnificationLevel) return "1x";
return test?.magnificationLevel;
};
@@ -108,12 +108,12 @@ const RegionSelector = ({
const handleSaveclick = () => {
const regions: ColourData[] = [];
const test = Array.from(paintedCells.entries());
const region1 = test.filter(([, cell]) => cell.region.name === "Bay 1");
const region2 = test.filter(([, cell]) => cell.region.name === "Bay 2");
const region3 = test.filter(([, cell]) => cell.region.name === "Bay 3");
const region4 = test.filter(([, cell]) => cell.region.name === "Bay 4");
const region5 = test.filter(([, cell]) => cell.region.name === "Bay 5");
const paintedCellsArray = Array.from(paintedCells.entries());
const region1 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 1");
const region2 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 2");
const region3 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 3");
const region4 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 4");
const region5 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 5");
const region1Data = {
id: 1,
cells: region1.map(([key]) => [parseInt(key.split("-")[1]), parseInt(key.split("-")[0])]),

View File

@@ -11,10 +11,14 @@ type CameraStatusProps = {
};
const CameraStatus = ({ title, category, isError }: CameraStatusProps) => {
const isAllGood = category && category.length > 0 && category.every((status) => status.tags.includes("RUNNING"));
// check if some are down
// check if all are down
//check if offline
const isAllGood =
category &&
category.length > 0 &&
category.every((status) => {
const allowedTags = ["RUNNING", "VIDEO-PLAYING"];
return status.tags.every((tag) => allowedTags.includes(tag));
});
return (
<Card className="p-4">
<div className="border-b border-gray-600">

View File

@@ -10,7 +10,10 @@ type CameraStatusGridItemProps = {
const CameraStatusGridItem = ({ title, statusCategory }: CameraStatusGridItemProps) => {
const [isOpen, setIsOpen] = useState(false);
const isAllGood = statusCategory?.every((status) => status.tags.includes("RUNNING"));
const isAllGood = statusCategory?.every((status) => {
const allowedTags = ["RUNNING", "VIDEO-PLAYING"];
return status.tags.every((tag) => allowedTags.includes(tag));
});
const handleClick = () => {
setIsOpen(false);