This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMSPhedexBlockTestFiles.html
211 lines (196 loc) · 7.25 KB
/
CMSPhedexBlockTestFiles.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
<%inherit file="/module_base.html" />
<%def name="content()">
<script type="text/javascript">
$(function(){
function handle_ajax_response(data, table) {
$('#${module.instance_name}_spinner').remove();
if(data["status"] == "success") {
console.log(table);
console.log(data["data"].length);
console.log(data["data"][0]);
for(var i = 0; i < data["data"].length; i++) {
var row = data["data"][i];
var name = row["name"]
table.append("<tr class=\"report\"><td>"+row["block"]+"</td>"
+ "<td>"+row["fails"]+"</td>"
+ "<td>"+row["time_reported"]+"</td></tr>");
}
}
else {
// Todo: Give user some feedback
}
}
downloaded_additional_data_0 = false;
downloaded_additional_data_1 = false;
downloaded_additional_data_2 = false;
downloaded_additional_data_3 = false;
function ${module.instance_name}_toggle(filter, isfile) {
//0 = filtered, 1 = not filtered, 0=blocks, 1 = files
if(filter == 0 && isfile == 0 ){
$('#${module.instance_name}_blocks_filtered').toggle();
if(!downloaded_additional_data_0) {
downloaded_additional_data_0 = true;
var table = $('#${module.instance_name}_blocks_filtered table');
$.ajax("${module.ajaxUrl()}", {
error: function(jqXHR, textStatus, errorThrown) {
handle_ajax_response({"status": "error", "code": 0, "reason": errorThrown});
},
success: function(data, textStatus, jqXHR) {
handle_ajax_response(data, table);
},
dataType: "json",
data: {"filter":filter, "isfile":isfile}
});
}
}
else if(filter == 0 && isfile == 1 ){
$('#${module.instance_name}_files_filtered').toggle();
if(!downloaded_additional_data_1) {
downloaded_additional_data_1 = true;
var table = $('#${module.instance_name}_files_filtered table');
$.ajax("${module.ajaxUrl()}", {
error: function(jqXHR, textStatus, errorThrown) {
handle_ajax_response({"status": "error", "code": 0, "reason": errorThrown});
},
success: function(data, textStatus, jqXHR) {
handle_ajax_response(data, table);
},
dataType: "json",
data: {"filter":filter, "isfile":isfile}
});
}
}
else if(filter == 1 && isfile == 0 ){
$('#${module.instance_name}_blocks_out').toggle();
if(!downloaded_additional_data_2) {
downloaded_additional_data_2= true;
var table = $('#${module.instance_name}_blocks_out table');
$.ajax("${module.ajaxUrl()}", {
error: function(jqXHR, textStatus, errorThrown) {
handle_ajax_response({"status": "error", "code": 0, "reason": errorThrown});
},
success: function(data, textStatus, jqXHR) {
handle_ajax_response(data, table);
},
dataType: "json",
data: {"filter":filter, "isfile":isfile}
});
}
}
else if(filter == 1 && isfile == 1 ){
$('#${module.instance_name}_files_out').toggle();
if(!downloaded_additional_data_3) {
downloaded_additional_data_3 = true;
var table = $('#${module.instance_name}_files_out table');
$.ajax("${module.ajaxUrl()}", {
error: function(jqXHR, textStatus, errorThrown) {
handle_ajax_response({"status": "error", "code": 0, "reason": errorThrown});
},
success: function(data, textStatus, jqXHR) {
handle_ajax_response(data, table);
},
dataType: "json",
data: {"filter":filter, "isfile":isfile}
});
}
}
}
$('#${module.instance_name}_toggle_block').click(function(){
${module.instance_name}_toggle(0,0);
});
$('#${module.instance_name}_toggle_files').click(function(){
${module.instance_name}_toggle(0,1);
});
$('#${module.instance_name}_toggle_blocko').click(function(){
${module.instance_name}_toggle(1,0);
});
$('#${module.instance_name}_toggle_fileso').click(function(){
${module.instance_name}_toggle(1,1);
});
$('#${module.instance_name}_toggle_blocka').click(function(){
${module.instance_name}_toggle(0,0);
${module.instance_name}_toggle(1,0);
});
$('#${module.instance_name}_toggle_filesa').click(function(){
${module.instance_name}_toggle(0,1);
${module.instance_name}_toggle(1,1);
});
});
</script>
<form>
<table class='TableData'>
%if module.dataset['status'] == 0.5 or module.dataset['status'] == 0.1:
<b>The xml sourcefile is older than the warninglimit! Beware: shown information might not be correct</b>
%endif
%if module.dataset['status'] == -2:
<b>An error occured! According to the timestamp of the recently acquired data you traveled back in time...</b>
%endif
<hr>
<th>${module.dataset['instance']}</th>
<th>Request Time</th>
<th>Num. Failed Blocks</th>
<th>Num. Failed Files </th>
</hr>
<tr>
<th>filtered</th>
<td>${module.dataset['request_date']}</td>
<td>${module.dataset["failed_blocks"]}<input type="button" value="details" onfocus="this.blur()" id="${module.instance_name}_toggle_block" /></td>
<td>${module.dataset["failed_total_files"]}<input type="button" value="details" onfocus="this.blur()" id="${module.instance_name}_toggle_files" /></td>
</tr>
<tr>
<th>not filtered</th>
<td>${module.dataset['request_date']}</td>
<td>${module.dataset["failed_blocks_raw"]}<input type="button" value="details" onfocus="this.blur()" id="${module.instance_name}_toggle_blocko" /></td>
<td>${module.dataset["failed_total_files_raw"]}<input type="button" value="details" onfocus="this.blur()" id="${module.instance_name}_toggle_fileso" /></td>
</tr>
<tr>
<th>all blocks and files</th>
<td>${module.dataset['request_date']}</td>
<td>${module.dataset["failed_blocks_raw"] + module.dataset["failed_blocks"]}<input type="button" value="details" onfocus="this.blur()" id="${module.instance_name}_toggle_blocka" /></td>
<td>${module.dataset["failed_total_files_raw"] + module.dataset["failed_total_files"]}<input type="button" value="details" onfocus="this.blur()" id="${module.instance_name}_toggle_filesa" /></td>
</tr>
</table>
</form>
<div class="DetailedInfo" id="${module.instance_name}_blocks_filtered" style="display:none;">
<p id="${module.instance_name}_spinner">Loading contents of details table, this might take a few seconds...</br>
<img src="${hf.config.get("paths", "static_url")}/images/spinner.gif" />
</p>
<table class='TableData' >
<tr class="TableHeader">
<td>Block</td>
<td>Failed Files</td>
<td>Time reported</td>
</tr>
</table>
</div>
<div class="DetailedInfo" id="${module.instance_name}_files_filtered" style="display:none;">
<p id="${module.instance_name}_spinner">Loading contents of details table, this might take a few seconds...</br>
<img src="${hf.config.get("paths", "static_url")}/images/spinner.gif" />
</p>
<table class='TableData' >
<tr class="TableHeader">
<td>File</td>
<td>Blockref</td>
<td>Time reported</td>
</tr>
</table>
</div>
<div class="DetailedInfo" id="${module.instance_name}_blocks_out" style="display:none;">
<table class='TableData' >
<tr class="TableHeader">
<td>Block</td>
<td>Failed Files</td>
<td>Time reported</td>
</tr>
</table>
</div>
<div class="DetailedInfo" id="${module.instance_name}_files_out" style="display:none;">
<table class='TableData' >
<tr class="TableHeader">
<td>File</td>
<td>Blockref</td>
<td>Time reported</td>
</tr>
</table>
</div>
</%def>