From b418e12b7b06ae79642ab26e021e7c9a0f17e275 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 11 Oct 2018 00:03:49 +0200 Subject: Rename non-class file --- src/listComponents.js | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 src/listComponents.js (limited to 'src/listComponents.js') diff --git a/src/listComponents.js b/src/listComponents.js new file mode 100644 index 0000000..f830538 --- /dev/null +++ b/src/listComponents.js @@ -0,0 +1,135 @@ +/* + * 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); + } +} -- cgit v1.2.3