#OrchestratorControlPanelPreTest

dev-linux
Ivan Maslov 5 years ago
parent c76100cd13
commit 145d8eb9cc

@ -215,7 +215,47 @@
dataType: "text"
});
}
////////////////////////////////
///////Control panel
///////////////////////////////
///Refresh control panel
mGlobal.Monitor.fControlPanelRefresh=function() {
///Загрузка данных
$.ajax({
type: "GET",
url: 'Monitor/ControlPanelDictGet',
data: '',
success:
function(lData,l2,l3)
{
var lResponseJSON=JSON.parse(lData)
///Сформировать HTML код новой таблицы
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON)
///Очистить дерево
//mGlobal.ElementTree.fClear();
///Прогрузить новую таблицу
$(".openrpa-control-panel").html(lHTMLCode)
},
dataType: "text"
});
}
///
mGlobal.Monitor.mControlPanelAutoUpdateSeconds=5;
mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=5;
mGlobal.Monitor.fControlPanelAutoUpdateRun=function(inRefreshSeconds) {
mGlobal.Monitor.mControlPanelAutoUpdateSeconds=inRefreshSeconds;
//Функция обновления текста кнопки обновления
lControlPanelUpdate=function() {
mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent-1
if (mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent==-1) {
mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSeconds;
mGlobal.Monitor.fControlPanelRefresh()
}
$(".openrpa-control-panel-general .openrpa-refresh-button").html("Refresh "+mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent);
}
mGlobal.Monitor.mControlPanelAutoUpdateTimerId=setInterval(lControlPanelUpdate,1000)
}
mGlobal.Monitor.fControlPanelAutoUpdateRun(5);
/////////////////////////////////////
///Инициализация страницы
////////////////////////////////////
@ -315,14 +355,14 @@
<td>{{activityType}}</td>
<td>{{processPath}}</td>
<td>{{activityDateTime}}</td>
<td class="negative">{{activityStartDateTime}}</td>
<td class="negative
">{{activityStartDateTime}}</td>
</tr>
{{/result}}
</tbody>
</table>
</script>
</div>
<div class="ten wide column rpa-property-list" >
<div class="rpa-property-list" >
<h4 class="ui horizontal divider header">
<i class="clipboard list icon"></i>
Plan log
@ -359,6 +399,57 @@
</script>
</div>
</div>
<div class="six wide column openrpa-control-panel-general" >
<h4 class="ui horizontal divider header">
<i class="clipboard list icon"></i>
Robot control panel
</h4>
<div class="ui info message">
<button class="ui icon button labeled" onclick="mGlobal.Monitor.fControlPanelRefresh();">
<i class="sync alternate icon"></i>
<div class="openrpa-refresh-button">Refresh</div>
</button>
</div>
<div class="openrpa-control-panel"></div>
<script class="openrpa-hidden-control-panel" style="display:none" type="text/x-handlebars-template">
<div class="ui cards">
{{#RenderRobotList}}
<div class="card">
<div class="content">
<div class="right floated mini ui ">
{{{HeaderRightText}}}
</div>
<div class="header">
{{{HeaderLeftText}}}
</div>
<div class="meta">
{{{SubheaderText}}}
</div>
<div class="description">
<ul style="padding-inline-start:16px;margin:0px">
{{#BodyKeyValueList}}
<li>{{{Key}}}: {{{Value}}}</li>
{{/BodyKeyValueList}}
</ul>
</div>
</div>
<div class="extra content">
{{{FooterText}}}
</div>
<div class="extra content">
<div class="ui two buttons">
{{#FooterButtonX2List}}
<div class="ui basic {{Color}} button">{{{Text}}}</div>
{{/FooterButtonX2List}}
</div>
</div>
</div>
{{/RenderRobotList}}
</div>
</script>
</div>
</div>
<div class="row black">
<div class="three wide column">

@ -46,7 +46,7 @@
{
"description":"Остановка Python консоли",
"activityType":"processStop",
"time":"9:20",
"time":"19:20",
"timeZone":"4",
"processName":"OpenRPARobotDaemon.exe",
"_flagCloseForce":"Признак, что процесс нужно принудительно закрыть (если флага нет, то на процесс просто посылается команда terminate)",
@ -66,6 +66,14 @@
"processArgs":""
}
],
"ControlPanelDict":{
"RefreshSeconds": 5,
"RobotList": [
{
"RenderFunctionName":"RenderRobotR01",
"RenderFunctionModuleName":"orchestratorConfiguration"
}
]
}
}

@ -0,0 +1,18 @@
def RenderRobotR01(inGlobalConfiguration):
lResultDict={
"HeaderLeftText":"Robot name",
"HeaderRightText":"R01",
"SubheaderText":"Состояние: <span style=\"color:green\">Работает</span>",
"BodyKeyValueList":[
{"Key":"Дата запуска","Value":"10:00:09 01.09.2019"},
{"Key":"Текущий шаг","Value":"Проведение заказа"},
{"Key":"Время выполнения шага","Value":"20с."},
{"Key":"Отчет робота","Value":"скачать"}
],
"FooterText":"Дата изменения: 9:38:00 09.10.2019",
"FooterButtonX2List":[
{"Text":"Вкл.", "Color":"green", "Link":""},
{"Text":"Выкл.", "Color":"red", "Link":""}
]
}
return lResultDict

@ -9,6 +9,7 @@ import PIL
from PIL import ImageGrab
from threading import Thread
import orchestratorProcessor
import importlib
def SaveScreenshot(inFilePath):
# grab fullscreen
@ -100,6 +101,28 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
message = json.dumps(mJSONConfigurationDict)
# Write content as utf-8 data
self.wfile.write(bytes(message, "utf8"))
if self.path == '/Monitor/ControlPanelDictGet':
# Send response status code
self.send_response(200)
# Send headers
self.send_header('Content-type','application/json')
self.end_headers()
#Create result JSON
lResultJSON={"RenderRobotList":[]}
lRenderFunctionsRobotList=mJSONConfigurationDict["ControlPanelDict"]["RobotList"]
for lItem in lRenderFunctionsRobotList:
#Подключить модуль для вызова
lModule=importlib.import_module(lItem["RenderFunctionModuleName"])
#Найти функцию
lFunction=getattr(lModule,lItem["RenderFunctionName"])
#Выполнить вызов и записать результат
lItemResultDict=lFunction(mJSONConfigurationDict)
#RunFunction
lResultJSON["RenderRobotList"].append(lItemResultDict)
# Send message back to client
message = json.dumps(lResultJSON)
# Write content as utf-8 data
self.wfile.write(bytes(message, "utf8"))
# POST
def do_POST(self):
#Централизованная функция получения запросов/отправки

Loading…
Cancel
Save