|
|
@ -33,12 +33,47 @@
|
|
|
|
$('.main.menu .ui.dropdown').dropdown({
|
|
|
|
$('.main.menu .ui.dropdown').dropdown({
|
|
|
|
on: 'hover'
|
|
|
|
on: 'hover'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clone(obj) {
|
|
|
|
|
|
|
|
var copy;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle the 3 simple types, and null or undefined
|
|
|
|
|
|
|
|
if (null == obj || "object" != typeof obj) return obj;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle Date
|
|
|
|
|
|
|
|
if (obj instanceof Date) {
|
|
|
|
|
|
|
|
copy = new Date();
|
|
|
|
|
|
|
|
copy.setTime(obj.getTime());
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle Array
|
|
|
|
|
|
|
|
if (obj instanceof Array) {
|
|
|
|
|
|
|
|
copy = [];
|
|
|
|
|
|
|
|
for (var i = 0, len = obj.length; i < len; i++) {
|
|
|
|
|
|
|
|
copy[i] = clone(obj[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Handle Object
|
|
|
|
|
|
|
|
if (obj instanceof Object) {
|
|
|
|
|
|
|
|
copy = {};
|
|
|
|
|
|
|
|
for (var attr in obj) {
|
|
|
|
|
|
|
|
if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return copy;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
throw new Error("Unable to copy obj! Its type isn't supported.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String.prototype.replaceAll = function(search, replace){
|
|
|
|
String.prototype.replaceAll = function(search, replace){
|
|
|
|
return this.split(search).join(replace);
|
|
|
|
return this.split(search).join(replace);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mGlobal.GeneralGenerateHTMLCodeHandlebars=function(inInnerTemplateSelector,inData) {
|
|
|
|
mGlobal.GeneralGenerateHTMLCodeHandlebars=function(inInnerTemplateSelector,inData) {
|
|
|
|
lHTMLTemplate=$(inInnerTemplateSelector)[0].innerHTML
|
|
|
|
lHTMLTemplate=$(inInnerTemplateSelector)[0].innerHTML
|
|
|
|
console.log(lHTMLTemplate)
|
|
|
|
//console.log(lHTMLTemplate)
|
|
|
|
//Компиляция
|
|
|
|
//Компиляция
|
|
|
|
var template = Handlebars.compile(lHTMLTemplate);
|
|
|
|
var template = Handlebars.compile(lHTMLTemplate);
|
|
|
|
//Вставка данных
|
|
|
|
//Вставка данных
|
|
|
@ -102,7 +137,7 @@
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var lResponseJSON=JSON.parse(lData)
|
|
|
|
var lResponseJSON=JSON.parse(lData)
|
|
|
|
///Отправить запрос на формирование таблицы
|
|
|
|
///Отправить запрос на формирование таблицы
|
|
|
|
lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result)
|
|
|
|
//lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dataType: "text"
|
|
|
|
dataType: "text"
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -132,7 +167,7 @@
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var lResponseJSON=JSON.parse(lData)
|
|
|
|
var lResponseJSON=JSON.parse(lData)
|
|
|
|
///Отправить запрос на формирование таблицы
|
|
|
|
///Отправить запрос на формирование таблицы
|
|
|
|
lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result)
|
|
|
|
//lHTMLCode=console.log("CMDRun result: "+lResponseJSON[0].result)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dataType: "text"
|
|
|
|
dataType: "text"
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -267,7 +302,7 @@
|
|
|
|
success:
|
|
|
|
success:
|
|
|
|
function(lData,l2,l3)
|
|
|
|
function(lData,l2,l3)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
console.log(lData)
|
|
|
|
//console.log(lData)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dataType: "text"
|
|
|
|
dataType: "text"
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -335,6 +370,152 @@
|
|
|
|
dataType: "text"
|
|
|
|
dataType: "text"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////
|
|
|
|
|
|
|
|
///Modal
|
|
|
|
|
|
|
|
///////////////////
|
|
|
|
|
|
|
|
mGlobal.Modal={}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
mGlobal.Modal.TableFilter={}
|
|
|
|
|
|
|
|
mGlobal.Modal.TableFilter.Show=function(inJSON) {
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// "Title":"",
|
|
|
|
|
|
|
|
// "Headers":["Header1","Header2"],
|
|
|
|
|
|
|
|
// "Rows": [["Cell1","Cell2"],["Cell2-1","Cell2-2"]],
|
|
|
|
|
|
|
|
// "FilterOnKeyUp": "<JS Code>" //Fill here in function
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//Set js handler to Search field
|
|
|
|
|
|
|
|
inJSON["FilterOnKeyUp"]="mGlobal.Modal.TableFilter.FilterUpdate(this.value);"
|
|
|
|
|
|
|
|
///Set value
|
|
|
|
|
|
|
|
mGlobal.Modal.TableFilter.mDataJSON = inJSON
|
|
|
|
|
|
|
|
//Render HTML
|
|
|
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-table-filter",inJSON);
|
|
|
|
|
|
|
|
///Установить HTML код
|
|
|
|
|
|
|
|
$('.ui.modal.basic .content').html(lHTMLCode);
|
|
|
|
|
|
|
|
$('.ui.modal.basic').modal('show');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//Service function
|
|
|
|
|
|
|
|
mGlobal.Modal.TableFilter.FilterUpdate=function(inFilterValue) {
|
|
|
|
|
|
|
|
//Get JSON, apply filter, clone data
|
|
|
|
|
|
|
|
lDataJSON = clone(mGlobal.Modal.TableFilter.mDataJSON)
|
|
|
|
|
|
|
|
delete lDataJSON["Rows"]
|
|
|
|
|
|
|
|
lDataJSON["Rows"]=[]
|
|
|
|
|
|
|
|
//Filter code [any occurence in the row is ok for push! ]
|
|
|
|
|
|
|
|
mGlobal.Modal.TableFilter.mDataJSON["Rows"].forEach(
|
|
|
|
|
|
|
|
function(inElement) {
|
|
|
|
|
|
|
|
lFlagElementAppend = false
|
|
|
|
|
|
|
|
inElement.forEach(
|
|
|
|
|
|
|
|
function(inElement2) {
|
|
|
|
|
|
|
|
if (String(inElement2).includes(inFilterValue)) {
|
|
|
|
|
|
|
|
lFlagElementAppend = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if (lFlagElementAppend) {
|
|
|
|
|
|
|
|
lDataJSON["Rows"].push(inElement)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
//Clear Filter Title property (fixed in html)
|
|
|
|
|
|
|
|
delete lDataJSON["FilterOnKeyUp"]
|
|
|
|
|
|
|
|
delete lDataJSON["Title"]
|
|
|
|
|
|
|
|
//Search the table element [replace only table html]
|
|
|
|
|
|
|
|
lElement = $('.ui.modals.active .content table.table')[0]
|
|
|
|
|
|
|
|
lElementParentElement = lElement.parentNode
|
|
|
|
|
|
|
|
lElement.parentNode.removeChild(lElement);
|
|
|
|
|
|
|
|
//Render HTML
|
|
|
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-table-filter",lDataJSON);
|
|
|
|
|
|
|
|
///Установить HTML код
|
|
|
|
|
|
|
|
lElementParentElement.insertAdjacentHTML("beforeend",lHTMLCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
mGlobal.Modal.ListFilter={}
|
|
|
|
|
|
|
|
mGlobal.Modal.ListFilter.Show=function(inJSON) {
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// "Title":"",
|
|
|
|
|
|
|
|
// "List":[{"Header":"","Description":""}],
|
|
|
|
|
|
|
|
// "FilterOnKeyUp": "<JS Code>" //Fill here in function
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//Set js handler to Search field
|
|
|
|
|
|
|
|
inJSON["FilterOnKeyUp"]="mGlobal.Modal.ListFilter.FilterUpdate(this.value);"
|
|
|
|
|
|
|
|
///Set value
|
|
|
|
|
|
|
|
mGlobal.Modal.ListFilter.mDataJSON = inJSON
|
|
|
|
|
|
|
|
//Render HTML
|
|
|
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-list-filter",inJSON);
|
|
|
|
|
|
|
|
///Установить HTML код
|
|
|
|
|
|
|
|
$('.ui.modal.basic .content').html(lHTMLCode);
|
|
|
|
|
|
|
|
$('.ui.modal.basic').modal('show');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//Service function
|
|
|
|
|
|
|
|
mGlobal.Modal.ListFilter.FilterUpdate=function(inFilterValue) {
|
|
|
|
|
|
|
|
//Get JSON, apply filter, clone data
|
|
|
|
|
|
|
|
lDataJSON = clone(mGlobal.Modal.ListFilter.mDataJSON)
|
|
|
|
|
|
|
|
delete lDataJSON["List"]
|
|
|
|
|
|
|
|
lDataJSON["List"]=[]
|
|
|
|
|
|
|
|
//Filter code [any occurence in the row is ok for push! ]
|
|
|
|
|
|
|
|
mGlobal.Modal.ListFilter.mDataJSON["List"].forEach(
|
|
|
|
|
|
|
|
function(inElement) {
|
|
|
|
|
|
|
|
lFlagElementAppend = false
|
|
|
|
|
|
|
|
if (String(inElement["Header"]).includes(inFilterValue)) {
|
|
|
|
|
|
|
|
lFlagElementAppend = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (String(inElement["Description"]).includes(inFilterValue)) {
|
|
|
|
|
|
|
|
lFlagElementAppend = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lFlagElementAppend) {
|
|
|
|
|
|
|
|
lDataJSON["List"].push(inElement)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
//Clear Filter Title property (fixed in html)
|
|
|
|
|
|
|
|
delete lDataJSON["FilterOnKeyUp"]
|
|
|
|
|
|
|
|
delete lDataJSON["Title"]
|
|
|
|
|
|
|
|
//Search the table element [replace only table html]
|
|
|
|
|
|
|
|
lElement = $('.ui.modals.active .content div.ui.inverted.segment')[0]
|
|
|
|
|
|
|
|
lElementParentElement = lElement.parentNode
|
|
|
|
|
|
|
|
lElement.parentNode.removeChild(lElement);
|
|
|
|
|
|
|
|
//Render HTML
|
|
|
|
|
|
|
|
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-handlebar-template-list-filter",lDataJSON);
|
|
|
|
|
|
|
|
///Установить HTML код
|
|
|
|
|
|
|
|
lElementParentElement.insertAdjacentHTML("beforeend",lHTMLCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
///Test
|
|
|
|
|
|
|
|
lTestData = {
|
|
|
|
|
|
|
|
"Title":"Test",
|
|
|
|
|
|
|
|
"Columns":["Дата/Время","Статус","Клиент","Файл"],
|
|
|
|
|
|
|
|
"Rows":[
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО БалтКам", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО Гренодер", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО БалтКам", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО Гренодер", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Отказ", "ООО Сударь", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО БалтКам", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Отказ", "ООО Гренодер", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО Гренодер", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО Сударь", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО БалтКам", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО Гренодер", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Отказ", "ООО Сударь", "test.xml"],
|
|
|
|
|
|
|
|
["2019.10.31 13:21","Успешно", "ООО БалтКам", "test.xml"],
|
|
|
|
|
|
|
|
["f","s"]
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//mGlobal.Modal.TableFilter.Show(lTestData)
|
|
|
|
|
|
|
|
///Test
|
|
|
|
|
|
|
|
lTestData = {
|
|
|
|
|
|
|
|
"Title":"Test",
|
|
|
|
|
|
|
|
"List":[
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"Test 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"Test 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"Test 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"TestNew 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"Test 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"TestNew 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"Test 21.02.2019"},
|
|
|
|
|
|
|
|
{"Header":"Head 09","Description":"Test 21.02.2019"}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//mGlobal.Modal.ListFilter.Show(lTestData)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
;
|
|
|
|
;
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
@ -547,6 +728,62 @@
|
|
|
|
</tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</table>
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script class="openrpa-handlebar-template-table-filter" style="display:none" type="text/x-handlebars-template">
|
|
|
|
|
|
|
|
{{#if Title}}
|
|
|
|
|
|
|
|
<h1>{{{Title}}}</h1>
|
|
|
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if FilterOnKeyUp}}
|
|
|
|
|
|
|
|
<div class="ui icon input search" style="width:500px;">
|
|
|
|
|
|
|
|
<input type="text" onkeyup="{{#if FilterOnKeyUp}}{{{FilterOnKeyUp}}}{{/if}}" placeholder="Search...">
|
|
|
|
|
|
|
|
<i class="inverted circular search link icon"></i>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<table class="ui celled table selectable inverted">
|
|
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
|
|
{{#Columns}}
|
|
|
|
|
|
|
|
<th>{{{this}}}</th>
|
|
|
|
|
|
|
|
{{/Columns}}
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
|
|
{{#Rows}}
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
|
|
{{#this}}
|
|
|
|
|
|
|
|
<td>
|
|
|
|
|
|
|
|
{{{this}}}
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
{{/this}}
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
{{/Rows}}
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script class="openrpa-handlebar-template-list-filter" style="display:none" type="text/x-handlebars-template">
|
|
|
|
|
|
|
|
{{#if Title}}
|
|
|
|
|
|
|
|
<h1>{{{Title}}}</h1>
|
|
|
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
{{#if FilterOnKeyUp}}
|
|
|
|
|
|
|
|
<div class="ui icon input search" style="width:500px;">
|
|
|
|
|
|
|
|
<input type="text" onkeyup="{{#if FilterOnKeyUp}}{{{FilterOnKeyUp}}}{{/if}}" placeholder="Search...">
|
|
|
|
|
|
|
|
<i class="inverted circular search link icon"></i>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{/if}}
|
|
|
|
|
|
|
|
<div class="ui inverted segment">
|
|
|
|
|
|
|
|
<div class="ui inverted relaxed divided list">
|
|
|
|
|
|
|
|
{{#List}}
|
|
|
|
|
|
|
|
<div class="item">
|
|
|
|
|
|
|
|
<i class="map marker icon"></i>
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
|
|
|
|
|
<a class="header">{{{Header}}}</a>
|
|
|
|
|
|
|
|
<div class="description">{{{Description}}}</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{/List}}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<div class="row openrpa-monitor">
|
|
|
|
<div class="row openrpa-monitor">
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|