blockbugreport.html.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <table class='table table-form'>
  2. <?php foreach($charts as $chartType => $chartOption):?>
  3. <tr>
  4. <td class='text-top'>
  5. <table class='table table-condensed table-report' id='bugSeverityGroups'>
  6. <?php if(empty($datas[$chartType])):?>
  7. <tr>
  8. <td class='none-data'>
  9. <h5><?php echo $lang->testtask->report->charts[$chartType];?></h5>
  10. <?php echo $lang->testreport->none;?>
  11. </td>
  12. </tr>
  13. <?php else:?>
  14. <tr class='text-top'>
  15. <td class='w-p70'>
  16. <div class='chart-wrapper text-center'>
  17. <h5><?php echo $lang->testtask->report->charts[$chartType];?></h5>
  18. <div class='chart-canvas'><canvas id='chart-<?php echo $chartType ?>' width='<?php echo $chartOption->width;?>' height='<?php echo $chartOption->height;?>' data-responsive='true'></canvas></div>
  19. </div>
  20. </td>
  21. <td class='text-top'>
  22. <div class='table-wrapper' style='overflow:auto'>
  23. <table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='<?php echo $chartOption->type; ?>' data-target='#chart-<?php echo $chartType ?>' data-animation='false'>
  24. <thead>
  25. <tr>
  26. <th class='chart-label' colspan='2'><?php echo $lang->report->item;?></th>
  27. <th class='c-id'><?php echo $lang->report->value;?></th>
  28. <th class='c-id'><?php echo $lang->report->percent;?></th>
  29. </tr>
  30. </thead>
  31. <?php foreach($datas[$chartType] as $key => $data):?>
  32. <tr class='text-center'>
  33. <td class='chart-color'><i class='chart-color-dot'></i></td>
  34. <td class='chart-label'><?php echo $data->name;?></td>
  35. <td class='chart-value'><?php echo $data->value;?></td>
  36. <td><?php echo ($data->percent * 100) . '%';?></td>
  37. </tr>
  38. <?php endforeach;?>
  39. </table>
  40. </div>
  41. </td>
  42. </tr>
  43. <?php endif;?>
  44. </table>
  45. </td>
  46. </tr>
  47. <?php endforeach;?>
  48. <?php foreach($bugInfo as $infoKey => $infoValue):?>
  49. <tr>
  50. <td class='text-top'>
  51. <table class='table table-condensed table-report' id='bugStageGroups'>
  52. <?php if(empty($infoValue)):?>
  53. <tr>
  54. <td class='none-data'>
  55. <h5><?php echo $lang->testreport->$infoKey?></h5>
  56. <?php echo $lang->testreport->none;?>
  57. </td>
  58. </tr>
  59. <?php elseif($infoKey == 'bugStageGroups'):?>
  60. <tr class='text-top'>
  61. <td class='w-p70'>
  62. <div class='chart-wrapper text-center'>
  63. <h5><?php echo $lang->testreport->$infoKey?></h5>
  64. <div class='chart-canvas'>
  65. <?php if(isset($_POST["chart-{$infoKey}"])):?>
  66. <img src='<?php echo strip_tags($_POST["chart-{$infoKey}"])?>' />
  67. <?php else:?>
  68. <canvas id='chart-<?php echo $infoKey?>' width='90' height='20' data-responsive='true'></canvas>
  69. <?php endif;?>
  70. </div>
  71. </div>
  72. </td>
  73. <td class='text-top'>
  74. <div class='table-wrapper' style='overflow:auto'>
  75. <table class='table table-condensed table-hover table-striped table-bordered' data-chart='bar' data-target='#chart-<?php echo $infoKey?>' data-animation='false'>
  76. <thead>
  77. <tr>
  78. <th class='c-status'><?php echo $lang->bug->pri;?></th>
  79. <th class='c-id'><?php echo $lang->testreport->bugStageList['generated'];?></th>
  80. <th class='c-id'><?php echo $lang->testreport->bugStageList['legacy'];?></th>
  81. <th class='c-id'><?php echo $lang->testreport->bugStageList['resolved'];?></th>
  82. </tr>
  83. </thead>
  84. <?php foreach($lang->bug->priList as $key => $value):?>
  85. <tr class='text-center'>
  86. <td class='chart-color c-icon'><i class="chart-color-dot pri-<?php echo $key;?>"></i> <?php echo $key == 0 ? $lang->null : $value;?></td>
  87. <td class='chart-value'><?php echo $infoValue[$key]['generated'];?></td>
  88. <td class='chart-value'><?php echo $infoValue[$key]['legacy'];?></td>
  89. <td class='chart-value'><?php echo $infoValue[$key]['resolved'];?></td>
  90. </tr>
  91. <?php endforeach?>
  92. </table>
  93. </div>
  94. </td>
  95. </tr>
  96. <?php elseif($infoKey == 'bugHandleGroups'):?>
  97. <tr class='text-top'>
  98. <td class='w-p70'>
  99. <div class='chart-wrapper text-center'>
  100. <h5><?php echo $lang->testreport->$infoKey?></h5>
  101. <div class='chart-canvas'>
  102. <?php if(isset($_POST["chart-{$infoKey}"])):?>
  103. <img src='<?php echo strip_tags($_POST["chart-{$infoKey}"])?>' />
  104. <?php else:?>
  105. <canvas id='chart-<?php echo $infoKey?>' width='90' height='20' data-responsive='true'></canvas>
  106. <?php endif;?>
  107. </div>
  108. </div>
  109. </td>
  110. <td class='text-top'>
  111. <div class='table-wrapper' style='overflow:auto'>
  112. <table class='table table-condensed table-hover table-striped table-bordered' data-chart='line' data-target='#chart-<?php echo $infoKey?>' data-animation='false'>
  113. <thead>
  114. <tr>
  115. <th class='c-date'><?php echo $lang->testreport->date;?></th>
  116. <th class='c-id'><i class='chart-color-dot generated'></i> <?php echo $lang->testreport->bugStageList['generated'];?></th>
  117. <th class='c-id'><i class='chart-color-dot legacy'></i> <?php echo $lang->testreport->bugStageList['legacy'];?></th>
  118. <th class='c-id'><i class='chart-color-dot resolved'></i> <?php echo $lang->testreport->bugStageList['resolved'];?></th>
  119. </tr>
  120. </thead>
  121. <?php
  122. $beginTime = isset($report->begin) ? strtotime($report->begin) : strtotime($begin);
  123. $endTime = isset($report->end) ? strtotime($report->end) : strtotime($end);
  124. ?>
  125. <?php for($time = $beginTime; $time <= $endTime; $time += 86400):?>
  126. <?php $date = date('m-d', $time);?>
  127. <tr class='text-center'>
  128. <td class='chart-value'><?php echo $date?></td>
  129. <td class='chart-value'><?php echo $infoValue['generated'][$date];?></td>
  130. <td class='chart-value'><?php echo $infoValue['legacy'][$date];?></td>
  131. <td class='chart-value'><?php echo $infoValue['resolved'][$date];?></td>
  132. </tr>
  133. <?php endfor?>
  134. </table>
  135. </div>
  136. </td>
  137. </tr>
  138. <?php else:?>
  139. <?php $sum = 0; foreach($infoValue as $value) $sum += $value->value;?>
  140. <tr class='text-top'>
  141. <td class='w-p70'>
  142. <div class='chart-wrapper text-center'>
  143. <h5><?php echo $lang->testreport->$infoKey?></h5>
  144. <div class='chart-canvas'>
  145. <?php if(isset($_POST["chart-{$infoKey}"])):?>
  146. <img src='<?php echo strip_tags($_POST["chart-{$infoKey}"])?>' />
  147. <?php else:?>
  148. <canvas id='chart-<?php echo $infoKey?>' width='500' height='140' data-responsive='true'></canvas>
  149. <?php endif;?>
  150. </div>
  151. </div>
  152. </td>
  153. <td class='text-top'>
  154. <div class='table-wrapper' style='overflow:auto'>
  155. <table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='pie' data-target='#chart-<?php echo $infoKey?>' data-animation='false'>
  156. <thead>
  157. <tr>
  158. <th class='chart-label' colspan='2'><?php echo $lang->report->item;?></th>
  159. <th class='c-id'><?php echo $lang->report->value;?></th>
  160. <th class='c-id'><?php echo $lang->report->percent;?></th>
  161. </tr>
  162. </thead>
  163. <?php
  164. $list = $infoValue;
  165. if($infoKey == 'bugSeverityGroups') $list = $lang->bug->severityList;
  166. if($infoKey == 'bugStatusGroups') $list = $lang->bug->statusList;
  167. if($infoKey == 'bugResolutionGroups') $list = $lang->bug->resolutionList;
  168. ?>
  169. <?php foreach($list as $listKey => $listValue):?>
  170. <?php
  171. $label = $listValue;
  172. $data = 0;
  173. if(isset($infoValue[$listKey]))
  174. {
  175. $label = $infoValue[$listKey]->name;
  176. $data = $infoValue[$listKey]->value;
  177. }
  178. if(empty($label) and empty($data)) continue;
  179. ?>
  180. <?php $colorList = $infoKey == 'bugSeverityGroups' ? $config->bug->colorList->severity : array();?>
  181. <tr class='text-center' data-color="<?php echo !empty($colorList) ? zget($colorList, $label, '#C0C0C0') : '';?>">
  182. <td class='chart-color c-icon'><i class='chart-color-dot'></i></td>
  183. <td class='chart-label'><?php echo $label;?></td>
  184. <td class='chart-value'><?php echo $data;?></td>
  185. <td><?php echo round($data / $sum * 100, 2) . '%';?></td>
  186. </tr>
  187. <?php endforeach?>
  188. </table>
  189. </div>
  190. </td>
  191. </tr>
  192. <?php endif;?>
  193. </table>
  194. </td>
  195. </tr>
  196. <?php endforeach;?>
  197. </table>
  198. <?php js::set('bugStageList', $lang->testreport->bugStageList);?>
  199. <?php js::set('bugStageValueList', array_values($lang->testreport->bugStageList));?>
  200. <?php js::set('bugPriList', $lang->bug->priList);?>
  201. <?php js::set('zeroPri', $lang->null);?>
  202. <?php js::set('bugStageGroups', $bugInfo['bugStageGroups']);?>
  203. <?php js::set('bugHandleGroups', $bugInfo['bugHandleGroups']);?>
  204. <?php js::set('dateGroups', !empty($bugInfo['bugHandleGroups']) ? array_keys($bugInfo['bugHandleGroups']['generated']) : '');?>
  205. <?php js::set('priColorList', $config->bug->colorList->pri);?>
  206. <script>
  207. var priList = [];
  208. var stageList = [];
  209. var colorList = ['#d5d9df', '#d50000', '#ff9800', '#2098ee', '#009688'];
  210. var colorKey = 0;
  211. for(var key in bugPriList)
  212. {
  213. var currentColor = colorKey <= 7 ? priColorList[colorKey] : '#C0C0C0';
  214. $('.pri-' + key).css('background', currentColor);
  215. var priName = key == 0 ? zeroPri : bugPriList[key];
  216. var pri = {
  217. label: priName,
  218. color: currentColor,
  219. fillColor: currentColor,
  220. data: [bugStageGroups[key]['generated'], bugStageGroups[key]['legacy'], bugStageGroups[key]['resolved']]
  221. }
  222. priList.push(pri);
  223. colorKey++;
  224. }
  225. var data = {
  226. labels: bugStageValueList,
  227. datasets: priList,
  228. };
  229. var options = {responsive: true};
  230. var bugStageGroups = $('#chart-bugStageGroups').barChart(data, options);
  231. colorKey = 2;
  232. for(var key in bugHandleGroups)
  233. {
  234. $('.' + key).css('background', colorList[colorKey]);
  235. var stageName = bugStageList[key];
  236. var stage = {
  237. label: stageName,
  238. color: colorList[colorKey],
  239. data: bugHandleGroups[key]
  240. }
  241. stageList.push(stage);
  242. colorKey++;
  243. }
  244. var data = {
  245. labels: dateGroups,
  246. datasets: stageList,
  247. };
  248. var bugHandleGroups = $('#chart-bugHandleGroups').lineChart(data, options);
  249. </script>