-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add formatter parameter to csv-report (#137)
* Add formatter * Finalize formatting Bootstrap-table initalization now via javascript * Expand help text for csv-report formatting parameter * Update CHANGELOG.md * Update doc link in help text for formatter parameter of csv-report * Remove unused context * Update CHANGELOG.md Co-authored-by: Johannes Köster <[email protected]>
- Loading branch information
1 parent
2cb5a5b
commit f4deedb
Showing
9 changed files
with
84 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
$(document).ready(function() { | ||
$('.table-container').show(); | ||
$('.loading').hide(); | ||
$('#table').bootstrapTable( 'resetView' , {height: window.innerHeight - 200} ); | ||
$('.modal').on('shown.bs.modal', function () { | ||
window.dispatchEvent(new Event('resize')); | ||
}); | ||
var decompressed = JSON.parse(LZString.decompressFromUTF16(data)); | ||
|
||
{% if formatter %}var format = {{ formatter }}{% endif %} | ||
|
||
$('#table').bootstrapTable({ | ||
height: 510, | ||
columns: [{% for title in titles %}{ | ||
field: '{{ title }}', | ||
title: '{{ title }}\r\n <a class=\"sym\" data-toggle=\"modal\" data-target=\"#{{ title }}\" onclick=\"vegaEmbed(\'#plot_{{ loop.index0 }}\', plot_{{ loop.index0 }})\">\r\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 16 16\" class=\"bi bi-bar-chart-fill\" fill=\"currentColor\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n <rect width=\"4\" height=\"5\" x=\"1\" y=\"10\" rx=\"1\"\/>\r\n <rect width=\"4\" height=\"9\" x=\"6\" y=\"6\" rx=\"1\"\/>\r\n <rect width=\"4\" height=\"14\" x=\"11\" y=\"1\" rx=\"1\"\/>\r\n <\/svg>\r\n <\/a>\r\n <a class=\"sym\" data-toggle=\"modal\" data-target=\"#{{ title }}-search\">\r\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 16 16\" class=\"bi bi-search\" fill=\"currentColor\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\r\n <path fill-rule=\"evenodd\" d=\"M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z\"\/>\r\n <path fill-rule=\"evenodd\" d=\"M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z\"\/>\r\n <\/svg>\r\n <\/a>'{% if formatter %}, | ||
formatter: format["{{ title }}"]{% endif %} | ||
}{% if not loop.last %},{% endif %}{% endfor %}], | ||
data: [] | ||
}) | ||
|
||
let columns = [{% for title in titles %}"{{ title }}"{% if not loop.last %},{% endif %}{% endfor %}]; | ||
var table_rows = []; | ||
for (const r of decompressed) { | ||
var i = 0; | ||
row = {}; | ||
for (const el of r) { | ||
row[columns[i]] = el; | ||
i++; | ||
} | ||
table_rows.push(row); | ||
} | ||
$('#table').bootstrapTable('append', table_rows) | ||
let to_be_highlighted = window.location.href.toString().split("highlight=").pop(); | ||
let rows = $("table > tbody > tr"); | ||
rows.each(function() { | ||
if (this.dataset.index === to_be_highlighted) { | ||
$(this).children().addClass('active-row'); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters