/*
* JaCoCo Report Viewer, a web-based coverage report viewer
* Copyright (C) 2018 Pacien TRAN-GIRARD
* Adam NAILI
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
import React, { Component } from 'react';
import { CoverageListing } from './CoverageListing.js';
function renderRows(renderRowFunc, rows, inline) {
const renderedRows = rows ? rows.map(renderRowFunc) : (
None.);
return ();
}
export class SessionInfo extends Component {
_renderRow(row) {
const date = new Date(parseInt(row.start));
return ({row.id}: {date.toISOString()} ({row.dump - row.start} ms));
}
render() {
return renderRows(row => this._renderRow(row.$), this.props.data, false);
}
}
export class Counters extends Component {
_renderRow(row) {
const covered = parseInt(row.covered);
const totalCount = covered + parseInt(row.missed);
const wellCovered = covered === totalCount;
return ({row.type}: {covered}/{totalCount});
}
render() {
return renderRows(row => this._renderRow(row.$), this.props.data, this.props.inlineList !== undefined);
}
}
export class PackagesCoverage extends Component {
_renderRow(row) {
return (
{row.$.name}
)
}
render() {
return renderRows(this._renderRow, this.props.packages, false);
}
}
class ClassesCoverage extends Component {
_renderRow(row) {
const counters = row.counter.filter(counter => counter.$.type !== 'CLASS');
return (
{row.$.name}
)
}
render() {
return renderRows(this._renderRow, this.props.classes, false);
}
}
class MethodsCoverage extends Component {
_renderRow(row) {
const counters = row.counter.filter(counter => counter.$.type !== 'METHOD');
const method = row.$.name + row.$.desc + ':' + row.$.line;
return (
{method}
)
}
render() {
return renderRows(this._renderRow, this.props.methods, false);
}
}
export class PackagesSourceCoverage extends Component {
_renderRow(row) {
return (
{row.$.name}
)
}
render() {
return renderRows(row => this._renderRow(row), this.props.packages, false);
}
}
class SourcesCoverage extends Component {
_renderRow(row) {
const fileName = this.props.package + '/' + row.$.name;
return (
{fileName}
)
}
render() {
return renderRows(row => this._renderRow(row), this.props.packageSourceFiles, false);
}
}