-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththr_fuzzyMetadataSearch.js
More file actions
107 lines (90 loc) · 2.75 KB
/
Copy paththr_fuzzyMetadataSearch.js
File metadata and controls
107 lines (90 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
onStartUp();
findSolutions();
function onStartUp() {
$('#waiting').hide();
if (hasValidCache()){
// Load second view
$('#firstTime').hide();
$('#secondTime').show();
data = JSON.parse(localStorage.data);
$fuzzyAttributes = $('#fuzzyAttributes').selectize({
onChange: onChangeFuzzyAttributes,
valueField: 'id',
searchField: ['entitySchemaName', 'attributeSchemaName', 'entityName', 'attributeName'],
options: data,
maxOptions: 10,
render: {
option: function(item, escape){
return renderTemplate.replace('{entitySchema}', item.entitySchemaName)
.replace('{attrSchema}', item.attributeSchemaName)
.replace('{entityLabel}', item.entityName)
.replace('{attrLabel}', item.attributeName)
}
}
});
}
else {
// Load first start view
$('#solutionDropdown').html('Choose your Solution <span class="caret"></span>');
$('#firstTime').show();
$('#secondTime').hide();
}
function hasValidCache(){
if (localStorage.solutionId && localStorage.data){
return true;
}
return false;
}
function onChangeFuzzyAttributes (value) {
serverUlr = GetGlobalContext().getClientUrl();
if (value === "") {
return;
}
var d = data[value];
var url = url = serverUlr + '/tools/systemcustomization/attributes/manageAttribute.aspx?appSolutionId=%7b'
+ localStorage.solutionId +
'%7d' +
'&entityId=%7b' +
d.entityId +
'%7d';
;
if (d.attributeId !== ""){
url = url + '&attributeId=%7b' + d.attributeId + '%7d';
}
var win = window.open(url, '_blank');
win.focus();
$(this)[0].setValue("");
}
var renderTemplate =
"<div>\
<B>{entitySchema}:</B> {attrSchema} <br>\
<small><B>{entityLabel}:</B> {attrLabel}</small> \
</div>"
}
function publishSolution(){
SDK.PUBLISH.PublishAllXmlRequest();
$('#publishSpinner').show();
}
function downloadMetadataButton(){
$('#waiting').show();
localStorage.data = "data"
localStorage.solutionId = "solutionId"
downloadMetadata();
}
function reloadMetadataButton(){
localStorage.removeItem('data');
localStorage.removeItem('solutionId');
onStartUp();
}
$('.solutionPick').click( function (element) {
$('#solutionDropdown').html(element.target.text + ' <span class="caret"></span>');
}
);
$(".spinner").load('.\\lib_\\thr_spinner.html');
// Page Counter
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-77032343-1', 'auto');
ga('send', 'pageview');