-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,944 additions
and
655 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
DATABASE_URL="file:./evolver.db" | ||
SESSION_SECRET="evolver4ever" | ||
DEFAULT_DEVICE_PORT="8080" | ||
SESSION_SECRET="evolver4life" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { | ||
BeakerIcon, | ||
ChartBarSquareIcon, | ||
EyeIcon, | ||
FireIcon, | ||
PencilSquareIcon, | ||
WrenchIcon, | ||
} from "@heroicons/react/24/outline"; | ||
import { Link } from "@remix-run/react"; | ||
import { EvolverConfigWithoutDefaults } from "client"; | ||
|
||
const iconMapper = (name: string) => { | ||
switch (name) { | ||
case "ODSensor": | ||
return <EyeIcon className="h-10 w-10" />; | ||
case "Temperature": | ||
return <FireIcon className="h-10 w-10" />; | ||
default: | ||
return <WrenchIcon className="h-10 w-10" />; | ||
} | ||
}; | ||
|
||
export default function EvolverTree({ | ||
config, | ||
}: { | ||
config: EvolverConfigWithoutDefaults; | ||
}) { | ||
const evolverHardware = config.hardware; | ||
|
||
const hardware = Object.keys(evolverHardware).map((key, ix) => { | ||
const { classinfo, config } = evolverHardware[key]; | ||
const { vials, name } = config; | ||
Check failure on line 32 in app/components/EvolverTree.tsx GitHub Actions / test
|
||
|
||
return ( | ||
<li key={key + ix}> | ||
<div className="flex gap-8"> | ||
<div className="text-xl">{key}</div> | ||
<div className="join flex gap-4"> | ||
<Link | ||
to={`./hardware/${key}?classinfo=${classinfo}`} | ||
className="join-item link h-8 w-8 tooltip" | ||
data-tip="view logs" | ||
> | ||
<ChartBarSquareIcon /> | ||
</Link> | ||
|
||
<Link | ||
to={`./hardware/${key}?classinfo=${classinfo}`} | ||
className="join-item link h-8 w-8 tooltip" | ||
data-tip="edit hardware config" | ||
> | ||
<PencilSquareIcon /> | ||
</Link> | ||
</div> | ||
</div> | ||
</li> | ||
); | ||
}); | ||
|
||
return ( | ||
<ul className="menu menu-lg bg-base-200 rounded-lg w-full"> | ||
<li> | ||
<details open> | ||
<summary> | ||
<h1 className="text-xl">Hardware</h1> | ||
</summary> | ||
<ul>{hardware}</ul> | ||
</details> | ||
</li> | ||
</ul> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { Link, useParams, useSearchParams } from "@remix-run/react"; | ||
import { EvolverConfigWithoutDefaults } from "client"; | ||
import clsx from "clsx"; | ||
|
||
export function HardwareTable({ | ||
evolverConfig, | ||
}: { | ||
evolverConfig: EvolverConfigWithoutDefaults; | ||
}) { | ||
const { hardware_name, ip_addr } = useParams(); | ||
const [queryParams] = useSearchParams(); | ||
let currentVials: string[] = []; | ||
let allVials = false; | ||
if (queryParams.has("vials")) { | ||
currentVials = queryParams.get("vials")?.split(","); | ||
} else { | ||
allVials = true; | ||
} | ||
const evolverHardware = evolverConfig.hardware; | ||
|
||
const TableRows = Object.keys(evolverHardware).map((key) => { | ||
const { | ||
config: { vials }, | ||
} = evolverHardware[key]; | ||
|
||
const vialsWithLinks = vials.map((vial) => { | ||
const linkTo = `/devices/${ip_addr}/hardware/${key}/history?vials=${vial}`; | ||
const activeVial = | ||
currentVials.includes(vial.toString()) && hardware_name === key; | ||
const vialButtons = ( | ||
<Link | ||
key={vial} | ||
className={clsx( | ||
"btn", | ||
"btn-xs", | ||
"btn-outline", | ||
activeVial && "btn-active", | ||
)} | ||
to={linkTo} | ||
> | ||
{vial} | ||
</Link> | ||
); | ||
|
||
return vialButtons; | ||
}); | ||
const allButton = ( | ||
<Link | ||
className={clsx( | ||
"btn", | ||
"btn-xs", | ||
"btn-outline", | ||
allVials && key === hardware_name && "btn-active", | ||
)} | ||
key={"all"} | ||
to={`/devices/${ip_addr}/hardware/${key}/history`} | ||
> | ||
{" "} | ||
all | ||
</Link> | ||
); | ||
|
||
return ( | ||
<tr key={key} className={clsx(hardware_name === key && "bg-base-300")}> | ||
<td>{key}</td> | ||
<td className="flex gap-2"> | ||
{vialsWithLinks} | ||
{allButton} | ||
</td> | ||
</tr> | ||
); | ||
}); | ||
|
||
return ( | ||
<table className="table"> | ||
<thead> | ||
<tr> | ||
<th>name</th> | ||
<th>vials</th> | ||
</tr> | ||
</thead> | ||
<tbody>{TableRows}</tbody> | ||
</table> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.