From 400d5b6fd8316792334483bf9aa6721e8723a294 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Mon, 29 Apr 2019 23:20:45 +0300 Subject: [PATCH] #ActivityCMDRun #OrchestratorCMDRun --- Orchestrator/Web/Index.xhtml | 28 ++++++++++++++++++++++++++- Orchestrator/orchestratorProcessor.py | 14 +++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Orchestrator/Web/Index.xhtml b/Orchestrator/Web/Index.xhtml index 47507567..1c7d7d55 100644 --- a/Orchestrator/Web/Index.xhtml +++ b/Orchestrator/Web/Index.xhtml @@ -82,6 +82,29 @@ dataType: "text" }); } + + ////////////////////////// + /////Controller JS module + ////////////////////////// + mGlobal.Controller={}; + mGlobal.Controller.CMDRun=function() { + ///Обнулить таблицу + lCMDCode=$(".openrpa-controller-cmd-run-input")[0].value + $.ajax({ + type: "POST", + url: 'ProcessingRun', + data: '{"actionList":[{"type":"ActivityCMDRun", "code":"'+lCMDCode+'"}]}', + success: + function(lData,l2,l3) + { + var lResponseJSON=JSON.parse(lData) + ///Отправить запрос на формирование таблицы + lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result) + }, + dataType: "text" + }); + } + ////////////////////////// /////Monitor JS module ////////////////////////// @@ -346,7 +369,10 @@
- +
+ +
Run!
+
diff --git a/Orchestrator/orchestratorProcessor.py b/Orchestrator/orchestratorProcessor.py index d6d6a7e6..a7d21796 100644 --- a/Orchestrator/orchestratorProcessor.py +++ b/Orchestrator/orchestratorProcessor.py @@ -2,6 +2,8 @@ import datetime import http.client import json import pdb +import os +import subprocess #Глобальная переменная - все глобальные значения программы global mGlobalDict #{ @@ -15,6 +17,10 @@ global mGlobalDict # }, # { # type: +# }, +# { +# type: , +# code: # } # ] # @@ -45,5 +51,11 @@ def ProcessingRun(inConfigurationDict): if lItem["type"]=="ActivityLogScheduleListGet": #pdb.set_trace() lResult["actionListResult"][-1] = {**lResult["actionListResult"][-1], **{"result":mGlobalDict["ActivityLogScheduleList"]}} - #Вернуть результат + #Обработка команды ActivityCMDRun + if lItem["type"]=="ActivityCMDRun": + lCMDCode="cmd /c "+lItem["code"] + subprocess.Popen(lCMDCode) + lResultCMDRun=1#os.system(lCMDCode) + lResult["actionListResult"][-1] = {**lResult["actionListResult"][-1], **{"result":str(lResultCMDRun)}} + #Вернуть результат return lResult