Add Dockerfile for coordinator service and progress controller
Add progress tracking functionality to frontend and backend - Add progress controller endpoint to handle progress updates - Implement socket.io progress updates in UploadPage - Update import path for CircularProgressWithLabel componentpull/48/head
parent
1b06867d88
commit
d412d5741b
|
|
@ -0,0 +1,21 @@
|
||||||
|
# 1. Python-Image verwenden
|
||||||
|
FROM python:3.11-alpine
|
||||||
|
|
||||||
|
# 2. Arbeitsverzeichnis im Container setzen
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# 3. production-style server mit gunicorn
|
||||||
|
RUN pip install gunicorn eventlet
|
||||||
|
|
||||||
|
# 4. requirements.txt kopieren und Pakete installieren
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
# 5. Quellcode kopieren (z.B. app.py)
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "--bind", "0.0.0.0:5000", "app:app"]
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
from controller.spacy_contoller import spacy_controller
|
from controller.spacy_contoller import spacy_controller
|
||||||
from controller.kpi_setting_controller import kpi_setting_controller
|
from controller.kpi_setting_controller import kpi_setting_controller
|
||||||
from controller.pitch_book_controller import pitch_book_controller
|
from controller.pitch_book_controller import pitch_book_controller
|
||||||
|
from controller.progress_controller import progress_controller
|
||||||
|
|
||||||
|
|
||||||
def register_routes(app):
|
def register_routes(app):
|
||||||
app.register_blueprint(kpi_setting_controller)
|
app.register_blueprint(kpi_setting_controller)
|
||||||
app.register_blueprint(pitch_book_controller)
|
app.register_blueprint(pitch_book_controller)
|
||||||
app.register_blueprint(spacy_controller)
|
app.register_blueprint(spacy_controller)
|
||||||
|
app.register_blueprint(progress_controller)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
from flask import Blueprint, request, jsonify
|
||||||
|
|
||||||
|
from controller.socketIO import socketio
|
||||||
|
progress_controller = Blueprint("progress", __name__, url_prefix="/api/progress")
|
||||||
|
|
||||||
|
|
||||||
|
@progress_controller.route("/", methods=["POST"])
|
||||||
|
def progress():
|
||||||
|
data = request.get_json()
|
||||||
|
|
||||||
|
if 'id' not in data or 'progress' not in data:
|
||||||
|
return jsonify({"error": "Missing required fields. [id, progress]"}), 400
|
||||||
|
|
||||||
|
if not isinstance(data['progress'], (int, float)) or data['progress'] < 0 or data['progress'] >= 100:
|
||||||
|
return jsonify({"error": "Invalid progress value"}), 400
|
||||||
|
|
||||||
|
socketio.emit("progress", {"id": data["id"], "progress": data["progress"]})
|
||||||
|
# Process the data and return a response
|
||||||
|
return jsonify({"message": "Progress updated"})
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"indentStyle": "space"
|
"indentStyle": "tab"
|
||||||
},
|
},
|
||||||
"organizeImports": {
|
"organizeImports": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -4,7 +4,7 @@ import { useNavigate } from "@tanstack/react-router";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import FileUpload from "react-material-file-upload";
|
import FileUpload from "react-material-file-upload";
|
||||||
import { socket } from "../socket";
|
import { socket } from "../socket";
|
||||||
import { CircularProgressWithLabel } from "./circularProgressWithLabel";
|
import { CircularProgressWithLabel } from "./CircularProgressWithLabel";
|
||||||
|
|
||||||
const PROGRESS = false;
|
const PROGRESS = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import { Box, IconButton } from "@mui/material";
|
||||||
interface PDFViewerProps {
|
interface PDFViewerProps {
|
||||||
pitchBookId: string;
|
pitchBookId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PDFViewer({ pitchBookId }: PDFViewerProps) {
|
export default function PDFViewer({ pitchBookId }: PDFViewerProps) {
|
||||||
const [numPages, setNumPages] = useState<number | null>(null);
|
const [numPages, setNumPages] = useState<number | null>(null);
|
||||||
const [pageNumber, setPageNumber] = useState(1);
|
const [pageNumber, setPageNumber] = useState(1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue