-
Notifications
You must be signed in to change notification settings - Fork 84
filter for test coverage #1549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
filter for test coverage #1549
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ | |
| <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> | ||
| <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js"> </script> | ||
| <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/fixedheader/3.1.5/css/fixedHeader.dataTables.min.css"> | ||
| <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js"></script> | ||
| <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.3.3/css/select.dataTables.min.css"> | ||
| <link rel="stylesheet" type="text/css" href="report.css"> | ||
| <script type="text/javascript" charset="utf8" src="report.js"></script> | ||
| </head> | ||
|
|
@@ -33,7 +35,50 @@ | |
| {% for tool in report %} | ||
| { "orderDataType": "test-status" }, | ||
| {% endfor %} | ||
| ] | ||
| ], | ||
| initComplete: function() { | ||
| this.api().columns([2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]).every(function() { | ||
| var column = this; | ||
| var select = $('<select><option value="Select"></option></select>') | ||
|
||
| .appendTo($(column.footer()).empty()) | ||
| .on('change', function() { | ||
| var array = [] | ||
| var val = $(this).val(); | ||
| if(val.length > 1){ | ||
| val = parseFloat(val.slice(0, -1)); | ||
| } else { | ||
| val = parseFloat(val); | ||
| } | ||
| column.data().each(function(d, j) { | ||
| output = d.split('/'); | ||
| tests_passed = output[0]; | ||
| total_tests = output[1]; | ||
| percentage = (tests_passed/total_tests)*100; | ||
|
|
||
| // 0 tests passed | ||
| if(tests_passed == val && tests_passed == 0 && tests_passed != ""){ | ||
| array.push(d); | ||
| } | ||
| // At least 1 test passed | ||
| else if(tests_passed >= val && val == 1){ | ||
| array.push(d); | ||
| } | ||
| // other cases | ||
| else if(percentage >= val && val > 1) { | ||
| array.push(d); | ||
| } | ||
| }); | ||
| array = array.join('|'); | ||
| column.search(array, true, false, true).draw(); | ||
| } ); | ||
| select.append('<option value="0">0</option>'); | ||
| select.append('<option value="1">1</option>'); | ||
| select.append('<option value="25%">25%</option>'); | ||
| select.append('<option value="50%">50%</option>'); | ||
| select.append('<option value="75%">75%</option>'); | ||
| select.append('<option value="100%">All</option>'); | ||
| } ); | ||
| } | ||
| }); | ||
| } ); | ||
| </script> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly does this do? do we have to have that list literal here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I listed them out to not have the dropdown for the tags (first 2 columns) but I'll see if this can be done in some other way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this will have to be changed whenever we add a new tool ? This sounds brittle. Can this be formulated as 'everything but the first two columns' instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is resolved in the latest commit. I'll also look into adding a separate JS file for the script. Thanks for the suggestions!