-
Notifications
You must be signed in to change notification settings - Fork 0
/
partnersReport.html
276 lines (254 loc) · 9.52 KB
/
partnersReport.html
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
var partnerInfoArray;
var sortDirection = new Array();
function loadRemoteInfo(userName,password) {
var xmlhttp = new XMLHttpRequest();
var self=this;
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
const partnerInfo = JSON.parse(xmlhttp.responseText);
window.partnerInfoArray = Object.values(partnerInfo)
window.populateTable(partnerInfoArray);
for (var i = 0; i < partnerInfoArray[0].length; i++)
window.sortDirection[i] = -1;
}
else if( xmlhttp.status!= 200)
{
document.getElementById("MyHeader").innerHTML = "Bad Login";
}
console.log(xmlhttp);
return;
};
const url = "http://ubu3/partnerReport.php?userName="+encodeURIComponent(userName)+"&password="+encodeURIComponent(password);
xmlhttp.open("GET",url, true);
xmlhttp.send();
}
function populateTable(tableInfoArray)
{
var table = document.getElementById("TrendTable");
for(var i = 1;i< table.rows.length;)
table.deleteRow(i);
for (var i = 0 ; i < tableInfoArray.length ; i++)
{
var tableLineInfo=tableInfoArray[i];
var tr = table.insertRow(-1);
var tabCell = tr.insertCell(-1);
tabCell.innerHTML = i+1;
for (var j = 0; j < tableLineInfo.length; j++)
{
var tabCell = tr.insertCell(-1);
switch(j)
{
case 0:
const partnerId = tableLineInfo[j];
const url = "http://192.168.21.166:5601/app/kibana#/dashboard/bc11bce0-f092-11e7-996c-573762638943?_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:now-5y,mode:quick,to:now))&_a=(filters:!(),options:(darkTheme:!f),panels:!((col:7,id:a9b370d0-f087-11e7-bd44-df53f49f9bbe,panelIndex:3,row:4,size_x:6,size_y:3,type:visualization),(col:7,id:'34224430-f06a-11e7-a083-bf6f2deb126e',panelIndex:4,row:10,size_x:6,size_y:3,type:visualization),(col:1,id:'45bd9e20-f064-11e7-a784-e5fb0ea6c88d',panelIndex:5,row:7,size_x:6,size_y:3,type:visualization),(col:7,id:'0b983610-f064-11e7-a784-e5fb0ea6c88d',panelIndex:6,row:7,size_x:6,size_y:3,type:visualization),(col:1,id:'3bf2aa60-f092-11e7-9ca0-a33d89a7afb7',panelIndex:7,row:1,size_x:6,size_y:3,type:visualization),(col:7,id:a03d1aa0-f092-11e7-9ca0-a33d89a7afb7,panelIndex:8,row:1,size_x:6,size_y:3,type:visualization),(col:1,id:'29195230-f098-11e7-9b32-bbfe4122d785',panelIndex:9,row:4,size_x:6,size_y:3,type:visualization)),query:(query_string:(analyze_wildcard:!t,query:'partner_id:" + partnerId + "')),timeRestore:!f,title:'New%20-%20Kaltura%20Generic',uiState:(),viewMode:view)";
var a = document.createElement("a");
a.innerHTML = tableLineInfo[j];
a.setAttribute('href', url);
tabCell.appendChild(a);
break;
case 1:
tabCell.innerHTML = tableLineInfo[j];
if (tabCell.innerHTML < 0)
tabCell.style = "color:red;";
else
tabCell.style = "color:green;";
break;
case 2:
var line = tableLineInfo[j];
var a = document.createElement("a");
a.innerHTML = line[0];
tabCell.appendChild(a);
var refPoint = line[0];
for (var k = 1 ; k < line.length ; k++)
{
tabCell.innerHTML += ',';
a = document.createElement("a");
a.innerHTML = line[k];
tabCell.appendChild(a);
if (line[k] > refPoint)
a.style = "color:red;";
else
a.style = "color:green;";
refPoint = line[k];
}
break;
default:
tabCell.innerHTML = tableLineInfo[j];
break;
}
}
}
}
function order(columnIndex)
{
var direction = window.sortDirection[columnIndex];
window.sortDirection[columnIndex]*=-1;
partnerInfoArray.sort(function(a,b)
{ return direction*a[columnIndex] - direction*b[columnIndex];});
window.populateTable(partnerInfoArray);
}
function loadContent(userNameObject,passwordObject) {
document.getElementById('id01').style.display = 'none';
document.getElementById('loginButton').style.display = 'none';
document.getElementById('TrendTable').style.display = 'inline';
window.loadRemoteInfo(userNameObject.value,passwordObject.value);
}
</script>
<style>
th, td {
border: 1px solid black;
}
tr:hover {
font-weight : bolder;
}
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* Set a style for all buttons */
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
/* Extra styles for the cancel button */
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
/* Center the image and position the close button */
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
img.avatar {
width: 40%;
border-radius: 50%;
}
.container-modal {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* The Modal (background) */
.my-modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
padding-top: 60px;
}
/* Modal Content/Box */
.modal-content {
background-color: #fefefe;
margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */
}
/* The Close Button (x) */
.close {
position: absolute;
right: 25px;
top: 0;
color: #000;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
/* Add Zoom Animation */
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
@-webkit-keyframes animatezoom {
from {-webkit-transform: scale(0)}
to {-webkit-transform: scale(1)}
}
@keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
}
/* Change styles for span and cancel button on extra small screens */
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
</style>
<h1 id="MyHeader"></h1>
</head>
<table id="TrendTable" style='display:none'>
<tr>
<th >#</th>
<th ondblclick=order(0)>Id</th>
<th ondblclick=order(1)>Trend</th>
<th >Coordinates</th>
<th ondblclick=order(3) >Var</th>
<th ondblclick=order(4)>Ave</th>
<th ondblclick=order(5)>Med</th>
<th ondblclick=order(6) >Name</th>
<th ondblclick=order(7)>Email</th>
</tr>
</table>
<button id="loginButton" onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Login</button>
<div id="id01" class="my-modal">
<form class="modal-content animate" >
<!--div class="imgcontainer">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
<img src="img_avatar2.png" alt="Avatar" class="avatar">
</div>
-->
<div class="container-modal">
<label><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="username" required>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="button" onclick="loadContent(username,psw)">Login</button>
<input type="checkbox" checked="checked"> Remember me
</div>
<div class="container-modal" style="background-color:#f1f1f1">
<button type="button" onclick="" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</div>
</body>
</html>