implement feature and requirement details

This commit is contained in:
Jakob Ketterl
2019-07-05 22:31:46 +02:00
parent e61c0dcc12
commit 823a4a35f0
3 changed files with 126 additions and 28 deletions

View File

@ -1,6 +1,17 @@
<HTML><HEAD>
<TITLE>OpenWebRX Feature report</TITLE>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
<script src="static/jquery-3.2.1.min.js"></script>
<script src="static/features.js"></script>
</HEAD><BODY>
<h1>OpenWebRX Feature Report</h1>
<table class="features table">
<tr>
<th>Feature</th>
<th>Requirement</th>
<th>Description</th>
<th>Available</th>
</tr>
</table>
</BODY></HTML>

View File

@ -1,5 +1,24 @@
$(function(){
var converter = new showdown.Converter();
$.ajax('/api/features').done(function(data){
$('body').html(JSON.stringify(data));
$table = $('table.features');
$.each(data, function(name, details) {
requirements = $.map(details.requirements, function(r, name){
return '<tr>' +
'<td></td>' +
'<td>' + name + '</td>' +
'<td>' + converter.makeHtml(r.description) + '</td>' +
'<td>' + (r.available ? 'YES' : 'NO') + '</td>' +
'</tr>';
});
$table.append(
'<tr>' +
'<td colspan=2>' + name + '</td>' +
'<td>' + converter.makeHtml(details.description) + '</td>' +
'<td>' + (details.available ? 'YES' : 'NO') + '</td>' +
'</tr>' +
requirements.join("")
);
})
});
});