formatting fixes

This commit is contained in:
Blake Blackshear 2023-10-06 06:51:44 -05:00
parent 86576889b1
commit acece272ab
5 changed files with 128 additions and 116 deletions

View File

@ -61,8 +61,7 @@ export default function MultiSelect({ className, title, options, selection, onTo
className="max-h-[35px] mx-2" className="max-h-[35px] mx-2"
onClick={() => onSelectSingle(item)} onClick={() => onSelectSingle(item)}
> >
{ (title === "Labels" && config.audio.listen.includes(item)) ? ( <SpeakerIcon /> ) : ( <CameraIcon /> ) } {title === 'Labels' && config.audio.listen.includes(item) ? <SpeakerIcon /> : <CameraIcon />}
</Button> </Button>
</div> </div>
</div> </div>

View File

@ -146,7 +146,6 @@ export default function CameraMasks({ camera }) {
} }
}, [camera, motionMaskPoints]); }, [camera, motionMaskPoints]);
// Zone methods // Zone methods
const handleEditZone = useCallback( const handleEditZone = useCallback(
(key) => { (key) => {
@ -177,7 +176,9 @@ export default function CameraMasks({ camera }) {
${Object.keys(zonePoints) ${Object.keys(zonePoints)
.map( .map(
(zoneName) => ` ${zoneName}: (zoneName) => ` ${zoneName}:
coordinates: ${polylinePointsToPolyline(zonePoints[zoneName])}`).join('\n')}`; coordinates: ${polylinePointsToPolyline(zonePoints[zoneName])}`
)
.join('\n')}`;
if (window.navigator.clipboard && window.navigator.clipboard.writeText) { if (window.navigator.clipboard && window.navigator.clipboard.writeText) {
// Use Clipboard API if available // Use Clipboard API if available
@ -207,7 +208,10 @@ ${Object.keys(zonePoints)
const handleSaveZones = useCallback(async () => { const handleSaveZones = useCallback(async () => {
try { try {
const queryParameters = Object.keys(zonePoints) const queryParameters = Object.keys(zonePoints)
.map((zoneName) => `cameras.${camera}.zones.${zoneName}.coordinates=${polylinePointsToPolyline(zonePoints[zoneName])}`) .map(
(zoneName) =>
`cameras.${camera}.zones.${zoneName}.coordinates=${polylinePointsToPolyline(zonePoints[zoneName])}`
)
.join('&'); .join('&');
const endpoint = `config/set?${queryParameters}`; const endpoint = `config/set?${queryParameters}`;
const response = await axios.put(endpoint); const response = await axios.put(endpoint);
@ -266,7 +270,12 @@ ${Object.keys(objectMaskPoints)
try { try {
const queryParameters = Object.keys(objectMaskPoints) const queryParameters = Object.keys(objectMaskPoints)
.filter((objectName) => objectMaskPoints[objectName].length > 0) .filter((objectName) => objectMaskPoints[objectName].length > 0)
.map((objectName, index) => `cameras.${camera}.objects.filters.${objectName}.mask.${index}=${polylinePointsToPolyline(objectMaskPoints[objectName])}`) .map(
(objectName, index) =>
`cameras.${camera}.objects.filters.${objectName}.mask.${index}=${polylinePointsToPolyline(
objectMaskPoints[objectName]
)}`
)
.join('&'); .join('&');
const endpoint = `config/set?${queryParameters}`; const endpoint = `config/set?${queryParameters}`;
const response = await axios.put(endpoint); const response = await axios.put(endpoint);
@ -324,8 +333,8 @@ ${Object.keys(objectMaskPoints)
<Card <Card
content={ content={
<p> <p>
When done, copy each mask configuration into your <code className="font-mono">config.yml</code> file When done, copy each mask configuration into your <code className="font-mono">config.yml</code> file restart
restart your Frigate instance to save your changes. your Frigate instance to save your changes.
</p> </p>
} }
header="Warning" header="Warning"
@ -569,8 +578,6 @@ function MaskValues({
[onAdd] [onAdd]
); );
return ( return (
<div className="overflow-hidden" onMouseOver={handleMousein} onMouseOut={handleMouseout}> <div className="overflow-hidden" onMouseOver={handleMousein} onMouseOut={handleMouseout}>
<div className="flex space-x-4"> <div className="flex space-x-4">

View File

@ -61,9 +61,9 @@ export default function Config() {
let yamlModel; let yamlModel;
if (editor.getModels().length > 0) { if (editor.getModels().length > 0) {
yamlModel = editor.getModel(modelUri) yamlModel = editor.getModel(modelUri);
} else { } else {
yamlModel = editor.createModel(config, 'yaml', modelUri) yamlModel = editor.createModel(config, 'yaml', modelUri);
} }
setDiagnosticsOptions({ setDiagnosticsOptions({
@ -100,10 +100,10 @@ export default function Config() {
<Button className="mx-2" onClick={(e) => handleCopyConfig(e)}> <Button className="mx-2" onClick={(e) => handleCopyConfig(e)}>
Copy Config Copy Config
</Button> </Button>
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, "restart")}> <Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, 'restart')}>
Save & Restart Save & Restart
</Button> </Button>
<Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, "saveonly")}> <Button className="mx-2" onClick={(e) => onHandleSaveConfig(e, 'saveonly')}>
Save Only Save Only
</Button> </Button>
</div> </div>

View File

@ -334,8 +334,13 @@ export default function System() {
<ActivityIndicator /> <ActivityIndicator />
) : ( ) : (
<div data-testid="cameras" className="grid grid-cols-1 3xl:grid-cols-3 md:grid-cols-2 gap-4"> <div data-testid="cameras" className="grid grid-cols-1 3xl:grid-cols-3 md:grid-cols-2 gap-4">
{cameraNames.map((camera) => ( config.cameras[camera]["enabled"] && ( {cameraNames.map(
<div key={camera} className="dark:bg-gray-800 shadow-md hover:shadow-lg rounded-lg transition-shadow"> (camera) =>
config.cameras[camera]['enabled'] && (
<div
key={camera}
className="dark:bg-gray-800 shadow-md hover:shadow-lg rounded-lg transition-shadow"
>
<div className="capitalize text-lg flex justify-between p-4"> <div className="capitalize text-lg flex justify-between p-4">
<Link href={`/cameras/${camera}`}>{camera.replaceAll('_', ' ')}</Link> <Link href={`/cameras/${camera}`}>{camera.replaceAll('_', ' ')}</Link>
<Button onClick={(e) => onHandleFfprobe(camera, e)}>ffprobe</Button> <Button onClick={(e) => onHandleFfprobe(camera, e)}>ffprobe</Button>
@ -406,8 +411,9 @@ export default function System() {
</Tbody> </Tbody>
</Table> </Table>
</div> </div>
</div> ) </div>
))} )
)}
</div> </div>
)} )}