Skip to content

Commit

Permalink
first changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyskawa-Aonyx committed Nov 18, 2024
1 parent 0102b1e commit c56e8cc
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 11 deletions.
52 changes: 52 additions & 0 deletions New_ESP_Start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

echo "Opening Docker..."
open -a Docker

echo "Waiting for Docker to start..."
while ! docker info > /dev/null 2>&1; do
sleep 5
done
echo "Docker started!"

echo "Running 'docker compose up' in the current directory..."
docker compose up -d

# Wait for all containers to be up and running
echo "Waiting for Docker Compose to be fully up..."
while [ "$(docker compose ps | grep 'Up' | wc -l)" -eq 0 ]; do
sleep 2
done
echo "Docker Compose is up and running!"

echo "Opening http://localhost:3000/ in your browser..."
open http://localhost:3000/

echo "App is running at http://localhost:3000."
echo "To stop the app, close this window or press Ctrl+C."

trap cleanup EXIT

cleanup() {
echo "Stopping Docker containers..."
docker compose down

echo "Waiting for all containers to stop..."
while [ $(docker ps -q | wc -l) -ne 0 ]; do
echo "Still waiting for containers to stop..."
sleep 2
done
echo "All containers have been stopped and removed."

echo "Removing Docker containers and cleaning up volumes..."
docker system prune -f --volumes

echo "Killing all Docker processes..."
pkill -f docker
echo "Docker processes have been terminated."

echo "App has been closed, and Docker containers have been removed."
}

read -p "Press Enter or Ctrl+C to terminate the program..."

34 changes: 23 additions & 11 deletions client-app/src/components/DraftOrcaDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ const DraftOrcaDashboard = () => {
};

const handleSpecifyLineChange = (value) => {
setSpecifyLines([{ value, showInput: value === "FIRST" || value === "LAST" }]);
setSpecifyLines([{ value, showInput: value === "FIRST" || value === "LAST", lineNumber: "" }]);
};


const renderSpecifyLine = () => {
const line = specifyLines[0] || { value: "", showInput: false };
Expand All @@ -51,15 +52,15 @@ const DraftOrcaDashboard = () => {
</select>
{line.showInput && (
<input
type="text"
className="form-control"
placeholder="Enter line number"
value={line.lineNumber || ""}
onChange={(e) => {
const updatedLines = [{ ...line, lineNumber: e.target.value }];
setSpecifyLines(updatedLines);
}}
/>
type="text"
className="form-control"
placeholder="Enter line number"
value={line.lineNumber || ""}
onChange={(e) => {
const updatedLines = [{ ...line, lineNumber: e.target.value }];
setSpecifyLines(updatedLines);
}}
/>
)}
</div>
);
Expand Down Expand Up @@ -101,8 +102,19 @@ const DraftOrcaDashboard = () => {
file_path: filePath.toString(),
search_terms: searchTerms,
sections: sections,
specify_lines: specifyLines.join(","),
specify_lines: specifyLines
.map((line) => {
if (line.value === "WHOLE") {
return "WHOLE";
}
if (line.value === "FIRST" || line.value === "LAST") {
return `${line.value} ${line.lineNumber || ""}`.trim();
}
return "";
})
.join(", "),
};


axios
.post("http://localhost:5001/find-sections", data, {
Expand Down

0 comments on commit c56e8cc

Please sign in to comment.