Skip to content

Commit 419bfd1

Browse files
committed
Chore: Biome format --fix + manual amends
1 parent 3c356bb commit 419bfd1

113 files changed

Lines changed: 3230 additions & 3453 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

biome.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@
1616
"linter": {
1717
"enabled": true,
1818
"rules": {
19-
"recommended": true
19+
"recommended": true,
20+
"suspicious": {
21+
"noUnknownAtRules": {
22+
"level": "error",
23+
"options": {
24+
"ignore": ["tailwind"]
25+
}
26+
}
27+
}
28+
}
29+
},
30+
"css": {
31+
"parser": {
32+
"tailwindDirectives": true
2033
}
2134
},
2235
"javascript": {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{
2-
"makefile.configureOnOpen": false
3-
}
1+
{
2+
"makefile.configureOnOpen": false
3+
}

docker/dd-extension/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
"root": "ui"
1414
}
1515
}
16-
}
16+
}

docker/dd-extension/ui/src/App.tsx

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1-
import React from "react";
2-
import {
3-
Container,
4-
} from "react-bootstrap";
5-
6-
7-
import Tab from "react-bootstrap/Tab";
8-
import Tabs from "react-bootstrap/Tabs";
9-
10-
import Stream from "./components/Stream";
11-
import Snapshot from "./components/Snapshot";
12-
13-
14-
export function App() {
15-
16-
return (
17-
<Container>
18-
<h2 className="text-center">Plate Recognizer Installer</h2>
19-
<Tabs defaultActiveKey="stream" className="mb-3 justify-content-center">
20-
<Tab eventKey="stream" title="Stream">
21-
<Stream />
22-
</Tab>
23-
<Tab eventKey="snapshot" title="Snapshot">
24-
<Snapshot />
25-
</Tab>
26-
27-
</Tabs>
28-
</Container>
29-
);
30-
}
1+
import { Container } from "react-bootstrap";
2+
3+
import Tab from "react-bootstrap/Tab";
4+
import Tabs from "react-bootstrap/Tabs";
5+
6+
import Snapshot from "./components/Snapshot";
7+
import Stream from "./components/Stream";
8+
9+
export function App() {
10+
return (
11+
<Container>
12+
<h2 className="text-center">Plate Recognizer Installer</h2>
13+
<Tabs defaultActiveKey="stream" className="mb-3 justify-content-center">
14+
<Tab eventKey="stream" title="Stream">
15+
<Stream />
16+
</Tab>
17+
<Tab eventKey="snapshot" title="Snapshot">
18+
<Snapshot />
19+
</Tab>
20+
</Tabs>
21+
</Container>
22+
);
23+
}
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import Spinner from "react-bootstrap/Spinner";
2-
import React from 'react';
3-
4-
interface LoaderProps {
5-
isLoading: boolean;
6-
}
7-
8-
export default function Loader({ isLoading }: LoaderProps) {
9-
if (!isLoading) return null;
10-
return (
11-
<Spinner animation="border" role="status" size='sm' className="me-1">
12-
<span className="visually-hidden">Loading...</span>
13-
</Spinner>
14-
);
15-
}
1+
import Spinner from "react-bootstrap/Spinner";
2+
3+
interface LoaderProps {
4+
isLoading: boolean;
5+
}
6+
7+
export default function Loader({ isLoading }: LoaderProps) {
8+
if (!isLoading) return null;
9+
return (
10+
<Spinner animation="border" role="status" size="sm" className="me-1">
11+
<span className="visually-hidden">Loading...</span>
12+
</Spinner>
13+
);
14+
}
Lines changed: 109 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,109 @@
1-
import React, { useState } from "react";
2-
import { useDockerDesktopClient } from "../hooks/useDockerDesktopClient";
3-
import Form from "react-bootstrap/Form";
4-
import {
5-
Row,
6-
} from "react-bootstrap";
7-
import Loader from "./Loader";
8-
9-
interface ShowCommandProps {
10-
validated: boolean;
11-
command: string;
12-
curlPort: string;
13-
}
14-
15-
export default function ShowCommand({
16-
validated,
17-
command,
18-
curlPort,
19-
}: ShowCommandProps) {
20-
const [isRunningCommand, setRunningCommand] = useState(false);
21-
22-
if (!validated) {
23-
return null;
24-
}
25-
const ddClient = useDockerDesktopClient();
26-
27-
function copyToClipboard() {
28-
navigator.clipboard
29-
.writeText(command)
30-
.then(() => {
31-
ddClient.desktopUI.toast.success("Text copied to clipboard!");
32-
})
33-
.catch((err) => {
34-
ddClient.desktopUI.toast.error(`Failed to copy text: ${err}`);
35-
});
36-
}
37-
38-
function runCommand(){
39-
setRunningCommand(true);
40-
// Generate list of run options
41-
console.debug(command);
42-
const cmd:Array<string> = command.match(/[^ ]+/g)?.slice(2) || [];
43-
// Run in the background
44-
if (!cmd.includes('-d')){
45-
cmd.unshift('-d')
46-
}
47-
48-
ddClient.docker.cli.exec("run", cmd).then(async (result) => {
49-
console.debug(result);
50-
setRunningCommand(false);
51-
ddClient.desktopUI.toast.success('Command Ran Successfully.');
52-
await ddClient.desktopUI.navigate.viewContainer(result.stdout.trim())
53-
}).catch(e => {
54-
setRunningCommand(false);
55-
console.error(e);
56-
ddClient.desktopUI.toast.error(`Run Command Failed: ${e.stderr.trim()}`);
57-
})
58-
}
59-
60-
const curlCommand = curlPort ? (
61-
<div>
62-
<p className="card-title mt-3 mb-0" style={{ display: "inline-block" }}>
63-
To use the SDK endpoint call:{" "}
64-
</p>
65-
<code>
66-
{" "}
67-
curl -F "upload=@my_file.jpg" http://localhost:{curlPort}
68-
/v1/plate-reader/
69-
</code>
70-
</div>
71-
) : null;
72-
73-
return (
74-
<Form.Group as={Row} className="mb-3">
75-
<div style={{ display: "block" }}>
76-
<div className="mt-3 card" style={{ display: "block" }}>
77-
<div className="card-body">
78-
<p className="card-title">
79-
You can now start {curlPort ? 'Snapshot' : 'Stream'}. Open a terminal and type the command
80-
below. You can save this command for future use.
81-
</p>
82-
<code className="card-text d-block">{command}</code>
83-
<div className="mt-3">
84-
<button
85-
className="btn btn-sm btn-success mx-2"
86-
style={{ borderRadius: 15 }}
87-
type="button"
88-
onClick={runCommand}
89-
>
90-
<Loader isLoading={isRunningCommand} /> Run
91-
</button>
92-
<button
93-
className="btn btn-sm btn-warning mx-2"
94-
style={{ borderRadius: 15 }}
95-
type="button"
96-
onClick={copyToClipboard}
97-
>
98-
copy to clipboard
99-
</button>
100-
<span className="ms-2" style={{ fontSize: 13, color: "green" }} />
101-
</div>
102-
{curlCommand}
103-
</div>
104-
</div>
105-
</div>
106-
</Form.Group>
107-
);
108-
}
1+
import { useState } from "react";
2+
import { Row } from "react-bootstrap";
3+
import Form from "react-bootstrap/Form";
4+
import { useDockerDesktopClient } from "../hooks/useDockerDesktopClient";
5+
import Loader from "./Loader";
6+
7+
interface ShowCommandProps {
8+
validated: boolean;
9+
command: string;
10+
curlPort: string;
11+
}
12+
13+
export default function ShowCommand({
14+
validated,
15+
command,
16+
curlPort,
17+
}: ShowCommandProps) {
18+
const [isRunningCommand, setRunningCommand] = useState(false);
19+
20+
if (!validated) {
21+
return null;
22+
}
23+
const ddClient = useDockerDesktopClient();
24+
25+
function copyToClipboard() {
26+
navigator.clipboard
27+
.writeText(command)
28+
.then(() => {
29+
ddClient.desktopUI.toast.success("Text copied to clipboard!");
30+
})
31+
.catch((err) => {
32+
ddClient.desktopUI.toast.error(`Failed to copy text: ${err}`);
33+
});
34+
}
35+
36+
function runCommand() {
37+
setRunningCommand(true);
38+
// Generate list of run options
39+
console.debug(command);
40+
const cmd: Array<string> = command.match(/[^ ]+/g)?.slice(2) || [];
41+
// Run in the background
42+
if (!cmd.includes("-d")) {
43+
cmd.unshift("-d");
44+
}
45+
46+
ddClient.docker.cli
47+
.exec("run", cmd)
48+
.then(async (result) => {
49+
console.debug(result);
50+
setRunningCommand(false);
51+
ddClient.desktopUI.toast.success("Command Ran Successfully.");
52+
await ddClient.desktopUI.navigate.viewContainer(result.stdout.trim());
53+
})
54+
.catch((e) => {
55+
setRunningCommand(false);
56+
console.error(e);
57+
ddClient.desktopUI.toast.error(`Run Command Failed: ${e.stderr.trim()}`);
58+
});
59+
}
60+
61+
const curlCommand = curlPort ? (
62+
<div>
63+
<p className="card-title mt-3 mb-0" style={{ display: "inline-block" }}>
64+
To use the SDK endpoint call:{" "}
65+
</p>
66+
<code>
67+
{" "}
68+
curl -F "upload=@my_file.jpg" http://localhost:{curlPort}
69+
/v1/plate-reader/
70+
</code>
71+
</div>
72+
) : null;
73+
74+
return (
75+
<Form.Group as={Row} className="mb-3">
76+
<div style={{ display: "block" }}>
77+
<div className="mt-3 card" style={{ display: "block" }}>
78+
<div className="card-body">
79+
<p className="card-title">
80+
You can now start {curlPort ? "Snapshot" : "Stream"}. Open a terminal and
81+
type the command below. You can save this command for future use.
82+
</p>
83+
<code className="card-text d-block">{command}</code>
84+
<div className="mt-3">
85+
<button
86+
className="btn btn-sm btn-success mx-2"
87+
style={{ borderRadius: 15 }}
88+
type="button"
89+
onClick={runCommand}
90+
>
91+
<Loader isLoading={isRunningCommand} /> Run
92+
</button>
93+
<button
94+
className="btn btn-sm btn-warning mx-2"
95+
style={{ borderRadius: 15 }}
96+
type="button"
97+
onClick={copyToClipboard}
98+
>
99+
copy to clipboard
100+
</button>
101+
<span className="ms-2" style={{ fontSize: 13, color: "green" }} />
102+
</div>
103+
{curlCommand}
104+
</div>
105+
</div>
106+
</div>
107+
</Form.Group>
108+
);
109+
}

0 commit comments

Comments
 (0)