source: XIOS/trunk/html/generate_test_table.js @ 1821

Last change on this file since 1821 was 1790, checked in by yushan, 4 years ago

trunk : add html scripts

File size: 16.4 KB
Line 
1var dict = {"-1": "❌", "0": "❎", "1": "✅"}
2
3// var bg_color = ["#84c5ff", "#96cdff", "#a1d3ff", "#b3dafd", "#c2e1fd"]
4
5function generateTestTable()
6{
7  var machine_list=[];
8  var machine_revision_list=[];
9  var machine_full_name_list=[];
10  var machine_info_list=[];
11
12  if(typeof test_jeanzay_revision_list != 'undefined') 
13  {
14    machine_list.push("jeanzay");
15    machine_revision_list.push("test_jeanzay_revision_list")
16    machine_full_name_list.push("Jean-Zay")
17    machine_info_list.push("test_jeanzay_info_list")
18  }
19 
20  if (typeof test_irene_revision_list != 'undefined') 
21  {
22    machine_list.push("irene");
23    machine_revision_list.push("test_irene_revision_list")
24    machine_full_name_list.push("Irene")
25    machine_info_list.push("test_irene_info_list")
26  }
27 
28  if (typeof test_other_revision_list != 'undefined') 
29  {
30    machine_list.push("other");
31    machine_revision_list.push("test_other_revision_list")
32    machine_full_name_list.push("Other")
33    machine_info_list.push("test_other_info_list")
34  }
35
36  var revision_list=[]
37
38  for (var i=0; i<machine_list.length; i++)
39  {
40    tmp_list = eval(machine_revision_list[i])
41
42    for (var j=0; j<tmp_list.length; j++)
43    {
44      if (revision_list.includes(tmp_list[j]) == false)
45      {
46        revision_list.push(tmp_list[j])
47      }
48    }
49  }
50
51  revision_list.sort(function(a, b){return b-a});
52 
53 
54  // Generate select list for compile table
55
56  var sel = document.getElementById("test_revision");
57  for (var i=0; i<revision_list.length; i++)
58  {
59    var opt = document.createElement('option');
60    opt.appendChild( document.createTextNode(revision_list[i]) );
61    opt.value = revision_list[i]; 
62    sel.appendChild(opt); 
63  }
64 
65  // Generate content of compile table
66 
67  var table = document.getElementById("test_table")
68  table.style.backgroundColor = "#84c5ff";
69  table.setAttribute("class", "test_table")
70  table.setAttribute("id", "test_table")
71
72  var titelRow = document.getElementById("test_table_row0")
73  var myCell = document.createElement("TD");
74  myCell.style.minWidth="150px"
75  myCell.style.maxWidth="150px"
76  myCell.innerHTML = ("Revision");
77  titelRow.appendChild(myCell)
78
79  for (var machine_index=0; machine_index<machine_list.length; machine_index++)
80  {
81    var myCell = document.createElement("TD");
82    myCell.style.minWidth="50px"
83    myCell.innerHTML = (machine_full_name_list[machine_index]);
84    titelRow.appendChild(myCell)
85  }
86
87  for (var i=0; i<revision_list.length; i++)
88  {
89    var revision = revision_list[i]
90
91    var myRow = document.createElement("TR");
92    myRow.setAttribute("id", "test_table_"+revision);
93    myRow.setAttribute("class", "test_table_row");
94   
95    var myCell = document.createElement("TD");
96    myCell.innerHTML = (revision);
97    myCell.style.fontWeight = "bold";
98    myRow.appendChild(myCell)
99   
100    for( var j=0; j<machine_list.length; j++)
101    {
102      var machine = machine_list[j]
103      var myCell = document.createElement("TD");
104      myCell.setAttribute("id", "test_table_"+revision+"_"+machine);
105      myRow.appendChild(myCell)
106      myRow.appendChild(myCell)
107    }       
108    table.appendChild(myRow)
109  }
110
111  for (var i=0; i<revision_list.length; i++)
112  {
113    var revision = revision_list[i]
114    for (var j=0; j<machine_list.length; j++)
115    {
116      var machine = machine_list[j]
117      var has_test_info=false
118      tmp_info = eval(machine_info_list[j])
119      for (var k=0; k<eval(machine_info_list[j]).length; k++)
120      {
121        target_info = tmp_info[k]
122        if (target_info[0] == revision && target_info[1] == machine)
123        {
124          fillSubTestTable(revision, machine, target_info[2], target_info[3], target_info[4], target_info[5], target_info[6], target_info[7])
125          has_test_info = true
126        }
127      }
128      if (!has_test_info)
129      {
130        console.log("revision ",revision, "machine ",machine," has no test information")
131        var myTD = document.getElementById("test_table_"+revision+"_"+machine);
132        myTD.innerHTML = "No Test Information"
133        myTD.style.color = "white"
134      }
135    }
136  }
137  update_status()
138}
139
140function fillSubTestTable(revision, machine, build_dir, branch_name, machine_name, arch_name, mode_name, full_dir)
141{
142  var info_list = eval("test_"+machine+"_"+revision+"_"+build_dir.replace("build_",""))
143
144  var myTD = document.getElementById("test_table_"+revision+"_"+machine);
145  var mySubTable = document.createElement("table")
146  myTD.appendChild(mySubTable)
147  mySubTable.style.minWidth="200px"
148  mySubTable.setAttribute("class", "test_sub_table")
149  mySubTable.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir)
150
151  myRow = document.createElement("tr")
152  myRow.setAttribute("id","test_sub_table_row_"+revision+"_"+machine+"_"+build_dir)
153  myRow.setAttribute("class","test_sub_table_row_"+revision+"_"+machine)
154  myRow.classList.add("build_level")
155  myCell = document.createElement("td")
156  myCell.innerHTML = build_dir.replace("build_","")
157  myCell.onclick=function() {mytoggle("test_sub_table_"+revision+"_"+machine+"_"+build_dir)}
158  myRow.appendChild(myCell)
159  mySubTable.append(myRow)
160
161  myCell = document.createElement("td")
162  myCell_1 = document.createElement("div")
163  myCell_1.setAttribute("class", "dropdown")
164  myCell_2 = document.createElement("button")
165  myCell_2.onclick = function() {show_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_dropdown")}
166  myCell_2.onmouseleave = function() {hide_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_dropdown")}
167  myCell_2.innerHTML=("&#128270;")
168  myCell_3 = document.createElement("div")
169  myCell_3.setAttribute("class", "dropdown-content")
170  myCell_3.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_dropdown")
171  myCell_4 = document.createElement("a")
172  myCell_4.innerHTML = ("show plein report")
173  myCell_4.onclick = function() {show_plein_report(machine, revision, build_dir)}
174  myCell_5 = document.createElement("a")
175  myCell_5.innerHTML = ("show xios info")
176  myCell_5.onclick = function() {show_text("<table><tr><td>Branch</td><td><em>"+branch_name+"</em></td></tr><tr><td>Revision</td><td><em>"+revision+"</em></td></tr><tr><td>Machine</td><td><em>"+machine_name+"</em></td></tr><tr><td>Architecture</td><td><em>"+arch_name+"</em></td></tr><tr><td>Compile mode</td><td><em>"+mode_name+"</em></td></tr><tr><td>Full build directory</td><td><em>"+full_dir+"</em></td></tr><tr><td>Short build directory</td><td><em>"+build_dir+"</em></td></tr></table>")}
177  myCell_2.appendChild(myCell_3)
178  myCell_3.appendChild(myCell_4)
179  myCell_3.appendChild(myCell_5)
180  myCell_1.appendChild(myCell_2)
181  myCell.appendChild(myCell_1)
182  myRow.appendChild(myCell)
183
184  for (var i=0; i<2; i++)
185  {
186    myCell = document.createElement("td")
187    myRow.appendChild(myCell)
188  }
189
190  myCell = document.createElement("td")
191  myCell.setAttribute("class", "cell_to_update")
192  myCell.setAttribute("id","test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_status")
193  myCell.innerHTML = 1
194  myRow.appendChild(myCell)
195
196  for (var i=0; i<3; i++)
197  {
198    myCell = document.createElement("td")
199    myRow.appendChild(myCell)
200  }
201
202  var previous_status=["","","",""]
203  var current_status=info_list[0]
204  for(var i=0; i<info_list.length; i++)
205  {
206    current_status = info_list[i]
207    if (current_status[0] != previous_status[0])
208    {
209      create_rows(3, revision, machine, build_dir, current_status, full_dir)
210    }
211    else if (current_status[1] != previous_status[1])
212    {
213      create_rows(2, revision, machine, build_dir, current_status, full_dir)
214    }
215    else if (current_status[2] != previous_status[2])
216    {
217      create_rows(1, revision, machine, build_dir, current_status, full_dir)
218    }
219    previous_status = current_status
220  }
221
222
223}
224
225
226function create_rows(nb, revision, machine, build_dir, status, full_dir)
227{
228  tt = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir)
229  if(nb==3)
230  {
231    // algo level
232
233    myRow = document.createElement("tr")
234    myRow.setAttribute("class", "test_sub_table_"+revision+"_"+machine+"_"+build_dir)
235    myRow.classList.add('algo_level');
236    myRow.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0])
237    myRow.style.display = "none";
238    tt.appendChild(myRow)
239   
240   
241    myCell = document.createElement("td")
242    myRow.appendChild(myCell)
243
244
245    myCell = document.createElement("td")
246    myCell.innerHTML = status[0]
247    myCell.onclick=function() {mytoggle("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0])}
248    myRow.appendChild(myCell)
249
250    myCell = document.createElement("td")
251    myCell_1 = document.createElement("div")
252    myCell_1.setAttribute("class", "dropdown")
253    myCell_2 = document.createElement("button")
254    myCell_2.onclick = function() {show_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_dropdown")}
255    myCell_2.onmouseleave = function() {hide_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_dropdown")}
256    myCell_2.innerHTML=("&#128270;")
257    myCell_3 = document.createElement("div")
258    myCell_3.setAttribute("class", "dropdown-content")
259    myCell_3.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_dropdown")
260    myCell_4 = document.createElement("a")
261    myCell_4.innerHTML = ("show user_params.def")
262    myCell_4.onclick = function() {show_user_params(machine, revision, build_dir, status[0])}
263    myCell_5 = document.createElement("a")
264    myCell_5.innerHTML = ("show location")
265    myCell_5.onclick = function() {show_text(full_dir.replace(build_dir, "GENERIC_TESTCASE/")+status[0])}
266    myCell_2.appendChild(myCell_3)
267    myCell_3.appendChild(myCell_4)
268    myCell_3.appendChild(myCell_5)
269    myCell_1.appendChild(myCell_2)
270    myCell.appendChild(myCell_1)
271    myRow.appendChild(myCell)
272
273    for (var i=0; i<2; i++)
274    {
275      myCell = document.createElement("td")
276      myRow.appendChild(myCell)
277    }
278
279    myCell = document.createElement("td")
280    myCell.innerHTML = 1
281    myCell.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_status")
282    myCell.setAttribute("class", "cell_to_update")
283    myRow.appendChild(myCell)
284   
285    for (var i=0; i<2; i++)
286    {
287      myCell = document.createElement("td")
288      myRow.appendChild(myCell)
289    }
290  }
291
292  if(nb>=2)
293  {
294    // config level
295
296    myRow = document.createElement("tr")
297    myRow.setAttribute("class", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0])
298    myRow.classList.add("config_level")
299    myRow.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1])
300    myRow.style.display = "none";
301    tt.appendChild(myRow)
302   
303    for (var i=0; i<2; i++)
304    {
305      myCell = document.createElement("td")
306      myRow.appendChild(myCell)
307    }
308
309    myCell = document.createElement("td")
310    myCell.innerHTML = status[1]
311    myCell.onclick=function() {mytoggle("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1])}
312    myRow.appendChild(myCell)
313
314    myCell = document.createElement("td")
315    myCell_1 = document.createElement("div")
316    myCell_1.setAttribute("class", "dropdown")
317    myCell_2 = document.createElement("button")
318    myCell_2.onclick = function() {show_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_dropdown")}
319    myCell_2.onmouseleave = function() {hide_dropdown("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_dropdown")}
320    myCell_2.innerHTML=("&#128270;")
321    myCell_3 = document.createElement("div")
322    myCell_3.setAttribute("class", "dropdown-content")
323    myCell_3.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_dropdown")
324    myCell_4 = document.createElement("a")
325    myCell_4.innerHTML = ("show all_param.def")
326    myCell_4.onclick = function() {show_all_params(machine, revision, build_dir, status[0], status[1])}
327    myCell_5 = document.createElement("a")
328    myCell_5.innerHTML = ("show location")
329    myCell_5.onclick = function() {show_text(full_dir.replace(build_dir, "GENERIC_TESTCASE/")+status[0]+"/"+status[1])}
330    myCell_2.appendChild(myCell_3)
331    myCell_3.appendChild(myCell_4)
332    myCell_3.appendChild(myCell_5)
333    myCell_1.appendChild(myCell_2)
334    myCell.appendChild(myCell_1)
335    myRow.appendChild(myCell)
336
337
338    for (var i=0; i<2; i++)
339    {
340      myCell = document.createElement("td")
341      myRow.appendChild(myCell)
342    }
343
344    myCell = document.createElement("td")
345    myCell.innerHTML = 1
346    myCell.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_status")   
347    myCell.setAttribute("class", "cell_to_update")
348    myRow.appendChild(myCell)
349   
350    myCell = document.createElement("td")
351    myRow.appendChild(myCell)
352  }
353
354  // file level
355
356  myRow = document.createElement("tr")
357  myRow.setAttribute("class", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1])
358  myRow.classList.add("file_level")
359  myRow.setAttribute("id", "test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_"+status[2])
360  myRow.style.display = "none";
361  tt.appendChild(myRow)
362   
363  for (var i=0; i<3; i++)
364  {
365    myCell = document.createElement("td")
366    myRow.appendChild(myCell)
367  }
368
369  myCell = document.createElement("td")
370  myCell.innerHTML = status[2]
371  myRow.appendChild(myCell)
372
373  for (var i=0; i<3; i++)
374  {
375    myCell = document.createElement("td")
376    myRow.appendChild(myCell)
377  }
378
379  myCell = document.createElement("td")
380  myCell.setAttribute("class", "cell_to_update")
381  myCell.innerHTML = status[3]
382  myRow.appendChild(myCell)
383
384  var cell = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_"+status[1]+"_status")
385  cell.innerHTML = Math.min(cell.innerHTML, status[3])
386   
387  var cell = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_"+status[0]+"_status")
388  cell.innerHTML = Math.min(cell.innerHTML, status[3])
389
390  var cell = document.getElementById("test_sub_table_"+revision+"_"+machine+"_"+build_dir+"_status")
391  cell.innerHTML = Math.min(cell.innerHTML, status[3])
392
393}
394
395function update_status()
396{
397  var cells = document.getElementsByClassName("cell_to_update")
398  for (var i=0; i<cells.length; i++)
399  {
400    cells[i].innerHTML = dict[cells[i].innerHTML]
401  }
402}
403
404function mytoggle(classname)
405{
406  var myCells = document.getElementsByClassName(classname)
407  for (var i=0; i<myCells.length; i++)
408  {
409    var mySubCells = document.getElementsByClassName(myCells[i].id)
410    if (myCells[i].style.display=="table-row")
411    {
412      myCells[i].style.display="none" 
413      for(var j=0; j<mySubCells.length; j++)
414      {
415        mySubCells[j].style.display="none"
416        var mySubSubCells = document.getElementsByClassName(mySubCells[j].id)
417        for(var k=0; k<mySubSubCells.length; k++)
418        {
419          mySubSubCells[k].style.display="none"
420        }
421      }
422    }
423    else
424    {
425      myCells[i].style.display="table-row"
426    }
427  }
428}
429
430// function build_level_toggle(classname)
431// {
432//   var myCells = document.getElementsByClassName(classname)
433//   for (var i=0; i<myCells.length; i++)
434//   {
435//     var mySubCells = document.getElementsByClassName(myCells[i].id)
436//     if (myCells[i].style.display=="table-row")
437//     {
438//       myCells[i].style.display="none"
439//       for(var j=0; j<mySubCells.length; j++)
440//       {
441//         mySubCells[j].style.display="none"
442//         var mySubSubCells = document.getElementsByClassName(mySubCells[j].id)
443//         for(var k=0; k<mySubSubCells.length; k++)
444//         {
445//           mySubSubCells[k].style.display="none"
446//         }
447//       }
448//     }
449//     else
450//     {
451//       myCells[i].style.display="table-row"
452//     }
453//   }
454// }
455
456// function algo_level_toggle(classname)
457// {
458//   var myCells = document.getElementsByClassName(classname)
459//   for (var i=0; i<myCells.length; i++)
460//   {
461//     var mySubCells = document.getElementsByClassName(myCells[i].id)
462//     if (myCells[i].style.display=="table-row")
463//     {
464//       myCells[i].style.display="none"
465//       for(var j=0; j<mySubCells.length; j++)
466//       {
467//         mySubCells[j].style.display="none"
468//       }
469//     }
470//     else
471//     {
472//       myCells[i].style.display="table-row"
473//     }
474//   }
475// }
476
477// function config_level_toggle(classname)
478// {
479//   var myCells = document.getElementsByClassName(classname)
480//   for (var i=0; i<myCells.length; i++)
481//   {
482//     if (myCells[i].style.display=="table-row")
483//     {
484//       myCells[i].style.display="none"
485//     }
486//     else
487//     {
488//       myCells[i].style.display="table-row"
489//     }
490//   }
491// }
Note: See TracBrowser for help on using the repository browser.