mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2026-09-22 10:33:43 +08:00
[RTOP-40] compilation logs and status were merged to one funtion
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user