|
|
|
@ -1,5 +1,12 @@
|
|
|
|
|
var mGlobal={}
|
|
|
|
|
window.onload=function() {
|
|
|
|
|
//document.cookie = "SessionGUIDStr=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
|
|
|
//Render existing data
|
|
|
|
|
//mGlobal.Monitor.fControlPanelRefresh_TechnicalRender()
|
|
|
|
|
}
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
document.cookie = "SessionGUIDStr=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
|
|
|
console.log("Cookie is deleted")
|
|
|
|
|
// fix main menu to page on passing
|
|
|
|
|
$('.main.menu').visibility({
|
|
|
|
|
type: 'fixed'
|
|
|
|
@ -55,7 +62,7 @@ $(document).ready(function() {
|
|
|
|
|
//For data storage key
|
|
|
|
|
mGlobal["DataStorage"] = {}
|
|
|
|
|
// Clear the session cookie
|
|
|
|
|
document.cookie = "SessionGUIDStr=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
|
|
|
|
|
|
|
|
String.prototype.replaceAll = function(search, replace){
|
|
|
|
|
return this.split(search).join(replace);
|
|
|
|
|
}
|
|
|
|
@ -93,6 +100,7 @@ $(document).ready(function() {
|
|
|
|
|
/////Controller JS module
|
|
|
|
|
//////////////////////////
|
|
|
|
|
mGlobal.Controller={};
|
|
|
|
|
|
|
|
|
|
mGlobal.Controller.CMDRunText=function(inCMDText) {
|
|
|
|
|
///Подготовить конфигурацию
|
|
|
|
|
lData = [
|
|
|
|
@ -159,6 +167,28 @@ $(document).ready(function() {
|
|
|
|
|
dataType: "text"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
///Restart PC
|
|
|
|
|
mGlobal.Controller.PCRestart = function () {
|
|
|
|
|
mGlobal.Controller.CMDRunText("shutdown -r")
|
|
|
|
|
}
|
|
|
|
|
///Orchestrator save session
|
|
|
|
|
mGlobal.Controller.OrchestratorSessionSave=function() {
|
|
|
|
|
///Подготовить конфигурацию
|
|
|
|
|
lData = [
|
|
|
|
|
{"Type":"OrchestratorSessionSave"}
|
|
|
|
|
]
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: 'Utils/Processor',
|
|
|
|
|
data: JSON.stringify(lData),
|
|
|
|
|
success:
|
|
|
|
|
function(lData,l2,l3)
|
|
|
|
|
{
|
|
|
|
|
var lResponseJSON=JSON.parse(lData)
|
|
|
|
|
},
|
|
|
|
|
dataType: "text"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
///Перезагрузить Orchestrator
|
|
|
|
|
mGlobal.Controller.OrchestratorRestart=function() {
|
|
|
|
|
///Подготовить конфигурацию
|
|
|
|
@ -177,6 +207,10 @@ $(document).ready(function() {
|
|
|
|
|
dataType: "text"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
mGlobal.Controller.OrchestratorGITPullRestart = function() {
|
|
|
|
|
mGlobal.Controller.OrchestratorSessionSave() //Save current RDP list session
|
|
|
|
|
mGlobal.Controller.CMDRunText("timeout 3 & taskkill /f /im OpenRPA_Orchestrator.exe & timeout 2 & cd "+mGlobal.WorkingDirectoryPathStr+" & git reset --hard & git pull & pyOpenRPA.Orchestrator_x64_administrator_startup.cmd");
|
|
|
|
|
}
|
|
|
|
|
//////////////////////////
|
|
|
|
|
/////Monitor JS module
|
|
|
|
|
//////////////////////////
|
|
|
|
@ -230,83 +264,102 @@ $(document).ready(function() {
|
|
|
|
|
ms += new Date().getTime();
|
|
|
|
|
while (new Date() < ms){}
|
|
|
|
|
}
|
|
|
|
|
function uuidv4() {
|
|
|
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
|
|
|
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
|
|
|
return v.toString(16);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
mGlobal.SessionGUIDStr = uuidv4() // Generate uuid4 of the session
|
|
|
|
|
//console.log(uuidv4());
|
|
|
|
|
mGlobal.Monitor.fControlPanelRefresh_TechnicalRender = function()
|
|
|
|
|
{
|
|
|
|
|
lResponseJSON = mGlobal.Monitor.mDatasetLast
|
|
|
|
|
if (lResponseJSON!= null) {
|
|
|
|
|
///Escape onclick
|
|
|
|
|
/// RenderRobotList
|
|
|
|
|
lResponseJSON["RenderRobotList"].forEach(
|
|
|
|
|
function(lItem){
|
|
|
|
|
if ('FooterButtonX2List' in lItem) {
|
|
|
|
|
/// FooterButtonX2List
|
|
|
|
|
lItem["FooterButtonX2List"].forEach(
|
|
|
|
|
function(lItem2){
|
|
|
|
|
if ('OnClick' in lItem) {
|
|
|
|
|
lOnClickEscaped = lItem["OnClick"];
|
|
|
|
|
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
|
|
|
lItem["OnClick"] = lOnClickEscaped;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
/// FooterButtonX1List
|
|
|
|
|
lItem["FooterButtonX1List"].forEach(
|
|
|
|
|
function(lItem2){
|
|
|
|
|
if ('OnClick' in lItem) {
|
|
|
|
|
lOnClickEscaped = lItem["OnClick"];
|
|
|
|
|
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
|
|
|
lItem["OnClick"] = lOnClickEscaped;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
|
///Сформировать HTML код новой таблицы - контрольная панель
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON)
|
|
|
|
|
//Присвоить ответ в mGlobal.Monitor.mResponseList
|
|
|
|
|
mGlobal.Monitor.mResponseList = lResponseJSON
|
|
|
|
|
///Set result in mGlobal.DataStorage
|
|
|
|
|
lResponseJSON["RenderRobotList"].forEach(
|
|
|
|
|
function(lItem){
|
|
|
|
|
if ('DataStorageKey' in lItem) {
|
|
|
|
|
mGlobal["DataStorage"][lItem['DataStorageKey']]=lItem
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
///Прогрузить новую таблицу
|
|
|
|
|
$(".openrpa-control-panel").html(lHTMLCode)
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
|
///Сформировать HTML код новой таблицы - список RDP
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON)
|
|
|
|
|
//Присвоить ответ в mGlobal.RobotRDPActive.mResponseList
|
|
|
|
|
mGlobal.RobotRDPActive.mResponseList = lResponseJSON
|
|
|
|
|
///Прогрузить новую таблицу
|
|
|
|
|
$(".openrpa-robotrdpactive-control-panel").html(lHTMLCode)
|
|
|
|
|
///Очистить дерево
|
|
|
|
|
//mGlobal.ElementTree.fClear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mGlobal.Monitor.mDatasetLast = null
|
|
|
|
|
mGlobal.Monitor.fControlPanelRefresh=function() {
|
|
|
|
|
try {
|
|
|
|
|
//var XHR = new XMLHttpRequest();
|
|
|
|
|
//XHR.setRequestHeader("Cookies",document.cookie)
|
|
|
|
|
///Загрузка данных
|
|
|
|
|
//console.log("Request is sent")
|
|
|
|
|
//console.log(document.cookie)
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "GET",
|
|
|
|
|
url: 'Monitor/ControlPanelDictGet',
|
|
|
|
|
data: '',
|
|
|
|
|
xhrFields: {
|
|
|
|
|
withCredentials: true
|
|
|
|
|
},
|
|
|
|
|
success: function(lData,l2,l3)
|
|
|
|
|
{
|
|
|
|
|
type: "GET",
|
|
|
|
|
headers: {"SessionGUIDStr":mGlobal.SessionGUIDStr},
|
|
|
|
|
url: 'Monitor/ControlPanelDictGet',
|
|
|
|
|
data: '',
|
|
|
|
|
//cache: false,
|
|
|
|
|
//xhr: XHR,
|
|
|
|
|
success: function(lData,l2,l3) {
|
|
|
|
|
try {
|
|
|
|
|
var lResponseJSON=JSON.parse(lData)
|
|
|
|
|
///Escape onclick
|
|
|
|
|
/// RenderRobotList
|
|
|
|
|
lResponseJSON["RenderRobotList"].forEach(
|
|
|
|
|
function(lItem){
|
|
|
|
|
if ('FooterButtonX2List' in lItem) {
|
|
|
|
|
/// FooterButtonX2List
|
|
|
|
|
lItem["FooterButtonX2List"].forEach(
|
|
|
|
|
function(lItem2){
|
|
|
|
|
if ('OnClick' in lItem) {
|
|
|
|
|
lOnClickEscaped = lItem["OnClick"];
|
|
|
|
|
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
|
|
|
lItem["OnClick"] = lOnClickEscaped;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
/// FooterButtonX1List
|
|
|
|
|
lItem["FooterButtonX1List"].forEach(
|
|
|
|
|
function(lItem2){
|
|
|
|
|
if ('OnClick' in lItem) {
|
|
|
|
|
lOnClickEscaped = lItem["OnClick"];
|
|
|
|
|
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
|
|
|
lItem["OnClick"] = lOnClickEscaped;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
//////////////////////////////////////////////////////////
|
|
|
|
|
///Сформировать HTML код новой таблицы - контрольная панель
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON)
|
|
|
|
|
//Присвоить ответ в mGlobal.Monitor.mResponseList
|
|
|
|
|
mGlobal.Monitor.mResponseList = lResponseJSON
|
|
|
|
|
///Set result in mGlobal.DataStorage
|
|
|
|
|
lResponseJSON["RenderRobotList"].forEach(
|
|
|
|
|
function(lItem){
|
|
|
|
|
if ('DataStorageKey' in lItem) {
|
|
|
|
|
mGlobal["DataStorage"][lItem['DataStorageKey']]=lItem
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
///Прогрузить новую таблицу
|
|
|
|
|
$(".openrpa-control-panel").html(lHTMLCode)
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
|
///Сформировать HTML код новой таблицы - список RDP
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON)
|
|
|
|
|
//Присвоить ответ в mGlobal.RobotRDPActive.mResponseList
|
|
|
|
|
mGlobal.RobotRDPActive.mResponseList = lResponseJSON
|
|
|
|
|
///Прогрузить новую таблицу
|
|
|
|
|
$(".openrpa-robotrdpactive-control-panel").html(lHTMLCode)
|
|
|
|
|
///Очистить дерево
|
|
|
|
|
//mGlobal.ElementTree.fClear();
|
|
|
|
|
|
|
|
|
|
mGlobal.Monitor.mDatasetLast = lResponseJSON
|
|
|
|
|
mGlobal.Monitor.fControlPanelRefresh_TechnicalRender()
|
|
|
|
|
}
|
|
|
|
|
catch(error) {
|
|
|
|
|
}
|
|
|
|
|
mGlobal.Monitor.fControlPanelRefresh() // recursive
|
|
|
|
|
},
|
|
|
|
|
dataType: "text",
|
|
|
|
|
error: function(jqXHR, textStatus, errorThrown ) {
|
|
|
|
|
sleep(3000)
|
|
|
|
|
mGlobal.Monitor.fControlPanelRefresh() // recursive
|
|
|
|
|
}
|
|
|
|
|
dataType: "text",
|
|
|
|
|
error: function(jqXHR, textStatus, errorThrown ) {
|
|
|
|
|
sleep(3000)
|
|
|
|
|
mGlobal.Monitor.fControlPanelRefresh() // recursive
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch(error) {
|
|
|
|
@ -615,4 +668,28 @@ $(document).ready(function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
mGlobal.UserRoleUpdate() // Cal the update User Roles function
|
|
|
|
|
// Orchestrator model
|
|
|
|
|
mGlobal.WorkingDirectoryPathStr = null
|
|
|
|
|
mGlobal.OrchestratorModelUpdate=function() {
|
|
|
|
|
lData = [
|
|
|
|
|
{
|
|
|
|
|
"Type": "GlobalDictKeyListValueGet",
|
|
|
|
|
"KeyList": ["Server","WorkingDirectoryPathStr"]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
url: 'Utils/Processor',
|
|
|
|
|
data: JSON.stringify(lData),
|
|
|
|
|
success:
|
|
|
|
|
function(lData,l2,l3)
|
|
|
|
|
{
|
|
|
|
|
var lUACAsk = mGlobal.UserRoleAsk // Alias
|
|
|
|
|
var lResponseList=JSON.parse(lData)
|
|
|
|
|
mGlobal.WorkingDirectoryPathStr = lResponseList[0]["Result"]
|
|
|
|
|
},
|
|
|
|
|
dataType: "text"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
mGlobal.OrchestratorModelUpdate() // Cal the update orchestrator model
|
|
|
|
|
});
|