diff options
14 files changed, 625 insertions, 670 deletions
diff --git a/non-puppet/qtmetrics2/index.php b/non-puppet/qtmetrics2/index.php index 8d77195..c17924b 100644 --- a/non-puppet/qtmetrics2/index.php +++ b/non-puppet/qtmetrics2/index.php @@ -34,20 +34,25 @@ /** * Qt Metrics API - * @version 0.3 - * @since 16-06-2015 + * @version 0.4 + * @since 18-06-2015 * @author Juha Sippola */ -require 'src/Factory.php'; -require 'lib/Slim/Slim/Slim.php'; +require_once 'src/Factory.php'; +require_once 'lib/Slim/Slim/Slim.php'; +require_once 'lib/Slim/Slim/View.php'; +require_once 'lib/Slim/Slim/Views/Twig.php'; +require_once 'lib/Twig/lib/Twig/Autoloader.php'; \Slim\Slim::registerAutoloader(); -$app = new \Slim\Slim(array( +Twig_Autoloader::register(); + +$app = new Slim\Slim(array( + 'view' => new Slim\Views\Twig(), 'templates.path' => 'templates' )); - /** * UI route: / (GET) */ @@ -55,7 +60,8 @@ $app = new \Slim\Slim(array( $app->get('/', function() use($app) { $ini = Factory::conf(); - $app->render('home.php', array( + $app->render('home.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'overviewRoute' => Slim\Slim::getInstance()->urlFor('root') . 'overview', 'branchRoute' => Slim\Slim::getInstance()->urlFor('root') . 'branch', 'platformRoute' => Slim\Slim::getInstance()->urlFor('root') . 'platform', @@ -82,7 +88,8 @@ $app->get('/test/top', function() use($app) $breadcrumb = array( array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) ); - $app->render('testsets_top.php', array( + $app->render('testsets_top.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset', 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', @@ -110,7 +117,8 @@ $app->get('/test/flaky', function() use($app) $breadcrumb = array( array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) ); - $app->render('testsets_flaky.php', array( + $app->render('testsets_flaky.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset', 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', @@ -136,20 +144,22 @@ $app->get('/testset/:testset', function($testset) use($app) array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')) ); if (Factory::checkTestset($testset)) { - $app->render('testset.php', array( + $app->render('testset.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', 'lastDaysFailures' => $ini['top_failures_last_days'], 'lastDaysFlaky' => $ini['flaky_testsets_last_days'], 'masterProject' => $ini['master_build_project'], 'masterState' => $ini['master_build_state'], - 'testset' => Factory::createTestset( + 'testsets' => Factory::createTestset( $testset, $ini['master_build_project'], $ini['master_build_state']) // managed as objects )); } else { - $app->render('empty.php', array( + $app->render('empty.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), 'message' => '404 Not Found' )); $app->response()->status(404); diff --git a/non-puppet/qtmetrics2/scripts/about.js b/non-puppet/qtmetrics2/scripts/about.js index 0762687..bf0ee54 100644 --- a/non-puppet/qtmetrics2/scripts/about.js +++ b/non-puppet/qtmetrics2/scripts/about.js @@ -34,11 +34,11 @@ /** * Show About window - * @version 0.1 - * @since 16-06-2015 + * @version 0.2 + * @since 18-06-2015 * @author Juha Sippola */ $(function(){ - $("#about").load("templates/about.php"); + $("#about").load("templates/about.html"); }); diff --git a/non-puppet/qtmetrics2/templates/about.php b/non-puppet/qtmetrics2/templates/about.html index 3f3df1e..c893598 100644 --- a/non-puppet/qtmetrics2/templates/about.php +++ b/non-puppet/qtmetrics2/templates/about.html @@ -1,4 +1,4 @@ -<?php +<!-- ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. @@ -34,14 +34,14 @@ /** * About window content - * @version 0.4 - * @since 17-06-2015 + * @version 0.5 + * @since 18-06-2015 * @author Juha Sippola */ -?> +--> <p>This is Qt Metrics revision 2 with redesigned UI and database.</p> <p>These pages are still <strong>under construction</strong> and therefore the views and functionality is limited.</p> <p>See the <a href="https://wiki.qt.io/Qt_Metrics_2_Backlog" target="_blank">backlog</a> for development items currently identified or in progress.</p> -<p><small>Version 0.4 (17-Jun-2015)</small></p> +<p><small>Version 0.5 (18-Jun-2015)</small></p> diff --git a/non-puppet/qtmetrics2/templates/close.php b/non-puppet/qtmetrics2/templates/close.html index 2ba16a6..d10ece1 100644 --- a/non-puppet/qtmetrics2/templates/close.php +++ b/non-puppet/qtmetrics2/templates/close.html @@ -1,4 +1,4 @@ -<?php +{# ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. @@ -34,12 +34,12 @@ /** * Tags to close html page - * @version 0.1 - * @since 02-06-2015 + * @version 0.2 + * @since 18-06-2015 * @author Juha Sippola */ -?> +#} </body> </html> diff --git a/non-puppet/qtmetrics2/templates/empty.php b/non-puppet/qtmetrics2/templates/empty.html index 5f3fcad..b3e6620 100644 --- a/non-puppet/qtmetrics2/templates/empty.php +++ b/non-puppet/qtmetrics2/templates/empty.html @@ -1,4 +1,4 @@ -<?php +{# ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. @@ -34,26 +34,20 @@ /** * Empty html file with a message (for invalid routes) - * @version 0.1 - * @since 02-06-2015 + * @version 0.2 + * @since 18-06-2015 * @author Juha Sippola */ -include 'header.php'; +#} -// Get input data -$message = $this->data['message']; +{% include "header.html" %} -echo "<h2>$message</h2>"; +<h2>{{ message }}</h2> -?> +{% include "footer.html" %} -<?php -include 'footer.php'; -?> +{# Local scripts for this page #} +{# (none) #} -<!-- Local scripts for this page --> - -<?php -include 'close.php'; -?> +{% include "close.html" %} diff --git a/non-puppet/qtmetrics2/templates/footer.php b/non-puppet/qtmetrics2/templates/footer.html index d460212..48705d5 100644 --- a/non-puppet/qtmetrics2/templates/footer.php +++ b/non-puppet/qtmetrics2/templates/footer.html @@ -1,4 +1,4 @@ -<?php +{# ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. @@ -34,12 +34,12 @@ /** * Footer section of html page including the scripts - * @version 0.2 - * @since 16-06-2015 + * @version 0.3 + * @since 18-06-2015 * @author Juha Sippola */ -?> +#} <hr> @@ -49,18 +49,18 @@ </footer> </div> - </div> <!-- /container --> + </div> {# /container #} - <!-- Scripts placed at the end of the document so the pages load faster - ======================================================================= --> + {# Scripts placed at the end of the document so the pages load faster + ======================================================================= #} - <!-- jQuery and Bootstrap --> + {# jQuery and Bootstrap #} <script src="lib/jQuery/jquery-1.11.3.min.js"></script> <script src="lib/jQuery-UI/jquery-ui.min.js"></script> <script src="lib/Bootstrap/js/bootstrap.min.js"></script> - <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + {# IE10 viewport hack for Surface/desktop Windows 8 bug #} <script src="scripts/ie10-viewport-bug-workaround.js"></script> - <!-- About window --> + {# About window #} <script src="scripts/about.js"></script> diff --git a/non-puppet/qtmetrics2/templates/header.php b/non-puppet/qtmetrics2/templates/header.html index 6b20508..87df0ef 100644 --- a/non-puppet/qtmetrics2/templates/header.php +++ b/non-puppet/qtmetrics2/templates/header.html @@ -1,4 +1,4 @@ -<?php +{# ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. @@ -34,12 +34,12 @@ /** * Header section of html page including the meta data and style sheets - * @version 0.2 - * @since 17-06-2015 + * @version 0.3 + * @since 18-06-2015 * @author Juha Sippola */ -?> +#} <!DOCTYPE html> <html lang="en"> @@ -47,33 +47,33 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> - <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + {# The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags #} <meta name="description" content="Qt Metrics"> <meta name="author" content="jusippol"> <link rel="icon" href="images/favicon.ico"> <title>Qt Metrics</title> - <!-- base directory for inclusions --> - <base href="<?php echo Slim\Slim::getInstance()->urlFor('root'); ?>" /> + {# base directory for inclusions #} + <base href={{ root }} /> - <!-- jQuery UI CSS --> + {# jQuery UI CSS #} <link rel="stylesheet" href="lib/jQuery-UI-themes/themes/smoothness/jquery-ui.css"> - <!-- Bootstrap core CSS --> + {# Bootstrap core CSS #} <link rel="stylesheet" href="lib/Bootstrap/css/bootstrap.min.css"> - <!-- Custom styles for the Bootstrap templates used --> + {# Custom styles for the Bootstrap templates used #} <link rel="stylesheet" href="styles/bootstrap_custom.css"> - <!-- Own styles --> + {# Own styles #} <link rel="stylesheet" href="styles/qtmetrics.css"> - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + {# HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries #} + {#[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> - <![endif]--> + <![endif]#} </head> <body> @@ -115,7 +115,7 @@ </div> </nav> - <!-- Modal for About --> + {# Modal for About #} <div class="modal fade" id="aboutModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> @@ -133,5 +133,5 @@ </div> </div> - <!-- Open the content (closed in close.php) --> + {# Open the content (closed in close.html) #} <div class="container"> diff --git a/non-puppet/qtmetrics2/templates/home.html b/non-puppet/qtmetrics2/templates/home.html new file mode 100644 index 0000000..ed41f70 --- /dev/null +++ b/non-puppet/qtmetrics2/templates/home.html @@ -0,0 +1,171 @@ +{# +############################################################################# +## +## Copyright (C) 2015 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the Quality Assurance module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +/** + * Home page + * @version 0.2 + * @since 18-06-2015 + * @author Juha Sippola + */ + +#} + +{% include "header.html" %} + +<div class="jumbotron"> + <div class="container"> + <div class="col-md-9"> + <h1>Qt Metrics <sup class="masterVersion">2</sup></h1> + </div> + <div class="col-md-3"> + <div class="well well-sm"> + <p>Data updated:</p> + {{ refreshed }} + </div> + </div> + </div> +</div> + +<div class="row"> + + <div class="col-md-6"> + <h2>Overview</h2> + <p>See the overview of the builds by projects across the latest branches:</p> + <div> + {% for state in states %} + <a class="btn btn-default btn-xs" disabled="disabled" href="{{ overviewRoute }}/{{ state.name }}" role="button">{{ state.name }}</a> + {% endfor %} + </div> + </div> + + <div class="col-md-6"> + <h2>Platforms</h2> + <p>See target platform status:</p> + <div> + {% set all_os = [] %} + {% for platform in platforms %} + {% set all_os = all_os|merge([platform.os]) %} + {% endfor %} + {# Remove duplicates #} + {% set os = [] %} + {% for name in all_os %} + {% if name not in os %} + {% set os = os|merge([name]) %} + {% endif %} + {% endfor %} + {% for name in os %} + <div class="btn-group"> + <button type="button" class="btn btn-default btn-xs dropdown-toggle" disabled="disabled" data-toggle="dropdown" aria-expanded="false">{{ name }}<span class="caret"></span></button> + <ul class="dropdown-menu textSmall" role="menu"> + {% for platform in platforms %} + {% if platform.os == name %} + <li><a href="{{ platformRoute }}/{{ os_name }}/{{ platform.os_version }}"> + {{ (platform.os_version is empty) ? '(no version)' : platform.os_version }} + </a></li> + {% endif %} + {% endfor %} + </ul> + </div> + {% endfor %} + </div> + </div> +</div> + +<div class="row"> + + <div class="col-md-6"> + <h2>Branches</h2> + <p>See branch status:</p> + <div> + {% for branch in branches %} + <a class="btn btn-default btn-xs" disabled="disabled" href="{{ branchRoute }}/{{ branch.name }}" role="button">{{ branch.name }}</a> + {% endfor %} + </div> + </div> + + <div class="col-md-4"> + <h2>Tests</h2> + <p>See top failure lists or single testset results:</p> + <div> + <a class="btn btn-default btn-xs" href="{{ testRoute }}/top" role="button">top failures</a> + <a class="btn btn-default btn-xs" href="{{ testRoute }}/flaky" role="button">flaky testsets</a> + </div> + <div> + <form class="form-horizontal" role="form" method="post"> + <div class="input-group input-group-sm"> + <input id="testsetInput" name="testsetInputValue" type="text" class="form-control" placeholder="testset name..."> + <span class="input-group-btn"> + <input id="testsetInputSubmit" name="testsetInputSubmit" type="submit" class="btn btn-default" value="Show"> + </span> + </div> {# /input-group #} + </form> + </div> + </div> +</div> + +<div class="row"> + + <div class="col-md-6"> + <h2>Projects</h2> + <p>See project status:</p> + <div> + {% for project in projects %} + {# Show button color based on project status (according to the latest build results) #} + {% if project.getStatus == constant('ProjectRun::RESULT_SUCCESS') %} + {% set buttonStatus = 'btn-success' %} + {% elseif project.getStatus == constant('ProjectRun::RESULT_FAILURE') %} + {% set buttonStatus = 'btn-danger' %} + {% else %} + {% set buttonStatus = 'btn-default' %} + {% endif %} + {# Show only valid projects #} + {% if project.getStatus != constant('ProjectRun::RESULT_EMPTY') %} + <a class="btn {{ buttonStatus }} btn-xs" disabled="disabled" href="{{ overviewRoute }}/state/{{ project.getName }}" role="button">{{ project.getName }}</a> + {% endif %} + {% endfor %} + </div> + </div> +</div> + +<br> +<div class="alert alert-danger" role="alert"> + <strong>Under construction!</strong> Only few subpages implemented at the moment (those buttons enabled). +</div> + +{% include "footer.html" %} + +{# Local scripts for this page #} +<script src="scripts/testset_autocomplete.js"></script> + +{% include "close.html" %} diff --git a/non-puppet/qtmetrics2/templates/home.php b/non-puppet/qtmetrics2/templates/home.php deleted file mode 100644 index 41f60ab..0000000 --- a/non-puppet/qtmetrics2/templates/home.php +++ /dev/null @@ -1,197 +0,0 @@ -<?php -############################################################################# -## -## Copyright (C) 2015 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the Quality Assurance module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# - -/** - * Home page - * @version 0.1 - * @since 02-06-2015 - * @author Juha Sippola - */ - -include 'header.php'; - -// Get input data -$overviewRoute = $this->data['overviewRoute']; -$branchRoute = $this->data['branchRoute']; -$platformRoute = $this->data['platformRoute']; -$testRoute = $this->data['testRoute']; -$refreshed = $this->data['refreshed']; -$states = $this->data['states']; -$branches = $this->data['branches']; -$projects = $this->data['projects']; -$platforms = $this->data['platforms']; - -?> - -<div class="jumbotron"> - <div class="container"> - <div class="col-md-9"> - <h1>Qt Metrics <sup class="masterVersion">2</sup></h1> - </div> - <div class="col-md-3"> - <div class="well well-sm"> - <p>Data updated:</p> - <?php - echo $refreshed; - ?> - </div> - </div> - </div> -</div> - -<div class="row"> - - <div class="col-md-6"> - <h2>Overview</h2> - <p>See the overview of the builds by projects across the latest branches:</p> - <div> - <?php - foreach ($states as $state) { - echo '<a class="btn btn-default btn-xs" disabled="disabled" href="' . $overviewRoute . '/' . $state['name'] . '" role="button">' . $state['name'] . '</a>'; - } - ?> - </div> - </div> - - <div class="col-md-6"> - <h2>Platforms</h2> - <p>See target platform status:</p> - <div> - <?php - $os = array(); - foreach ($platforms as $platform) { - $os[] = $platform['os']; - } - $os = array_unique($os); - foreach ($os as $os_name) { - echo '<div class="btn-group">'; - echo '<button type="button" class="btn btn-default btn-xs dropdown-toggle" disabled="disabled" data-toggle="dropdown" aria-expanded="false">'; - echo $os_name . ' <span class="caret"></span>'; - echo '</button>'; - echo '<ul class="dropdown-menu textSmall" role="menu">'; - foreach ($platforms as $platform) { - if ($platform['os'] == $os_name) { - echo '<li><a href="' . $platformRoute . '/' . $os_name . '/' . $platform['os_version'] . '">'; - echo (empty($platform['os_version']) ? '(no version)' : $platform['os_version']); - echo '</a></li>'; - } - } - echo '</ul>'; - echo '</div>'; - } - ?> - </div> - </div> -</div> - -<div class="row"> - - <div class="col-md-6"> - <h2>Branches</h2> - <p>See branch status:</p> - <div> - <?php - foreach ($branches as $branch) { - echo '<a class="btn btn-default btn-xs" disabled="disabled" href="' . $branchRoute . '/' . $branch['name'] . '" role="button">' . $branch['name'] . '</a>'; - } - ?> - </div> - </div> - - <div class="col-md-4"> - <h2>Tests</h2> - <p>See top failure lists or single testset results:</p> - <div> - <?php - echo '<a class="btn btn-default btn-xs" href="' . $testRoute . '/top' . '" role="button">top failures</a>'; - echo '<a class="btn btn-default btn-xs" href="' . $testRoute . '/flaky' . '" role="button">flaky testsets</a>'; - ?> - </div> - <div> - <form class="form-horizontal" role="form" method="post"> - <div class="input-group input-group-sm"> - <input id="testsetInput" name="testsetInputValue" type="text" class="form-control" placeholder="testset name..."> - <span class="input-group-btn"> - <?php - if (isset($_POST['testsetInputValue'])) - $testsetSelected = $_POST['testsetInputValue']; - echo '<input id="testsetInputSubmit" name="testsetInputSubmit" type="submit" class="btn btn-default" value="Show">'; - ?> - </span> - </div><!-- /input-group --> - </form> - </div> - </div> -</div> - -<div class="row"> - - <div class="col-md-6"> - <h2>Projects</h2> - <p>See project status:</p> - <div> - <?php - foreach ($projects as $project) { - // Show button color based on project status (according to the latest build results) - $buttonStatus = 'btn-default'; - if ($project->getStatus() == ProjectRun::RESULT_SUCCESS) - $buttonStatus = 'btn-success'; - if ($project->getStatus() == ProjectRun::RESULT_FAILURE) - $buttonStatus = 'btn-danger'; - // Show only valid projects - if ($project->getStatus() <> ProjectRun::RESULT_EMPTY) - echo '<a class="btn ' . $buttonStatus . ' btn-xs" disabled="disabled" - href="' . $overviewRoute . '/state/' . $project->getName() . '" - role="button">' . $project->getName() . '</a>'; - } - ?> - </div> - </div> -</div> - -<br> -<div class="alert alert-danger" role="alert"> - <strong>Under construction!</strong> Only few subpages implemented at the moment (those buttons enabled). -</div> - -<?php -include 'footer.php'; -?> - -<!-- Local scripts for this page --> -<script src="scripts/testset_autocomplete.js"></script> - -<?php -include 'close.php'; -?> diff --git a/non-puppet/qtmetrics2/templates/testset.html b/non-puppet/qtmetrics2/templates/testset.html new file mode 100644 index 0000000..c69e859 --- /dev/null +++ b/non-puppet/qtmetrics2/templates/testset.html @@ -0,0 +1,157 @@ +{# +############################################################################# +## +## Copyright (C) 2015 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the Quality Assurance module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +/** + * Testset page + * @version 0.3 + * @since 18-06-2015 + * @author Juha Sippola + */ + +#} + +{% include "header.html" %} + +{# testsets as Testset objects +/** + * @var Testset[] testsets + */ +#} + +{# Get the testset name #} +{% set testsetName = '' %} +{% for testset in testsets %} + {% set testsetName = testset.getName %} +{% endfor %} + +<ol class="breadcrumb"> + {% for link in breadcrumb %} + <li><a href="{{ link.link }}">{{ link.name }}</a></li> + {% endfor %} + <li class="active">{{ testsetName }}</li> +</ol> + +<div class="container-fluid"> + <div class="row"> + + <div class="col-sm-12 col-md-12 main"> + + <h1 class="page-header"> + {{ testsetName }} + <button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info"> + <span class="glyphicon glyphicon-info-sign"></span> + </button> + <small>{{ refreshed }}</small> + </h1> + + <div class="collapse" id="info"> + <div class="well infoWell"> + <span class="glyphicon glyphicon-info-sign"></span> <strong>Testset</strong><br> + <ul> + <li><strong>latest result</strong> shows the overall testset status based on the latest + <strong>{{ masterProject }} {{ masterState }}</strong> builds across all branches + (shows failed if failed in one or in several).</li> + <li><strong>failed</strong> count shows the number of <strong>{{ masterProject }} {{ masterState }}</strong> + builds where {{ testsetName }} failed during the last {{ lastDaysFailures }} days.</li> + <li><strong>flaky</strong> count shows the number of <strong>all</strong> builds where + {{ testsetName }} failed on the first run but, when rerun, it passed + (during the last {{ lastDaysFlaky }} days).</li> + </ul> + </div> + </div> + + <div class="panel-body"> + <div class="table-responsive"> + <table class="table table-striped"> + <thead> + <tr> + <th>testset</th> + <th class="showInLargeDisplay">project</th> + <th>latest result</th> + <th class="leftBorder center">failed <span class ="gray">(total)</span></th> + <th class="leftBorder center">flaky <span class ="gray">(total)</span></th> + </tr> + </thead> + <tbody> + {# Print testset(s) #} + {% for testset in testsets %} + <tr> + {# Testset name #} + <td>{{ testset.getName }}</td> + + {# Project name #} + <td class="showInLargeDisplay">{{ testset.getProjectName }}</td> + + {# Testset status according to the latest build results #} + {% if testset.getStatus == constant('testsetRun::RESULT_SUCCESS') %} + {% set resultIcon = 'glyphicon glyphicon-ok green' %} + {% elseif testset.getStatus == constant('testsetRun::RESULT_FAILURE') %} + {% set resultIcon = 'glyphicon glyphicon-remove red' %} + {% else %} + {% set resultIcon = '' %} + {% endif %} + <td><span class="spaceHorizontal {{ resultIcon }}"></span>{{ testset.getStatus }}</td> + + {# Show failed #} + {% set failed = testset.getTestsetResultCounts.failed %} + {% set passed = testset.getTestsetResultCounts.passed %} + {% set total = passed + failed %} + <td class="leftBorder center">{{ failed }}<span class ="gray"> ({{ total }})</span></td> + + {# Show flaky #} + {% set flaky = testset.getTestsetFlakyCounts.flaky %} + <td class="leftBorder center">{{ flaky }}<span class ="gray"> ({{ total }})</span></td> + </tr> + {% endfor %} + + </tbody> + </table> + </div> {# /table-responsive #} + </div> {# /panel-body #} + + </div> {# /col... #} + </div> {# /row #} +</div> {# /container-fluid #} + +<br> +<div class="alert alert-danger" role="alert"> + <strong>Under construction!</strong> +</div> + +{% include "footer.html" %} + +{# Local scripts for this page #} +{# (none) #} + +{% include "close.html" %} diff --git a/non-puppet/qtmetrics2/templates/testset.php b/non-puppet/qtmetrics2/templates/testset.php deleted file mode 100644 index e26a06a..0000000 --- a/non-puppet/qtmetrics2/templates/testset.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php -############################################################################# -## -## Copyright (C) 2015 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the Quality Assurance module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# - -/** - * Testset page - * @version 0.2 - * @since 11-06-2015 - * @author Juha Sippola - */ - -include 'header.php'; - -// Get input data -$breadcrumb = $this->data['breadcrumb']; -$refreshed = $this->data['refreshed']; -$lastDaysFailures = $this->data['lastDaysFailures']; -$lastDaysFlaky = $this->data['lastDaysFlaky']; -$masterProject = $this->data['masterProject']; -$masterState = $this->data['masterState']; -/** - * @var Testset[] $testsets - */ -$testsets = $this->data['testset']; - -?> - -<ol class="breadcrumb"> - <?php - foreach ($testsets as $test) { - $testset = $test; - } - foreach ($breadcrumb as $link) { - echo '<li><a href="' . $link['link'] . '">' . $link['name'] . '</a></li>'; - } - echo '<li class="active">' . $testset->getName() . '</li>'; - ?> -</ol> - -<div class="container-fluid"> - <div class="row"> - - <div class="col-sm-12 col-md-12 main"> - - <h1 class="page-header"> - <?php echo $testset->getName() ?> - <button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info"> - <span class="glyphicon glyphicon-info-sign"></span> - </button> - <small><?php echo $refreshed ?></small> - </h1> - - <div class="collapse" id="info"> - <div class="well infoWell"> - <span class="glyphicon glyphicon-info-sign"></span> <strong>Testset</strong><br> - <ul> - <li><strong>latest result</strong> shows the overall testset status based on the latest - <strong><?php echo "$masterProject $masterState" ?></strong> builds across all branches - (shows failed if failed in one or in several).</li> - <li><strong>failed</strong> count shows the number of <strong><?php echo "$masterProject $masterState" ?></strong> - builds where <?php echo $testset->getName() ?> failed during the last <?php echo $lastDaysFailures ?> days.</li> - <li><strong>flaky</strong> count shows the number of <strong>all</strong> builds where - <?php echo $testset->getName() ?> failed on the first run but, when rerun, it passed - (during the last <?php echo $lastDaysFlaky ?> days).</li> - </ul> - </div> - </div> - - <div class="panel-body"> - <div class="table-responsive"> - <table class="table table-striped"> - <thead> - <tr> - <th>testset</th> - <th class="showInLargeDisplay">project</th> - <th>latest result</th> - <th class="leftBorder center">failed <span class ="gray">(total)</span></th> - <th class="leftBorder center">flaky <span class ="gray">(total)</span></th> - </tr> - </thead> - <tbody> - <?php - // Calculate max result count for the bar - $maxCount = 1; - foreach ($testsets as $testset) { - if ($testset->getTestsetResultCounts()['passed'] + $testset->getTestsetResultCounts()['failed'] > $maxCount) - $maxCount = $testset->getTestsetResultCounts()['passed'] + $testset->getTestsetResultCounts()['failed']; - } - // Print testsets - foreach ($testsets as $testset) { - echo '<tr>'; - // Testset name - echo '<td>' . $testset->getName() . '</td>'; - // Project name - echo '<td class="showInLargeDisplay">' . $testset->getProjectName() . '</td>'; - // Testset status according to the latest build results - $resultIcon = ''; - if ($testset->getStatus() == testsetRun::RESULT_SUCCESS) - $resultIcon = 'glyphicon glyphicon-ok green'; - if ($testset->getStatus() == testsetRun::RESULT_FAILURE) - $resultIcon = 'glyphicon glyphicon-remove red'; - echo '<td><span class="spaceHorizontal ' . $resultIcon . '"></span>' . $testset->getStatus() . '</td>'; - // Show failed - $failed = $testset->getTestsetResultCounts()['failed']; - $passed = $testset->getTestsetResultCounts()['passed']; - $total = $passed + $failed; - echo '<td class="leftBorder center">' . $failed . '<span class ="gray"> (' . $total . ')</span></td>'; - // Show flaky - $flaky = $testset->getTestsetFlakyCounts()['flaky']; - echo '<td class="leftBorder center">' . $flaky . '<span class ="gray"> (' . $total . ')</span></td>'; - echo '</tr>'; - } - ?> - </tbody> - </table> - </div> <!-- /table-responsive --> - </div> <!-- /panel-body --> - - </div> <!-- /col... --> - </div> <!-- /row --> -</div> <!-- /container-fluid --> - -<br> -<div class="alert alert-danger" role="alert"> - <strong>Under construction!</strong> -</div> - -<?php -include 'footer.php'; -?> - -<!-- Local scripts for this page --> - -<?php -include 'close.php'; -?> diff --git a/non-puppet/qtmetrics2/templates/testsets_flaky.php b/non-puppet/qtmetrics2/templates/testsets_flaky.html index 847db1b..9baa9f2 100644 --- a/non-puppet/qtmetrics2/templates/testsets_flaky.php +++ b/non-puppet/qtmetrics2/templates/testsets_flaky.html @@ -1,4 +1,4 @@ -<?php +{# ############################################################################# ## ## Copyright (C) 2015 The Qt Company Ltd. @@ -34,36 +34,28 @@ /** * Flaky testsets page - * @version 0.1 - * @since 02-06-2015 + * @version 0.2 + * @since 18-06-2015 * @author Juha Sippola */ -include 'header.php'; +#} -// Flaky bar area size (px) -const BAR_AREA = 120; +{% include "header.html" %} -// Get input data -$breadcrumb = $this->data['breadcrumb']; -$testsetRoute = $this->data['testsetRoute']; -$refreshed = $this->data['refreshed']; -$topN = $this->data['topN']; -$lastDays = $this->data['lastDays']; -$sinceDate = $this->data['sinceDate']; +{# Failed/passed bar area size in px #} +{% set BAR_AREA = 120 %} + +{# testsets as Testset objects /** - * @var Testset[] $testsets + * @var Testset[] testsets */ -$testsets = $this->data['testsets']; - -?> +#} <ol class="breadcrumb"> - <?php - foreach ($breadcrumb as $link) { - echo '<li><a href="' . $link['link'] . '">' . $link['name'] . '</a></li>'; - } - ?> + {% for link in breadcrumb %} + <li><a href="{{ link.link }}">{{ link.name }}</a></li> + {% endfor %} <li class="active">flaky testsets</li> </ol> @@ -73,13 +65,13 @@ $testsets = $this->data['testsets']; <div class="col-sm-12 col-md-12 main"> <h1 class="page-header"> - <?php echo " Top $topN Flaky Testsets" ?> + Top {{ topN }} Flaky Testsets <button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info"> <span class="glyphicon glyphicon-info-sign"></span> </button> - <small><?php echo $refreshed ?></small> + <small>{{ refreshed }}</small> </h1> - <h3 class="sub-header"> <?php echo "Last $lastDays days <small>(since $sinceDate)</small>" ?> </h3> + <h3 class="sub-header">Last {{ lastDays }} days <small>(since {{ sinceDate }})</small></h3> <div class="collapse" id="info"> <div class="well infoWell"> @@ -87,7 +79,7 @@ $testsets = $this->data['testsets']; <ul> <li>Flaky testsets are those that fail on the first run but, when rerun, they pass.</li> <li><strong>flaky</strong> count shows the number of <strong>all</strong> builds where - the testset is flaky (during the last <?php echo $lastDays ?> days).</li> + the testset is flaky (during the last {{ lastDays }} days).</li> </ul> </div> </div> @@ -104,52 +96,52 @@ $testsets = $this->data['testsets']; </tr> </thead> <tbody> - <?php - // Calculate max result count for the bar - $maxCount = 0; - foreach ($testsets as $testset) { - if ($testset->getTestsetFlakyCounts()['flaky'] > $maxCount) - $maxCount = $testset->getTestsetFlakyCounts()['flaky']; - } - // Print testsets - foreach ($testsets as $testset) { - echo '<tr>'; - // Testset name - echo '<td><a href="' . $testsetRoute . '/' . $testset->getName() . '">' . - $testset->getName() . '</a></td>'; - // Project name - echo '<td>' . $testset->getProjectName() . '</td>'; - // Show results as numbers - $flaky = $testset->getTestsetFlakyCounts()['flaky']; - $total = $testset->getTestsetFlakyCounts()['total']; - echo '<td class="leftBorder center">' . $flaky . '<span class ="gray"> (' . $total . ')</span></td>'; - // Show results as bars (scaled to BAR_AREA px) - $flakyBar = floor((BAR_AREA/$maxCount) * $flaky); - if ($flaky > 0 and $flakyBar == 0) - $flakyBar = 1; - echo '<td class="center showInLargeDisplay">'; - echo '<div>'; - echo '<div class="floatLeft redBackground" style="width: ' . $flakyBar . 'px"> </div>'; - echo '</div>'; - echo '</td>'; - echo '</tr>'; - } - ?> + {# Calculate max result count for the bar #} + {% set maxCount = 1 %} + {% for testset in testsets %} + {% if testset.getTestsetFlakyCounts.flaky > maxCount %} + {% set maxCount = testset.getTestsetFlakyCounts.flaky %} + {% endif %} + {% endfor %} + + {# Print testsets #} + {% for testset in testsets %} + <tr> + {# Testset name #} + <td><a href="{{ testsetRoute }}/{{ testset.getName }}">{{ testset.getName }}</a></td> + + {# Project name #} + <td>{{ testset.getProjectName }}</td> + + {# Show results as numbers #} + {% set flaky = testset.getTestsetFlakyCounts.flaky %} + {% set total = testset.getTestsetFlakyCounts.total %} + <td class="leftBorder center">{{ flaky }}<span class ="gray"> ({{ total }})</span></td> + + {# Show results as bars (scaled to BAR_AREA px) #} + {% set flakyBar = ((BAR_AREA/maxCount)*flaky)|round(0, 'floor') %} + {% if (flaky > 0) and (flakyBar == 0) %} + {% set flakyBar = 1 %} + {% endif %} + <td class="center showInLargeDisplay"> + <div> + <div class="floatLeft redBackground" style="width: {{ flakyBar }}px"> </div> + </div> + </td> + </tr> + {% endfor %} </tbody> </table> - </div> <!-- /table-responsive --> - </div> <!-- /panel-body --> + </div> {# /table-responsive #} + </div> {# /panel-body #} - </div> <!-- /col... --> - </div> <!-- /row --> -</div> <!-- /container-fluid --> + </div> {# /col... #} + </div> {# /row #} +</div> {# /container-fluid #} -<?php -include 'footer.php'; -?> +{% include "footer.html" %} -<!-- Local scripts for this page --> +{# Local scripts for this page #} +{# (none) #} -<?php -include 'close.php'; -?> +{% include "close.html" %} diff --git a/non-puppet/qtmetrics2/templates/testsets_top.html b/non-puppet/qtmetrics2/templates/testsets_top.html new file mode 100644 index 0000000..aa2d864 --- /dev/null +++ b/non-puppet/qtmetrics2/templates/testsets_top.html @@ -0,0 +1,166 @@ +{# +############################################################################# +## +## Copyright (C) 2015 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the Quality Assurance module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL21$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 or version 3 as published by the Free +## Software Foundation and appearing in the file LICENSE.LGPLv21 and +## LICENSE.LGPLv3 included in the packaging of this file. Please review the +## following information to ensure the GNU Lesser General Public License +## requirements will be met: https://www.gnu.org/licenses/lgpl.html and +## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## As a special exception, The Qt Company gives you certain additional +## rights. These rights are described in The Qt Company LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## $QT_END_LICENSE$ +## +############################################################################# + +/** + * Top failures (testsets) page + * @version 0.3 + * @since 18-06-2015 + * @author Juha Sippola + */ + +#} + +{% include "header.html" %} + +{# Failed/passed bar area size in px #} +{% set BAR_AREA = 120 %} + +{# testsets as Testset objects +/** + * @var Testset[] testsets + */ +#} + +<ol class="breadcrumb"> + {% for link in breadcrumb %} + <li><a href="{{ link.link }}">{{ link.name }}</a></li> + {% endfor %} + <li class="active">top failures</li> +</ol> + +<div class="container-fluid"> + <div class="row"> + + <div class="col-sm-12 col-md-12 main"> + + <h1 class="page-header"> + Top {{ topN }} Failures + <button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info"> + <span class="glyphicon glyphicon-info-sign"></span> + </button> + <small>{{ refreshed }}</small> + </h1> + <h3 class="sub-header">Last {{ lastDays }} days <small>(since {{ sinceDate }})</small></h3> + + <div class="collapse" id="info"> + <div class="well infoWell"> + <span class="glyphicon glyphicon-info-sign"></span> <strong>Top failures</strong><br> + <ul> + <li>Lists testsets by number of <strong>{{ masterProject }} {{ masterState }}</strong> + builds where it failed during the last {{ lastDays }} days.</li> + <li><strong>latest result</strong> shows the overall testset status based on the latest + <strong>{{ masterProject }} {{ masterState }}</strong> builds across all branches + (shows failed if failed in one or in several).</li> + </ul> + </div> + </div> + + <div class="panel-body"> + <div class="table-responsive"> + <table class="table table-striped"> + <thead> + <tr> + <th>testset</th> + <th class="showInLargeDisplay">project</th> + <th>latest result</th> + <th class="leftBorder center">failed <span class ="gray">(total)</span></th> + <th class="showInLargeDisplay">failed + passed</th> + </tr> + </thead> + <tbody> + {# Calculate max result count for the bar #} + {% set maxCount = 1 %} + {% for testset in testsets %} + {% if (testset.getTestsetResultCounts.passed + testset.getTestsetResultCounts.failed) > maxCount %} + {% set maxCount = testset.getTestsetResultCounts.passed + testset.getTestsetResultCounts.failed %} + {% endif %} + {% endfor %} + + {# Print testsets #} + {% for testset in testsets %} + <tr> + {# Testset name #} + <td><a href="{{ testsetRoute }}/{{ testset.getName }}">{{ testset.getName }}</a></td> + + {# Project name #} + <td class="showInLargeDisplay">{{ testset.getProjectName }}</td> + + {# Testset status according to the latest build results #} + {% if testset.getStatus == constant('testsetRun::RESULT_SUCCESS') %} + {% set resultIcon = 'glyphicon glyphicon-ok green' %} + {% elseif testset.getStatus == constant('testsetRun::RESULT_FAILURE') %} + {% set resultIcon = 'glyphicon glyphicon-remove red' %} + {% else %} + {% set resultIcon = '' %} + {% endif %} + <td><span class="spaceHorizontal {{ resultIcon }}"></span>{{ testset.getStatus }}</td> + + {# Show results as numbers #} + {% set failed = testset.getTestsetResultCounts.failed %} + {% set passed = testset.getTestsetResultCounts.passed %} + {% set total = passed + failed %} + <td class="leftBorder center">{{ failed }}<span class ="gray"> ({{ total }})</span></td> + + {# Show results as bars (scaled to BAR_AREA px) #} + {% set passedBar = ((BAR_AREA/maxCount) * passed)|round(0, 'floor') %} + {% if (passed > 0) and (passedBar == 0) %} + {% set passedBar = 1 %} + {% endif %} + {% set failedBar = ((BAR_AREA/maxCount)*failed)|round(0, 'floor') %} + {% if (failed > 0) and (failedBar == 0) %} + {% set failedBar = 1 %} + {% endif %} + <td class="center showInLargeDisplay"> + <div> + <div class="floatLeft redBackground" style="width: {{ failedBar }}px"> </div> + <div class="floatLeft greenBackground" style="width: {{ passedBar }}px"> </div> + </div> + </td> + </tr> + {% endfor %} + </tbody> + </table> + </div> {# /table-responsive #} + </div> {# /panel-body #} + + </div> {# /col... #} + </div> {# /row #} +</div> {# /container-fluid #} + +{% include "footer.html" %} + +{# Local scripts for this page #} +{# (none) #} + +{% include "close.html" %} diff --git a/non-puppet/qtmetrics2/templates/testsets_top.php b/non-puppet/qtmetrics2/templates/testsets_top.php deleted file mode 100644 index 1f37e4e..0000000 --- a/non-puppet/qtmetrics2/templates/testsets_top.php +++ /dev/null @@ -1,172 +0,0 @@ -<?php -############################################################################# -## -## Copyright (C) 2015 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the Quality Assurance module of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see http://www.qt.io/terms-conditions. For further -## information use the contact form at http://www.qt.io/contact-us. -## -## GNU Lesser General Public License Usage -## Alternatively, this file may be used under the terms of the GNU Lesser -## General Public License version 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# - -/** - * Top failures (testsets) page - * @version 0.2 - * @since 11-06-2015 - * @author Juha Sippola - */ - -include 'header.php'; - -// Failed/passed bar area size in px -const BAR_AREA = 120; - -// Get input data -$breadcrumb = $this->data['breadcrumb']; -$testsetRoute = $this->data['testsetRoute']; -$refreshed = $this->data['refreshed']; -$topN = $this->data['topN']; -$lastDays = $this->data['lastDays']; -$sinceDate = $this->data['sinceDate']; -$masterProject = $this->data['masterProject']; -$masterState = $this->data['masterState']; -/** - * @var Testset[] $testsets - */ -$testsets = $this->data['testsets']; - -?> - -<ol class="breadcrumb"> - <?php - foreach ($breadcrumb as $link) { - echo '<li><a href="' . $link['link'] . '">' . $link['name'] . '</a></li>'; - } - ?> - <li class="active">top failures</li> -</ol> - -<div class="container-fluid"> - <div class="row"> - - <div class="col-sm-12 col-md-12 main"> - - <h1 class="page-header"> - <?php echo " Top $topN Failures" ?> - <button type="button" class="btn btn-xs btn-info" data-toggle="collapse" data-target="#info" aria-expanded="false" aria-controls="info"> - <span class="glyphicon glyphicon-info-sign"></span> - </button> - <small><?php echo $refreshed ?></small> - </h1> - <h3 class="sub-header"> <?php echo "Last $lastDays days <small>(since $sinceDate)</small>" ?> </h3> - - <div class="collapse" id="info"> - <div class="well infoWell"> - <span class="glyphicon glyphicon-info-sign"></span> <strong>Top failures</strong><br> - <ul> - <li>Lists testsets by number of <strong><?php echo "$masterProject $masterState" ?></strong> - builds where it failed during the last <?php echo $lastDays ?> days.</li> - <li><strong>latest result</strong> shows the overall testset status based on the latest - <strong><?php echo "$masterProject $masterState" ?></strong> builds across all branches - (shows failed if failed in one or in several).</li> - </ul> - </div> - </div> - - <div class="panel-body"> - <div class="table-responsive"> - <table class="table table-striped"> - <thead> - <tr> - <th>testset</th> - <th class="showInLargeDisplay">project</th> - <th>latest result</th> - <th class="leftBorder center">failed <span class ="gray">(total)</span></th> - <th class="showInLargeDisplay">failed + passed</th> - </tr> - </thead> - <tbody> - <?php - // Calculate max result count for the bar - $maxCount = 1; - foreach ($testsets as $testset) { - if ($testset->getTestsetResultCounts()['passed'] + $testset->getTestsetResultCounts()['failed'] > $maxCount) - $maxCount = $testset->getTestsetResultCounts()['passed'] + $testset->getTestsetResultCounts()['failed']; - } - // Print testsets - foreach ($testsets as $testset) { - echo '<tr>'; - // Testset name - echo '<td><a href="' . $testsetRoute . '/' . $testset->getName() . '">' . - $testset->getName() . '</a></td>'; - // Project name - echo '<td class="showInLargeDisplay">' . $testset->getProjectName() . '</td>'; - // Testset status according to the latest build results - $resultIcon = ''; - if ($testset->getStatus() == testsetRun::RESULT_SUCCESS) - $resultIcon = 'glyphicon glyphicon-ok green'; - if ($testset->getStatus() == testsetRun::RESULT_FAILURE) - $resultIcon = 'glyphicon glyphicon-remove red'; - echo '<td><span class="spaceHorizontal ' . $resultIcon . '"></span>' . $testset->getStatus() . '</td>'; - // Show results as numbers - $passed = $testset->getTestsetResultCounts()['passed']; - $failed = $testset->getTestsetResultCounts()['failed']; - $total = $passed + $failed; - echo '<td class="leftBorder center">' . $failed . '<span class ="gray"> (' . $total . ')</span></td>'; - // Show results as bars (scaled to BAR_AREA px) - $passedBar = floor((BAR_AREA/$maxCount) * $passed); - if ($passed > 0 and $passedBar == 0) - $passedBar = 1; - $failedBar = floor((BAR_AREA/$maxCount) * $failed); - if ($failed > 0 and $failedBar == 0) - $failedBar = 1; - echo '<td class="center showInLargeDisplay">'; - echo '<div>'; - echo '<div class="floatLeft redBackground" style="width: ' . $failedBar . 'px"> </div>'; - echo '<div class="floatLeft greenBackground" style="width: ' . $passedBar . 'px"> </div>'; - echo '</div>'; - echo '</td>'; - echo '</tr>'; - } - ?> - </tbody> - </table> - </div> <!-- /table-responsive --> - </div> <!-- /panel-body --> - - </div> <!-- /col... --> - </div> <!-- /row --> -</div> <!-- /container-fluid --> - -<?php -include 'footer.php'; -?> - -<!-- Local scripts for this page --> - -<?php -include 'close.php'; -?> |