Enhance APStats

This commit is contained in:
Laurent Destailleur 2023-09-22 04:59:32 +02:00
parent a899a0e01c
commit a68b00de4e

View file

@ -174,9 +174,11 @@ foreach (array('proj', 'dep') as $source) {
* View
*/
$html = '<html>';
$html .= '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />';
$html .= '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>';
$html = '<html>'."\n";
$html .= '<meta charset="utf-8">'."\n";
$html .= '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n";
$html .= '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha512-q3eWabyZPc1XTCmF+8/LuE1ozpg5xxn7iO89yfSOd5/oKvyqLngoNGsx8jq92Y8eXJ/IRxQbEC+FGSYxtk2oiw==" crossorigin="anonymous" referrerpolicy="no-referrer" />'."\n";
$html .= '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js" integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>'."\n";
$html .= '
<style>
body {
@ -218,6 +220,9 @@ th,td {
.right {
text-align: right;
}
.nowrap {
white-space: nowrap;
}
.opacity {
opacity: 0.5;
}
@ -253,7 +258,34 @@ th,td {
background-color: #664488;
color: #FFF;
}
</style>';
div.fiche>form>div.div-table-responsive {
min-height: 392px;
}
div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive-no-min {
overflow-x: auto;
}
.div-table-responsive {
line-height: 120%;
}
.div-table-responsive, .div-table-responsive-no-min {
overflow-x: auto;
min-height: 0.01%;
}
/* Force values for small screen 767 */
@media only screen and (max-width: 767px)
{
body {
margin: 5px;
margin-left: 5px;
margin-right: 5px;
}
}
</style>'."\n";
$html .= '<body>'."\n";
@ -265,6 +297,8 @@ $html .= '</header>'."\n";
$html .= '<section class="chapter">'."\n";
$html .= '<h2>Lines of code</h2>'."\n";
$html .= '<div class="div-table-responsive">'."\n";
$html .= '<table class="centpercent">';
$html .= '<tr class="loc">';
$html .= '<th class="left">Language</td>';
@ -290,20 +324,20 @@ foreach (array('proj', 'dep') as $source) {
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Blanks']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Comments']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics[$source]['Code']).'</td>';
$html .= '<td>TODO graph here...</td>';
$html .= '<td></td>';
$html .= '</tr>';
if (!empty($arrayoflineofcode[$source])) {
foreach ($arrayoflineofcode[$source] as $key => $val) {
$html .= '<tr class="loc hidden source'.$source.' language'.str_replace(' ', '', $key).'">';
$html .= '<td>'.$key.'</td>';
$html .= '<td class="right"></td>';
$html .= '<td class="right">'.(empty($val['Files']) ? '' : formatNumber($val['Files'])).'</td>';
$html .= '<td class="right">'.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).'</td>';
$html .= '<td class="right">'.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).'</td>';
$html .= '<td class="right">'.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).'</td>';
$html .= '<td class="right">'.(empty($val['Code']) ? '' : formatNumber($val['Code'])).'</td>';
$html .= '<td class="right nowrap">'.(empty($val['Files']) ? '' : formatNumber($val['Files'])).'</td>';
$html .= '<td class="right nowrap">'.(empty($val['Lines']) ? '' : formatNumber($val['Lines'])).'</td>';
$html .= '<td class="right nowrap">'.(empty($val['Blanks']) ? '' : formatNumber($val['Blanks'])).'</td>';
$html .= '<td class="right nowrap">'.(empty($val['Comments']) ? '' : formatNumber($val['Comments'])).'</td>';
$html .= '<td class="right nowrap">'.(empty($val['Code']) ? '' : formatNumber($val['Code'])).'</td>';
//$html .= '<td class="right">'.(empty($val['Complexity']) ? '' : $val['Complexity']).'</td>';
$html .= '<td>TODO graph here...</td>';
$html .= '<td class="nowrap">TODO graph here...</td>';
$html .= '</tr>';
}
}
@ -311,16 +345,17 @@ foreach (array('proj', 'dep') as $source) {
$html .= '<tr class="trgroup">';
$html .= '<td class="left">Total</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Bytes'] + $arrayofmetrics['dep']['Bytes']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Files'] + $arrayofmetrics['dep']['Files']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Lines'] + $arrayofmetrics['dep']['Lines']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Blanks'] + $arrayofmetrics['dep']['Blanks']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Comments'] + $arrayofmetrics['dep']['Comments']).'</td>';
$html .= '<td class="right">'.formatNumber($arrayofmetrics['proj']['Code'] + $arrayofmetrics['dep']['Code']).'</td>';
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Bytes'] + $arrayofmetrics['dep']['Bytes']).'</td>';
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Files'] + $arrayofmetrics['dep']['Files']).'</td>';
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Lines'] + $arrayofmetrics['dep']['Lines']).'</td>';
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Blanks'] + $arrayofmetrics['dep']['Blanks']).'</td>';
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Comments'] + $arrayofmetrics['dep']['Comments']).'</td>';
$html .= '<td class="right nowrap">'.formatNumber($arrayofmetrics['proj']['Code'] + $arrayofmetrics['dep']['Code']).'</td>';
//$html .= '<td>'.$arrayofmetrics['Complexity'].'</td>';
$html .= '<td></td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '</div>';
$html .= '</section>'."\n";
@ -338,7 +373,7 @@ $html .= '</section>'."\n";
$html .= '<section class="chapter">'."\n";
$html .= '<h2>Technical debt ('.count($output_arrtd).')</h2><br>'."\n";
$html .= '<div class="list_technical_debt">'."\n";
$html .= '<div class="div-table-responsive">'."\n";
$html .= '<table class="list_technical_debt">'."\n";
$html .= '<tr><td>File</td><td>Line</td><td>Type</td></tr>'."\n";
foreach ($output_arrtd as $line) {