[RTOP-40] compilation logs and status were merged to one funtion

This commit is contained in:
lucasbutzke
2025-07-28 21:22:04 -04:00
parent 8c63b0d368
commit 3492456cf4
2 changed files with 12 additions and 6 deletions
+4
View File
@@ -142,6 +142,10 @@ def list_users():
# For now, we will just check if the user is an admin
# if not is_admin():
# return jsonify({"msg": "Admin privileges required"}), 403
# TODO just returns if there is already users in the database if
# not logged in as admin
# if verify_jwt_in_request(optional=True):
try:
users = User.query.all()
except Exception as e:
+8 -6
View File
@@ -59,17 +59,18 @@ def restapi_callback_get(argument: str, data: dict) -> dict:
elif argument == "compilation-status":
status = openplc_runtime.compilation_status_str
if status == "":
return {"compilation-status": "No compilation in progress"}
return {"compilation-status": status}
if status is not str:
_status = "No compilation in progress"
_status = status
elif argument == "compilation-logs":
try:
logs = openplc_runtime.compilation_status()
return {"compilation-logs": logs}
_logs = logs
except Exception as e:
logger.error(f"Error retrieving compilation logs: {e}")
return {"error": str(e)}
_logs = str(e)
return {"status": _status, "logs": _logs}
elif argument == "status":
return {"current_status": "operational", "details": data}
@@ -83,6 +84,7 @@ def restapi_callback_get(argument: str, data: dict) -> dict:
def restapi_callback_post(argument: str, data: dict) -> dict:
logger.debug(f"POST | Received argument: {argument}, data: {data}")
# upload == compile
if argument == "upload-file":
try:
# TODO validate filename, content and size