#Подключаем движок генерации HTML на стороне клиента :))) jsRender

dev-linux
Ivan Maslov 6 years ago
parent 83c4b75d82
commit 09b464d12a

@ -32,18 +32,35 @@
$('.main.menu .ui.dropdown').dropdown({ $('.main.menu .ui.dropdown').dropdown({
on: 'hover' on: 'hover'
}); });
String.prototype.replaceAll = function(search, replace){
return this.split(search).join(replace);
}
mGlobal.GeneralGenerateHTMLCode=function(inTemplateHTMLSelector,inItemDictionary,inKeywordPrefix="::",inKeywordPostfix="::") {
///Получить заготовку
lTemplateHTMLCode=$(inTemplateHTMLSelector)[0].outerHTML
///Определить ключь экранирования специальных ключевых слов
///Выполнить циклические замены, если там есть пожходящие ключи
lResultHTMLCode=lTemplateHTMLCode
for(var lKey in inItemDictionary) {
lHTMLKey=inKeywordPrefix+lKey+inKeywordPostfix;
lResultHTMLCode=lResultHTMLCode.replaceAll(lHTMLKey,inItemDictionary[lKey])
}
///Вернуть результат
return lResultHTMLCode
}
mGlobal.Monitor={}; mGlobal.Monitor={};
mGlobal.Monitor.ScreenshotModal={}; mGlobal.Monitor.ScreenshotModal={};
mGlobal.Monitor.GenerateUniqueID=function(inPrefix="tempUID=") { mGlobal.Monitor.GenerateUniqueID=function(inPrefix="tempUID=") {
return inPrefix+Math.round(Math.random()*1000)+"-"+Math.round(Math.random()*10000)+"-"+Math.round(Math.random()*1000) return inPrefix+Math.round(Math.random()*1000)+"-"+Math.round(Math.random()*10000)+"-"+Math.round(Math.random()*1000)
} }
mGlobal.Monitor.ScreenshotModal.Show=function() { //inHostURI: http://localhost:8081
mGlobal.Monitor.ScreenshotModal.Show=function(inHostURI) {
$('.ui.modal.daemon-screenshot').modal('show'); $('.ui.modal.daemon-screenshot').modal('show');
//Функция обновления картинки //Функция обновления картинки
lScreenshotUpdate=function() { lScreenshotUpdate=function() {
lScreenshotSrc="/GetScreenshot?"+mGlobal.Monitor.GenerateUniqueID() lScreenshotSrc=inHostURI+"/GetScreenshot?"+mGlobal.Monitor.GenerateUniqueID()
$(".daemon-screenshot img").attr('src', lScreenshotSrc); $(".daemon-screenshot img").attr('src', lScreenshotSrc);
} }
@ -127,28 +144,55 @@
</div> </div>
<div class="row black"> <div class="row black">
<div class="two wide column"> <div class="two wide column">
<button class="ui button grey labeled icon mini" onclick="mGlobal.GUIRefreshTree()"> <h2 class="ui header inverted">Monitor</h2>
<i class="up refresh icon"></i>
Refresh tree
</button>
</div> </div>
<div class="two wide column"> <div class="two wide column">
<button class="ui button grey labeled icon mini">
<i class="up arrow icon"></i>
From
</button>
</div> </div>
<div class="two wide column"> <div class="two wide column">
<button class="ui button grey labeled icon mini">
<i class="down arrow icon"></i>
To
</button>
</div> </div>
<div class="ten wide column"> <div class="ten wide column">
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="openrpa-hidden-monitor-table-general" style="display:none">
<table class="ui celled table">
<thead>
<tr>
<th>Daemon name</th>
<th>Machihe host</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>No Name Specified</td>
<td>Unknown</td>
<td class="negative">None</td>
</tr>
<tr class="positive">
<td>Jimmy</td>
<td><i class="icon checkmark"></i> Approved</td>
<td>None</td>
</tr>
<tr>
<td>Jamie</td>
<td>Unknown</td>
<td class="positive"><i class="icon close"></i> Requires call</td>
</tr>
<tr class="negative">
<td>Jill</td>
<td>Unknown</td>
<td>None</td>
</tr>
</tbody>
</table>
</div>
<a onclick="mGlobal.Monitor.ScreenshotModal.Show();" class="item" target="_blank">GetScreenshot</a> <a onclick="mGlobal.Monitor.ScreenshotModal.Show();" class="item" target="_blank">GetScreenshot</a>
</div> </div>
<div class="row black"> <div class="row black">

File diff suppressed because one or more lines are too long

@ -1,4 +1,16 @@
{ "__loopSeconds":"Количество секунд, между циклами проверки действий", {
"__webServerPort":"Порт, по которому можно подключиться к демону",
"webServerPort":8081,
"webServerMonitorList":[
{
"daemonName":"Local machine test",
"__daemonURI":"Сетевое расположение сервера демона",
"daemonURI":"http://127.0.0.1:8081"
}
],
"__loopSeconds":"Количество секунд, между циклами проверки действий",
"loopSeconds":5, "loopSeconds":5,
"activityList":[ "activityList":[
{ {

@ -16,14 +16,16 @@ def SaveScreenshot(inFilePath):
lScreenshot.save('screenshot.png') lScreenshot.save('screenshot.png')
class RobotDaemonServer(Thread): class RobotDaemonServer(Thread):
def __init__(self,name): self.mJSONConfigurationDict={};
def __init__(self,name,inJSONConfigurationDict):
Thread.__init__(self) Thread.__init__(self)
self.name = name self.name = name
def run(self): self.mJSONConfigurationDict=inJSONConfigurationDict
def run(self,inServerAddress="127.0.0.1",inPort=8081):
print('starting server...') print('starting server...')
# Server settings # Server settings
# Choose port 8080, for port 80, which is normally used for a http server, you need root access # Choose port 8080, for port 80, which is normally used for a http server, you need root access
server_address = ('127.0.0.1', 8081) server_address = (inServerAddress, inPort)
httpd = HTTPServer(server_address, testHTTPServer_RequestHandler) httpd = HTTPServer(server_address, testHTTPServer_RequestHandler)
print('running server...') print('running server...')
httpd.serve_forever() httpd.serve_forever()

@ -7,5 +7,6 @@ Dependencies
* Python 3 x64 * Python 3 x64
* pywinauto (Windows GUI automation) * pywinauto (Windows GUI automation)
* Semantic UI CSS framework * Semantic UI CSS framework
* JsRender by https://www.jsviews.com
Created by Unicode Labs (Ivan Maslov) Created by Unicode Labs (Ivan Maslov)
Loading…
Cancel
Save