aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpacien2018-10-17 22:25:45 +0200
committerpacien2018-10-17 22:25:45 +0200
commite23180d4d6d6a697666aa8378ee45cb5f1c39e72 (patch)
treeb30c5aacb9aa93408f6fe7cd158d6ad61421c83c /src
parent7f7d4d1cb5929650edf162c5d8c771ca35e4a77a (diff)
downloadjacoco-viewer-e23180d4d6d6a697666aa8378ee45cb5f1c39e72.tar.gz
Add support for groups
Diffstat (limited to 'src')
-rw-r--r--src/Report.js18
-rw-r--r--src/listComponents.js43
2 files changed, 58 insertions, 3 deletions
diff --git a/src/Report.js b/src/Report.js
index ac7dfac..955c97d 100644
--- a/src/Report.js
+++ b/src/Report.js
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20import React, { Component } from 'react'; 20import React, { Component } from 'react';
21import { Counters, SessionInfo, PackagesCoverage, PackagesSourceCoverage } from './listComponents.js'; 21import { Counters, SessionInfo, GroupsCoverage, PackagesCoverage, GroupsSourceCoverage, PackagesSourceCoverage } from './listComponents.js';
22 22
23export class Report extends Component { 23export class Report extends Component {
24 _renderAppInfo() { 24 _renderAppInfo() {
@@ -37,6 +37,18 @@ export class Report extends Component {
37 ); 37 );
38 } 38 }
39 39
40 _renderCoverageTree() {
41 return this.props.report.group
42 ? (<GroupsCoverage groups={this.props.report.group} />)
43 : (<PackagesCoverage packages={this.props.report.package} />);
44 }
45
46 _renderSourceCoverage() {
47 return this.props.report.group
48 ? (<GroupsSourceCoverage groups={this.props.report.group} sourceSet={this.props.sourceSet} />)
49 : (<PackagesSourceCoverage packages={this.props.report.package} sourceSet={this.props.sourceSet} />);
50 }
51
40 _renderReport() { 52 _renderReport() {
41 return ( 53 return (
42 <div> 54 <div>
@@ -54,12 +66,12 @@ export class Report extends Component {
54 66
55 <section> 67 <section>
56 <h3>Coverage tree</h3> 68 <h3>Coverage tree</h3>
57 <PackagesCoverage packages={this.props.report.package} /> 69 {this._renderCoverageTree()}
58 </section> 70 </section>
59 71
60 <section> 72 <section>
61 <h3>Source coverage</h3> 73 <h3>Source coverage</h3>
62 <PackagesSourceCoverage packages={this.props.report.package} sourceSet={this.props.sourceSet} /> 74 {this._renderSourceCoverage()}
63 </section> 75 </section>
64 </div> 76 </div>
65 ); 77 );
diff --git a/src/listComponents.js b/src/listComponents.js
index a09abd9..2d89ac3 100644
--- a/src/listComponents.js
+++ b/src/listComponents.js
@@ -49,6 +49,28 @@ export class Counters extends Component {
49 } 49 }
50} 50}
51 51
52export class GroupsCoverage extends Component {
53 _renderChilds(row) {
54 return row.group
55 ? (<GroupsCoverage groups={row.group} />)
56 : (<PackagesCoverage packages={row.package} />);
57 }
58
59 _renderRow(row) {
60 return (
61 <li key={row.$.name}>
62 <span>{row.$.name}</span>
63 <Counters data={row.counter} inlineList="true" />
64 {this._renderChilds(row)}
65 </li>
66 )
67 }
68
69 render() {
70 return renderRows(row => this._renderRow(row), this.props.groups, false);
71 }
72}
73
52export class PackagesCoverage extends Component { 74export class PackagesCoverage extends Component {
53 _renderRow(row) { 75 _renderRow(row) {
54 return ( 76 return (
@@ -99,6 +121,27 @@ class MethodsCoverage extends Component {
99 } 121 }
100} 122}
101 123
124export class GroupsSourceCoverage extends Component {
125 _renderChilds(row) {
126 return row.group
127 ? (<GroupsSourceCoverage groups={row.group} sourceSet={this.props.sourceSet} />)
128 : (<PackagesSourceCoverage packages={row.package} sourceSet={this.props.sourceSet} />);
129 }
130
131 _renderRow(row) {
132 return (
133 <li key={row.$.name}>
134 <span>{row.$.name}</span>
135 {this._renderChilds(row)}
136 </li>
137 )
138 }
139
140 render() {
141 return renderRows(row => this._renderRow(row), this.props.groups, false);
142 }
143}
144
102export class PackagesSourceCoverage extends Component { 145export class PackagesSourceCoverage extends Component {
103 _renderRow(row) { 146 _renderRow(row) {
104 return ( 147 return (