Compare commits
10 Commits
feature/ba
...
feature/ou
| Author | SHA1 | Date | |
|---|---|---|---|
| 16829ad5a5 | |||
| ec81392899 | |||
| 8c967b3ae2 | |||
| 27d2c6a1b9 | |||
| 31b6bd45f5 | |||
| c9dde6b992 | |||
| d15a69e6b9 | |||
| b18e11ca6a | |||
| e984c74333 | |||
| 25a744bd8d |
@@ -1,10 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MAV | BayiQ</title>
|
||||
<title>BayIQ</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
"@tanstack/react-router": "^1.136.18",
|
||||
"@tanstack/react-router-devtools": "^1.136.18",
|
||||
"clsx": "^2.1.1",
|
||||
"formik": "^2.4.9",
|
||||
"konva": "^10.0.11",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import Card from "../../../ui/Card";
|
||||
import CardHeader from "../../../ui/CardHeader";
|
||||
|
||||
type CameraStatusProps = {
|
||||
title: string;
|
||||
status?: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const CameraStatus = ({ title, status, description }: CameraStatusProps) => {
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<CardHeader title={title} status={status} />
|
||||
<p className=" text-gray-500">{description}</p>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default CameraStatus;
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import CameraStatus from "./CameraStatus";
|
||||
import SystemOverview from "./SystemOverview";
|
||||
import SystemStatusCard from "./SystemStatusCard";
|
||||
|
||||
const DashboardGrid = () => {
|
||||
return (
|
||||
<div>
|
||||
<div className="grid grid-cols-1 md:grid-rows-2 md:grid-cols-2">
|
||||
<SystemStatusCard />
|
||||
<SystemOverview />
|
||||
<div className="grid grid-cols-1 md:col-span-2 md:grid-cols-3">
|
||||
<CameraStatus title="Camera 1" status={"bg-red-500"} description={"Camera not responding"} />
|
||||
<CameraStatus title="Camera 2" status={"bg-gray-500"} description={"Camera Offline"} />
|
||||
<CameraStatus title="Camera 3" status={"bg-gray-500"} description={"Camera Offline"} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { faHardDrive } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
type StatusItemProps = {
|
||||
statusInfoItem: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const StatusItemCPU = ({ statusInfoItem, description }: StatusItemProps) => {
|
||||
return (
|
||||
<div className="p-3 border border-gray-700 rounded-lg hover:bg-[#233241]">
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<span className="font-bold text-xl bg-slate-700 p-1 px-2 rounded-md">
|
||||
<FontAwesomeIcon icon={faHardDrive} />
|
||||
</span>
|
||||
<p className="text-lg">{statusInfoItem}</p>
|
||||
</div>
|
||||
<p className="text-slate-400">{description}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusItemCPU;
|
||||
@@ -0,0 +1,31 @@
|
||||
import { faClock } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
type StatusItemProps = {
|
||||
statusInfoItem: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const StatusItemLocal = ({ statusInfoItem, description }: StatusItemProps) => {
|
||||
const humanReadable = (string: string) => {
|
||||
if (description.toLowerCase().includes("local")) {
|
||||
const text = string.slice(0, statusInfoItem.length - 5);
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-3 border border-gray-700 rounded-lg hover:bg-[#233241]">
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<span className="font-bold text-xl bg-slate-700 p-1 px-2 rounded-md">
|
||||
<FontAwesomeIcon icon={faClock} />
|
||||
</span>
|
||||
<p className="text-lg">{description.toLowerCase().includes("local") && humanReadable(statusInfoItem)}</p>
|
||||
</div>
|
||||
|
||||
<p className="text-slate-400">{description}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusItemLocal;
|
||||
@@ -0,0 +1,24 @@
|
||||
import { faMicrochip } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
type StatusItemProps = {
|
||||
statusInfoItem: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const StatusItemThreads = ({ statusInfoItem, description }: StatusItemProps) => {
|
||||
return (
|
||||
<div className="p-3 border border-gray-700 rounded-lg hover:bg-[#233241]">
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<span className="font-bold text-xl bg-slate-700 p-1 px-2 rounded-md">
|
||||
<FontAwesomeIcon icon={faMicrochip} />
|
||||
</span>
|
||||
<p className="text-lg">{statusInfoItem}</p>
|
||||
</div>
|
||||
|
||||
<p className="text-slate-400">{description}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusItemThreads;
|
||||
@@ -0,0 +1,32 @@
|
||||
import { faClock } from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
type StatusItemProps = {
|
||||
statusInfoItem: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const StatusItemUTC = ({ statusInfoItem, description }: StatusItemProps) => {
|
||||
const humanReadable = (string: string) => {
|
||||
if (description.includes("UTC")) {
|
||||
const text = string.slice(0, statusInfoItem.length - 3);
|
||||
return text;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="p-3 border border-gray-700 rounded-lg hover:bg-[#233241]">
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<span className="font-bold text-xl bg-slate-700 p-1 px-2 rounded-md">
|
||||
<FontAwesomeIcon icon={faClock} />
|
||||
</span>
|
||||
|
||||
<p className="text-lg">{description.toLowerCase().includes("utc") && humanReadable(statusInfoItem)}</p>
|
||||
</div>
|
||||
|
||||
<p className="text-slate-400">{description}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusItemUTC;
|
||||
38
src/features/dashboard/components/SystemHealth.tsx
Normal file
38
src/features/dashboard/components/SystemHealth.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import type { SystemHealthStatus } from "../../../types/types";
|
||||
import Badge from "../../../ui/Badge";
|
||||
|
||||
type SystemHealthProps = {
|
||||
startTime: string;
|
||||
uptime: string;
|
||||
statuses: SystemHealthStatus[];
|
||||
isLoading: boolean;
|
||||
};
|
||||
|
||||
const SystemHealth = ({ startTime, uptime, statuses, isLoading }: SystemHealthProps) => {
|
||||
if (isLoading) {
|
||||
return <span className="text-slate-500">Loading system health…</span>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="h-100 md:h-70">
|
||||
<div className="p-2 border-b border-gray-600 grid grid-cols-2 justify-between">
|
||||
<div>
|
||||
<h3 className="text-lg">Start Time</h3> <span className="text-slate-300">{startTime}</span>
|
||||
</div>
|
||||
<div>
|
||||
<h3 className="text-lg">Up Time</h3> <span className="text-slate-300">{uptime}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{statuses?.map((status: SystemHealthStatus) => (
|
||||
<div className="border border-gray-700 p-4 rounded-md m-2 flex justify-between">
|
||||
<span>{status.id}</span> <Badge text={status.tags[0]} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SystemHealth;
|
||||
22
src/features/dashboard/components/SystemOverview.tsx
Normal file
22
src/features/dashboard/components/SystemOverview.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { faArrowsRotate } from "@fortawesome/free-solid-svg-icons";
|
||||
import Card from "../../../ui/Card";
|
||||
import CardHeader from "../../../ui/CardHeader";
|
||||
import { useGetSystemHealth } from "../hooks/useGetSystemHealth";
|
||||
import SystemHealth from "./SystemHealth";
|
||||
|
||||
const SystemOverview = () => {
|
||||
const { query } = useGetSystemHealth();
|
||||
|
||||
const startTime = query?.data?.StartTimeHumane;
|
||||
const uptime = query?.data?.UptimeHumane;
|
||||
const statuses = query?.data?.Status;
|
||||
const isLoading = query?.isLoading;
|
||||
return (
|
||||
<Card className="p-4">
|
||||
<CardHeader title="System Health" refetch={query?.refetch} icon={faArrowsRotate} />
|
||||
<SystemHealth startTime={startTime} uptime={uptime} statuses={statuses} isLoading={isLoading} />
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default SystemOverview;
|
||||
@@ -1,20 +1,24 @@
|
||||
import { useInfoSocket } from "../../../app/context/WebSocketContext";
|
||||
import Card from "../../../ui/Card";
|
||||
import CardHeader from "../../../ui/CardHeader";
|
||||
import StatusItemCPU from "./StatusItems/StatusItemCPU";
|
||||
import StatusItemLocal from "./StatusItems/StatusItemLocal";
|
||||
import StatusItemThreads from "./StatusItems/StatusItemThreads";
|
||||
import StatusItemUTC from "./StatusItems/StatusItemUTC";
|
||||
|
||||
const SystemStatusCard = () => {
|
||||
const { data: stats } = useInfoSocket();
|
||||
|
||||
return (
|
||||
<Card className="p-4 w-[40%]">
|
||||
<CardHeader title="Overview" />
|
||||
<Card className="p-4">
|
||||
<CardHeader title="System Status" />
|
||||
{stats ? (
|
||||
<>
|
||||
<div>UTC: {stats["system-clock-utc"]}</div>
|
||||
<span>Local: {stats["system-clock-local"]}</span>
|
||||
<span>CPU: {stats["memory-cpu-status"]}</span>
|
||||
<span>Threads: {stats["thread-count"]}</span>
|
||||
</>
|
||||
<div className="grid grid-cols-2 grid-rows-2 gap-4 col-span-2">
|
||||
<StatusItemUTC statusInfoItem={stats["system-clock-utc"]} description={"UTC Time"} />
|
||||
<StatusItemLocal statusInfoItem={stats["system-clock-local"]} description={"Local Time"} />
|
||||
<StatusItemCPU statusInfoItem={stats["memory-cpu-status"]} description={"CPU"} />
|
||||
<StatusItemThreads statusInfoItem={stats["thread-count"]} description={"Threads"} />
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-slate-500">Loading system status…</span>
|
||||
)}
|
||||
|
||||
15
src/features/dashboard/hooks/useGetSystemHealth.ts
Normal file
15
src/features/dashboard/hooks/useGetSystemHealth.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
const fetchData = async () => {
|
||||
const response = await fetch(`http://100.115.148.59/api/system-health`);
|
||||
if (!response.ok) throw new Error("Cannot get System overview");
|
||||
return response.json();
|
||||
};
|
||||
|
||||
export const useGetSystemHealth = () => {
|
||||
const query = useQuery({
|
||||
queryKey: ["fetchSystemData"],
|
||||
queryFn: fetchData,
|
||||
});
|
||||
return { query };
|
||||
};
|
||||
14
src/features/output/components/BearerTypeCard.tsx
Normal file
14
src/features/output/components/BearerTypeCard.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import Card from "../../../ui/Card";
|
||||
import CardHeader from "../../../ui/CardHeader";
|
||||
import BearerTypeFields from "./BearerTypeFields";
|
||||
|
||||
const BearerTypeCard = () => {
|
||||
return (
|
||||
<Card className="p-4 h-50">
|
||||
<CardHeader title={"Bearer Type"} />
|
||||
<BearerTypeFields />
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default BearerTypeCard;
|
||||
32
src/features/output/components/BearerTypeFields.tsx
Normal file
32
src/features/output/components/BearerTypeFields.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Field } from "formik";
|
||||
|
||||
const BearerTypeFields = () => {
|
||||
return (
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="format" className="text-xl">
|
||||
Format
|
||||
</label>
|
||||
<Field
|
||||
as="select"
|
||||
name="format"
|
||||
id="format"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option key={"JSON"} value={"JSON"}>
|
||||
JSON
|
||||
</option>
|
||||
<option key={"BOF2"} value={"BOF2"}>
|
||||
BOF2
|
||||
</option>
|
||||
<option key={"UTMC"} value={"UTMC"}>
|
||||
UTMC
|
||||
</option>
|
||||
<option key={"FTP"} value={"FTP"}>
|
||||
FTP
|
||||
</option>
|
||||
</Field>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default BearerTypeFields;
|
||||
24
src/features/output/components/ChannelCard.tsx
Normal file
24
src/features/output/components/ChannelCard.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import { useFormikContext } from "formik";
|
||||
import Card from "../../../ui/Card";
|
||||
import CardHeader from "../../../ui/CardHeader";
|
||||
import ChannelFields from "./ChannelFields";
|
||||
import type { FormTypes } from "../../../types/types";
|
||||
|
||||
const ChannelCard = () => {
|
||||
const { values, errors, touched } = useFormikContext<FormTypes>();
|
||||
|
||||
return (
|
||||
<Card className="p-4 h-150 md:h-full">
|
||||
<CardHeader title={`Channel (${values?.format})`} />
|
||||
<ChannelFields errors={errors} touched={touched} values={values} />
|
||||
<button
|
||||
type="submit"
|
||||
className="w-full md:w-1/4 text-white bg-green-700 hover:bg-green-800 font-small rounded-lg text-sm px-2 py-2.5"
|
||||
>
|
||||
{"Save Changes"}
|
||||
</button>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChannelCard;
|
||||
230
src/features/output/components/ChannelFields.tsx
Normal file
230
src/features/output/components/ChannelFields.tsx
Normal file
@@ -0,0 +1,230 @@
|
||||
import { Field } from "formik";
|
||||
import type { FormTypes, InitialValuesFormErrors } from "../../../types/types";
|
||||
|
||||
type ChannelFieldsProps = {
|
||||
values: FormTypes;
|
||||
errors: InitialValuesFormErrors;
|
||||
touched: {
|
||||
connectTimeoutSeconds?: boolean | undefined;
|
||||
readTimeoutSeconds?: boolean | undefined;
|
||||
};
|
||||
};
|
||||
|
||||
const ChannelFields = ({ errors, touched, values }: ChannelFieldsProps) => {
|
||||
return (
|
||||
<div className="flex flex-col gap-4 p-4">
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="backoffice" className="block mb-2 font-medium">
|
||||
Back Office URL
|
||||
</label>
|
||||
<Field
|
||||
name={"backOfficeURL"}
|
||||
type="text"
|
||||
id="backoffice"
|
||||
placeholder="https://www.backoffice.com"
|
||||
className={`p-1.5 border border-gray-400 rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="username" className="block mb-2 font-medium">
|
||||
Username
|
||||
</label>
|
||||
<Field
|
||||
name={"username"}
|
||||
type="text"
|
||||
id="username"
|
||||
placeholder="Back office username"
|
||||
className={`p-1.5 border border-gray-400 rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="password">Password</label>
|
||||
<Field
|
||||
name={"password"}
|
||||
type={"password"}
|
||||
id="password"
|
||||
placeholder="Back office password"
|
||||
className={`p-1.5 border border-gray-400 rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="readTimeoutSeconds">Read Timeout Seconds</label>
|
||||
<Field
|
||||
name={"readTimeoutSeconds"}
|
||||
type="number"
|
||||
id="readTimeoutSeconds"
|
||||
placeholder="https://example.com"
|
||||
className={`p-1.5 border border-gray-400 rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="connectTimeoutSeconds">Connect Timeout Seconds</label>
|
||||
<Field
|
||||
name={"connectTimeoutSeconds"}
|
||||
type="number"
|
||||
id="connectTimeoutSeconds"
|
||||
className={`p-1.5 border border-gray-400 rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="overviewQuality">Overview quality and scale</label>
|
||||
<Field
|
||||
name={"overviewQuality"}
|
||||
as="select"
|
||||
id="overviewQuality"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"HIGH"}>High</option>
|
||||
<option value={"MEDIUM"}>Medium</option>
|
||||
<option value={"LOW"}>Low</option>
|
||||
</Field>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="cropSizeFactor">Crop Size Factor</label>
|
||||
<Field
|
||||
name={"cropSizeFactor"}
|
||||
as="select"
|
||||
id="cropSizeFactor"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"FULL"}>Full</option>
|
||||
<option value={"3/4"}>3/4</option>
|
||||
<option value={"1/2"}>1/2</option>
|
||||
<option value={"1/4"}>1/4</option>
|
||||
</Field>
|
||||
</div>
|
||||
{values.format.toLowerCase() === "utmc" && (
|
||||
<>
|
||||
<div className="border-b border-gray-500 my-3">
|
||||
<h2 className="font-bold">{values.format} Constants</h2>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="SCID">Source ID / Camera ID</label>
|
||||
<Field
|
||||
name={"SCID"}
|
||||
type="text"
|
||||
id="SCID"
|
||||
placeholder="DEF345"
|
||||
className={`p-1.5 border ${
|
||||
errors.readTimeoutSeconds && touched.readTimeoutSeconds ? "border-red-500" : "border-gray-400 "
|
||||
} rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="timestampSource">Timestamp Source</label>
|
||||
<Field
|
||||
name={"timestampSource"}
|
||||
as="select"
|
||||
id="timestampSource"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"UTC"}>UTC</option>
|
||||
<option value={"local"}>Local</option>
|
||||
</Field>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="GPSFormat">GPS Format</label>
|
||||
<Field
|
||||
name={"GPSFormat"}
|
||||
as="select"
|
||||
id="GPSFormat"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"Minutes"}>Minutes</option>
|
||||
<option value={"Decimal Degrees"}>Decimal degrees</option>
|
||||
</Field>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{values.format?.toLowerCase() === "bof2" && (
|
||||
<>
|
||||
<div className="space-y-3">
|
||||
<div className="border-b border-gray-500 my-3">
|
||||
<h2 className="font-bold">{values.format} Constants</h2>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="FFID">Feed ID / Force ID</label>
|
||||
<Field
|
||||
name={"FFID"}
|
||||
type="text"
|
||||
id="FFID"
|
||||
placeholder="ABC123"
|
||||
className={`p-1.5 border ${
|
||||
errors.readTimeoutSeconds && touched.readTimeoutSeconds ? "border-red-500" : "border-gray-400 "
|
||||
} rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="SCID">Source ID / Camera ID</label>
|
||||
<Field
|
||||
name={"SCID"}
|
||||
type="text"
|
||||
id="SCID"
|
||||
placeholder="DEF345"
|
||||
className={`p-1.5 border ${
|
||||
errors.readTimeoutSeconds && touched.readTimeoutSeconds ? "border-red-500" : "border-gray-400 "
|
||||
} rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="timestampSource">Timestamp Source</label>
|
||||
<Field
|
||||
name={"timestampSource"}
|
||||
as="select"
|
||||
id="timestampSource"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"UTC"}>UTC</option>
|
||||
<option value={"local"}>Local</option>
|
||||
</Field>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="GPSFormat">GPS Format</label>
|
||||
<Field
|
||||
name={"GPSFormat"}
|
||||
as="select"
|
||||
id="GPSFormat"
|
||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||
>
|
||||
<option value={"Minutes"}>Minutes</option>
|
||||
<option value={"Decimal Degrees"}>Decimal degrees</option>
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<div className="border-b border-gray-500 my-3">
|
||||
<h2 className="font-bold">{values.format} Lane ID Config</h2>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="LID1">Lane ID 1 (Camera A)</label>
|
||||
<Field
|
||||
name={"LID1"}
|
||||
type="text"
|
||||
id="LID1"
|
||||
placeholder="10"
|
||||
className={`p-1.5 border ${
|
||||
errors.readTimeoutSeconds && touched.readTimeoutSeconds ? "border-red-500" : "border-gray-400 "
|
||||
} rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-row justify-between">
|
||||
<label htmlFor="LID2">Lane ID 2 (Camera B)</label>
|
||||
<Field
|
||||
name={"LID2"}
|
||||
type="text"
|
||||
id="LID2"
|
||||
placeholder="20"
|
||||
className={`p-1.5 border ${
|
||||
errors.readTimeoutSeconds && touched.readTimeoutSeconds ? "border-red-500" : "border-gray-400 "
|
||||
} rounded-lg w-full md:w-60`}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChannelFields;
|
||||
44
src/features/output/components/Output.tsx
Normal file
44
src/features/output/components/Output.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Formik, Form } from "formik";
|
||||
import BearerTypeCard from "./BearerTypeCard";
|
||||
import ChannelCard from "./ChannelCard";
|
||||
import type { FormTypes } from "../../../types/types";
|
||||
|
||||
const Output = () => {
|
||||
const handleSubmit = (values: FormTypes) => {
|
||||
console.log(values);
|
||||
};
|
||||
|
||||
const inititalValues: FormTypes = {
|
||||
format: "JSON",
|
||||
enabled: true,
|
||||
backOfficeURL: "",
|
||||
username: "",
|
||||
password: "",
|
||||
connectTimeoutSeconds: Number(5),
|
||||
readTimeoutSeconds: Number(15),
|
||||
overviewQuality: "HIGH",
|
||||
cropSizeFactor: "3/4",
|
||||
|
||||
// Bof2 -optional constants
|
||||
FFID: "",
|
||||
SCID: "",
|
||||
timestampSource: "UTC",
|
||||
GPSFormat: "Minutes",
|
||||
|
||||
//BOF2 - optional Lane IDs
|
||||
laneId: "",
|
||||
LID1: "",
|
||||
LID2: "",
|
||||
};
|
||||
|
||||
return (
|
||||
<Formik initialValues={inititalValues} onSubmit={handleSubmit}>
|
||||
<Form className="grid grid-cols-1 md:grid-cols-2">
|
||||
<BearerTypeCard />
|
||||
<ChannelCard />
|
||||
</Form>
|
||||
</Formik>
|
||||
);
|
||||
};
|
||||
|
||||
export default Output;
|
||||
@@ -9,7 +9,6 @@ export const Route = createFileRoute("/baywatch")({
|
||||
function RouteComponent() {
|
||||
return (
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold">Cameras</h2>
|
||||
<CameraGrid />
|
||||
<Toaster />
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,6 @@ export const Route = createFileRoute("/")({
|
||||
function HomePage() {
|
||||
return (
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold"> Dashboard</h2>
|
||||
<DashboardGrid />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import Output from "../features/output/components/Output";
|
||||
|
||||
export const Route = createFileRoute('/output')({
|
||||
export const Route = createFileRoute("/output")({
|
||||
component: RouteComponent,
|
||||
})
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return <div>Hello "/output"!</div>
|
||||
return (
|
||||
<div>
|
||||
<Output />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,49 @@ export type InfoBarData = {
|
||||
"thread-count": string;
|
||||
};
|
||||
|
||||
export type StatusIndicator = "neutral-quaternary" | "dark" | "info" | "success" | "warning" | "danger";
|
||||
export type Region = {
|
||||
name: string;
|
||||
brushColour: string;
|
||||
};
|
||||
|
||||
export type SystemHealthStatus = {
|
||||
id: string;
|
||||
tags: string[];
|
||||
};
|
||||
|
||||
export type BearerTypeFields = {
|
||||
format: string;
|
||||
enabled: boolean;
|
||||
backOfficeURL: string;
|
||||
username: string;
|
||||
password: string;
|
||||
connectTimeoutSeconds: number;
|
||||
readTimeoutSeconds: number;
|
||||
overviewQuality: string;
|
||||
cropSizeFactor: string;
|
||||
};
|
||||
|
||||
export type OptionalConstants = {
|
||||
FFID?: string;
|
||||
SCID?: string;
|
||||
timestampSource?: string;
|
||||
GPSFormat?: string;
|
||||
};
|
||||
|
||||
export type OptionalLaneIDs = {
|
||||
laneId?: string;
|
||||
LID1?: string;
|
||||
LID2?: string;
|
||||
LID3?: string;
|
||||
};
|
||||
|
||||
export type InitialValuesFormErrors = {
|
||||
backOfficeURL?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
connectTimeoutSeconds?: string;
|
||||
readTimeoutSeconds?: string;
|
||||
};
|
||||
|
||||
export type FormTypes = BearerTypeFields & OptionalConstants & OptionalLaneIDs;
|
||||
|
||||
24
src/ui/Badge.tsx
Normal file
24
src/ui/Badge.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { Icon, IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { capitalize } from "../utils/utils";
|
||||
|
||||
type BadgeProps = {
|
||||
icon?: Icon | IconDefinition;
|
||||
text: string;
|
||||
};
|
||||
|
||||
const Badge = ({ icon, text }: BadgeProps) => {
|
||||
const lowerCaseWord = text.toLowerCase();
|
||||
return (
|
||||
<span
|
||||
className={`text-sm font-medium inline-flex items-center px-2 py-0.5 rounded-md me-2
|
||||
border-2 space-x-2
|
||||
${text.toLowerCase() === "running" ? "bg-green-800 text-green-300 border-green-900" : "bg-red-800 text-red-300 border-red-900"} `}
|
||||
>
|
||||
{icon && <FontAwesomeIcon icon={icon} />}
|
||||
<span>{capitalize(lowerCaseWord)}</span>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default Badge;
|
||||
@@ -1,18 +1,27 @@
|
||||
import clsx from "clsx";
|
||||
import StatusIndicators from "./StatusIndicators";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import type { IconProp } from "@fortawesome/fontawesome-svg-core";
|
||||
|
||||
type CameraOverviewHeaderProps = {
|
||||
title?: string;
|
||||
status?: string;
|
||||
refetch?: () => void;
|
||||
icon?: IconProp;
|
||||
};
|
||||
const CardHeader = ({ title }: CameraOverviewHeaderProps) => {
|
||||
const CardHeader = ({ title, status, icon, refetch }: CameraOverviewHeaderProps) => {
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
"w-full border-b border-gray-600 flex flex-row items-center space-x-2 mb-6 relative justify-between",
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center space-x-2">
|
||||
{/* {icon && <FontAwesomeIcon icon={icon} className="size-4" />} */}
|
||||
<h2 className="text-xl">{title}</h2>
|
||||
<div className="flex flex-row items-center w-full justify-between">
|
||||
<h2 className="flex flex-row text-xl items-center">
|
||||
{status && <StatusIndicators status={status} />}
|
||||
{title}
|
||||
</h2>
|
||||
{icon && <FontAwesomeIcon icon={icon} className="size-4" onClick={refetch} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
9
src/ui/StatusIndicators.tsx
Normal file
9
src/ui/StatusIndicators.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import clsx from "clsx";
|
||||
|
||||
type StatusIndicatorsProps = { status: string };
|
||||
|
||||
const StatusIndicators = ({ status }: StatusIndicatorsProps) => {
|
||||
return <span className={clsx(`flex w-3 h-3 me-2 rounded-full`, status)}></span>;
|
||||
};
|
||||
|
||||
export default StatusIndicators;
|
||||
3
src/utils/utils.ts
Normal file
3
src/utils/utils.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function capitalize(s?: string) {
|
||||
return s ? s.charAt(0).toUpperCase() + s.slice(1) : "";
|
||||
}
|
||||
54
yarn.lock
54
yarn.lock
@@ -994,6 +994,13 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e"
|
||||
integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==
|
||||
|
||||
"@types/hoist-non-react-statics@^3.3.1":
|
||||
version "3.3.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.7.tgz#306e3a3a73828522efa1341159da4846e7573a6c"
|
||||
integrity sha512-PQTyIulDkIDro8P+IHbKCsw7U2xxBYflVzW/FgWdCAePD9xGSidgA76/GeJ6lBKoblyhf9pBY763gbrN+1dI8g==
|
||||
dependencies:
|
||||
hoist-non-react-statics "^3.3.0"
|
||||
|
||||
"@types/json-schema@^7.0.15":
|
||||
version "7.0.15"
|
||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
|
||||
@@ -1351,6 +1358,11 @@ deep-is@^0.1.3:
|
||||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831"
|
||||
integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
|
||||
|
||||
deepmerge@^2.1.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170"
|
||||
integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==
|
||||
|
||||
detect-libc@^2.0.3:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.1.2.tgz#689c5dcdc1900ef5583a4cb9f6d7b473742074ad"
|
||||
@@ -1601,6 +1613,20 @@ flatted@^3.2.9:
|
||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.3.tgz#67c8fad95454a7c7abebf74bb78ee74a44023358"
|
||||
integrity sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==
|
||||
|
||||
formik@^2.4.9:
|
||||
version "2.4.9"
|
||||
resolved "https://registry.yarnpkg.com/formik/-/formik-2.4.9.tgz#7e5b81e9c9e215d0ce2ac8fed808cf7fba0cd204"
|
||||
integrity sha512-5nI94BMnlFDdQRBY4Sz39WkhxajZJ57Fzs8wVbtsQlm5ScKIR1QLYqv/ultBnobObtlUyxpxoLodpixrsf36Og==
|
||||
dependencies:
|
||||
"@types/hoist-non-react-statics" "^3.3.1"
|
||||
deepmerge "^2.1.1"
|
||||
hoist-non-react-statics "^3.3.0"
|
||||
lodash "^4.17.21"
|
||||
lodash-es "^4.17.21"
|
||||
react-fast-compare "^2.0.1"
|
||||
tiny-warning "^1.0.2"
|
||||
tslib "^2.0.0"
|
||||
|
||||
fraction.js@^5.3.4:
|
||||
version "5.3.4"
|
||||
resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-5.3.4.tgz#8c0fcc6a9908262df4ed197427bdeef563e0699a"
|
||||
@@ -1679,6 +1705,13 @@ hermes-parser@^0.25.1:
|
||||
dependencies:
|
||||
hermes-estree "0.25.1"
|
||||
|
||||
hoist-non-react-statics@^3.3.0:
|
||||
version "3.3.2"
|
||||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
|
||||
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
|
||||
dependencies:
|
||||
react-is "^16.7.0"
|
||||
|
||||
ignore@^5.2.0:
|
||||
version "5.3.2"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5"
|
||||
@@ -1886,11 +1919,21 @@ locate-path@^6.0.0:
|
||||
dependencies:
|
||||
p-locate "^5.0.0"
|
||||
|
||||
lodash-es@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
|
||||
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
|
||||
|
||||
lodash.merge@^4.6.2:
|
||||
version "4.6.2"
|
||||
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
|
||||
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
|
||||
|
||||
lodash@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
||||
loose-envify@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
|
||||
@@ -2087,7 +2130,12 @@ react-dom@^19.2.0:
|
||||
dependencies:
|
||||
scheduler "^0.27.0"
|
||||
|
||||
react-is@^16.13.1:
|
||||
react-fast-compare@^2.0.1:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9"
|
||||
integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==
|
||||
|
||||
react-is@^16.13.1, react-is@^16.7.0:
|
||||
version "16.13.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
||||
@@ -2287,7 +2335,7 @@ tiny-invariant@^1.3.3:
|
||||
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.3.tgz#46680b7a873a0d5d10005995eb90a70d74d60127"
|
||||
integrity sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==
|
||||
|
||||
tiny-warning@^1.0.3:
|
||||
tiny-warning@^1.0.2, tiny-warning@^1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
|
||||
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
|
||||
@@ -2312,7 +2360,7 @@ ts-api-utils@^2.1.0:
|
||||
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.1.0.tgz#595f7094e46eed364c13fd23e75f9513d29baf91"
|
||||
integrity sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==
|
||||
|
||||
tslib@^2.0.1, tslib@^2.4.0:
|
||||
tslib@^2.0.0, tslib@^2.0.1, tslib@^2.4.0:
|
||||
version "2.8.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
|
||||
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
|
||||
|
||||
Reference in New Issue
Block a user