diff --git a/Orchestrator/Demo/SIMPLE_01/config.py b/Orchestrator/Demo/SIMPLE_01/config.py new file mode 100644 index 00000000..4c30004a --- /dev/null +++ b/Orchestrator/Demo/SIMPLE_01/config.py @@ -0,0 +1,73 @@ +from pyOpenRPA.Tools import CrossOS +import os +import sys +import time +import json +from pyOpenRPA import Orchestrator +from datetime import date +from pyOpenRPA.Orchestrator.Server import app +import threading +from fastapi import Depends, Body +from fastapi.responses import PlainTextResponse +from fastapi.responses import FileResponse +time.sleep(1.5) # Определить очередность в панели управления +from fastapi.staticfiles import StaticFiles +# путь к папке, в которой расположена панель управления (используется для формирования других путей) +cp_path_str = CrossOS.PathJoinList(CrossOS.PathSplitList(__file__)[:-1]) + +#AGENT SETTINGS +agent_hostname_str = "" +agent_username_str = "" + +# ROBOT SETTINGS +robot_logs_path_str = f"{cp_path_str}" + + +gSettings = Orchestrator.GSettingsGet() + + +# календарь +robot_key_str = "SIMPLE_01" + +# Подключить папку +#app.mount(f"/{robot_key_str}/calendar", StaticFiles(directory=os.path.join(os.path.abspath(cpPathStr), "calendar")), name=f"{robot_key_str}_calendar") + + +# пути для ... +htmlPath = os.path.join(cp_path_str, "index.html") +scriptPath = os.path.join(cp_path_str, f"scripts.js") + +# вывод папки логов +def check_folder(folder): + files = os.listdir(folder) + return files[::-1] +app.mount(f"/{robot_key_str}/logs", StaticFiles(directory=robot_logs_path_str), name=f"{robot_key_str}-logs") + +@app.get(path=f"/{robot_key_str}/scripts.js",tags=[f"{robot_key_str}"]) +def get_file2(): + return FileResponse(os.path.abspath(scriptPath)) + +# сторонние файлы +infoPath = os.path.join(cp_path_str, "how_to.docx") +@app.get(path=f"/{robot_key_str}/how_to.docx",tags=[f"{robot_key_str}"]) +def get_file(): + return FileResponse(os.path.abspath(infoPath)) + +#проверка процесса +def process_is_started(): + return Orchestrator.ProcessIsStarted(inProcessNameWOExeStr = robot_key_str) + +# функции для запуска процессов +buildPathStr = CrossOS.PathJoinList(CrossOS.PathSplitList(__file__)[:-3]+["builds"]) +startHandPathStr = os.path.join(buildPathStr, "startHand.cmd") +def startHand(): + Orchestrator.AgentOSCMD(inHostNameStr=agent_hostname_str, inUserStr=agent_username_str, inCMDStr=startHandPathStr, inRunAsyncBool=True, inSendOutputToOrchestratorLogsBool=False, inCaptureBool=False) +@app.get(path=f"/{robot_key_str}/startHand",tags=[f"{robot_key_str}"]) +def start_app(): + startHand() + +# инициализация панели +lCPManager = Orchestrator.Managers.ControlPanel(inControlPanelNameStr=robot_key_str, + inRefreshHTMLJinja2TemplatePathStr=htmlPath, inJinja2TemplateRefreshBool = True) +contextDict = {"config": sys.modules[__name__]} +lCPManager.Jinja2DataUpdateDictSet(inJinja2DataUpdateDict=contextDict) diff --git a/Orchestrator/Demo/SIMPLE_01/how_to.docx b/Orchestrator/Demo/SIMPLE_01/how_to.docx new file mode 100644 index 00000000..3953f29d Binary files /dev/null and b/Orchestrator/Demo/SIMPLE_01/how_to.docx differ diff --git a/Orchestrator/Demo/SIMPLE_01/index.html b/Orchestrator/Demo/SIMPLE_01/index.html new file mode 100644 index 00000000..f1a1b6c5 --- /dev/null +++ b/Orchestrator/Demo/SIMPLE_01/index.html @@ -0,0 +1,56 @@ + +
+
+

SIMPLE_01: ПРОСТОЙ РОБОТ

+
+
Применение:
+

Текст панели управления.

+
Сотрудник:
+

{{UserInfoDict['UserNameUpperStr']}}

+
+ +
+
+
+

СОСТОЯНИЕ

+ {% if config.process_is_started() %} +

+ + Включен +

+ + {% else %} +

+ + Выключен +

+ + {% endif %} + +
+
+

ДЕЙСТВИЯ

+

+

+

+

+

+
+
+
+ +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/Orchestrator/Demo/SIMPLE_01/scripts.js b/Orchestrator/Demo/SIMPLE_01/scripts.js new file mode 100644 index 00000000..41fba536 --- /dev/null +++ b/Orchestrator/Demo/SIMPLE_01/scripts.js @@ -0,0 +1 @@ +var t = function (){} \ No newline at end of file diff --git a/Orchestrator/config.py b/Orchestrator/config.py index fd6f85f3..5d2cbbb8 100755 --- a/Orchestrator/config.py +++ b/Orchestrator/config.py @@ -59,7 +59,7 @@ else: # Restore DUMP Orchestrator.OrchestratorSessionRestore(inGSettings=gSettings) # Autoinit control panels starts with CP_ - lPyModules = Orchestrator.OrchestratorPySearchInit(inGlobPatternStr="Demo\\*\\config.py", inAsyncInitBool=True) + lPyModules = Orchestrator.OrchestratorPySearchInit(inGlobPatternStr="Demo\\*\\config.py", inAsyncInitBool=True, inPackageLevelInt=1) lPyModules2 = Orchestrator.OrchestratorPySearchInit(inGlobPatternStr="..\\..\\KPI_Effect\\packages\\*_control_panel\\config.py", inAsyncInitBool=True, inPackageLevelInt=1) # Call the orchestrator def