- removed console.log

- fixed issue for more extensive check into tags to be more accurate
This commit is contained in:
2025-12-17 09:44:14 +00:00
parent 3fbafbbcc7
commit 71ce2a9f91
3 changed files with 19 additions and 12 deletions

View File

@@ -53,7 +53,7 @@ const RegionSelector = ({
const getMagnificationLevel = () => { const getMagnificationLevel = () => {
const test = socket.data; const test = socket.data;
if (!socket.data) return null; if (!socket.data) return null;
console.log(test);
if (!test || !test.magnificationLevel) return "1x"; if (!test || !test.magnificationLevel) return "1x";
return test?.magnificationLevel; return test?.magnificationLevel;
}; };
@@ -108,12 +108,12 @@ const RegionSelector = ({
const handleSaveclick = () => { const handleSaveclick = () => {
const regions: ColourData[] = []; const regions: ColourData[] = [];
const test = Array.from(paintedCells.entries()); const paintedCellsArray = Array.from(paintedCells.entries());
const region1 = test.filter(([, cell]) => cell.region.name === "Bay 1"); const region1 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 1");
const region2 = test.filter(([, cell]) => cell.region.name === "Bay 2"); const region2 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 2");
const region3 = test.filter(([, cell]) => cell.region.name === "Bay 3"); const region3 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 3");
const region4 = test.filter(([, cell]) => cell.region.name === "Bay 4"); const region4 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 4");
const region5 = test.filter(([, cell]) => cell.region.name === "Bay 5"); const region5 = paintedCellsArray.filter(([, cell]) => cell.region.name === "Bay 5");
const region1Data = { const region1Data = {
id: 1, id: 1,
cells: region1.map(([key]) => [parseInt(key.split("-")[1]), parseInt(key.split("-")[0])]), 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 CameraStatus = ({ title, category, isError }: CameraStatusProps) => {
const isAllGood = category && category.length > 0 && category.every((status) => status.tags.includes("RUNNING")); const isAllGood =
// check if some are down category &&
// check if all are down category.length > 0 &&
//check if offline category.every((status) => {
const allowedTags = ["RUNNING", "VIDEO-PLAYING"];
return status.tags.every((tag) => allowedTags.includes(tag));
});
return ( return (
<Card className="p-4"> <Card className="p-4">
<div className="border-b border-gray-600"> <div className="border-b border-gray-600">

View File

@@ -10,7 +10,10 @@ type CameraStatusGridItemProps = {
const CameraStatusGridItem = ({ title, statusCategory }: CameraStatusGridItemProps) => { const CameraStatusGridItem = ({ title, statusCategory }: CameraStatusGridItemProps) => {
const [isOpen, setIsOpen] = useState(false); 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 = () => { const handleClick = () => {
setIsOpen(false); setIsOpen(false);