summaryrefslogtreecommitdiffstats
path: root/non-puppet/qtmetrics2/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'non-puppet/qtmetrics2/index.php')
-rw-r--r--non-puppet/qtmetrics2/index.php112
1 files changed, 111 insertions, 1 deletions
diff --git a/non-puppet/qtmetrics2/index.php b/non-puppet/qtmetrics2/index.php
index 4156976..a3a9e26 100644
--- a/non-puppet/qtmetrics2/index.php
+++ b/non-puppet/qtmetrics2/index.php
@@ -34,7 +34,7 @@
/**
* Qt Metrics API
- * @since 23-09-2015
+ * @since 24-09-2015
* @author Juha Sippola
*/
@@ -73,6 +73,7 @@ $app->get('/', function() use($app)
'topRoute' => Slim\Slim::getInstance()->urlFor('top'),
'flakyRoute' => Slim\Slim::getInstance()->urlFor('flaky'),
'topTestfunctionsRoute' => Slim\Slim::getInstance()->urlFor('toptestfunctions'),
+ 'durationTestsetsRoute' => Slim\Slim::getInstance()->urlFor('durationTestsets'),
'bpassedTestfunctionsRoute' => Slim\Slim::getInstance()->urlFor('bpassed'),
'masterProject' => $ini['master_build_project'],
'masterState' => $ini['master_build_state'],
@@ -650,6 +651,113 @@ $app->get('/data/test/bpassed/testrows/:testset/:project', function($testset, $p
});
/**
+ * UI route: /test/duration/testsets (GET)
+ */
+
+$app->get('/test/duration/testsets', function() use($app)
+{
+ $ini = Factory::conf();
+ $dbStatus = Factory::db()->getDbRefreshStatus();
+ $days = intval($ini['top_duration_last_days']) - 1;
+ $since = Factory::getSinceDate($days);
+ $breadcrumb = array(
+ array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root'))
+ );
+ $app->render('testsets_duration.html', array(
+ 'root' => Slim\Slim::getInstance()->urlFor('root'),
+ 'dbStatus' => $dbStatus,
+ 'refreshed' => $dbStatus['refreshed'] . ' (GMT)',
+ 'breadcrumb' => $breadcrumb,
+ 'lastDays' => $ini['top_duration_last_days'],
+ 'sinceDate' => $since,
+ 'durationLimitSec' => $ini['testset_top_duration_limit_sec'],
+ 'masterProject' => $ini['master_build_project'],
+ 'masterState' => $ini['master_build_state']
+ ));
+})->name('durationTestsets');
+
+$app->get('/data/test/duration/testsets', function() use($app)
+{
+ $ini = Factory::conf();
+ $days = intval($ini['top_duration_last_days']) - 1;
+ $since = Factory::getSinceDate($days);
+ $app->render('testsets_duration_data.html', array(
+ 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset',
+ 'lastDays' => $ini['top_duration_last_days'],
+ 'sinceDate' => $since,
+ 'durationLimitSec' => $ini['testset_top_duration_limit_sec'],
+ 'list' => 'testsets',
+ 'testset' => '',
+ 'project' => '',
+ 'runs' => Factory::createTestsetRunsMaxDuration(
+ $ini['master_build_project'],
+ $ini['master_build_state']) // managed as objects
+ ));
+});
+
+/**
+ * UI route: /test/duration/testfunctions/:testset/:project (GET)
+ */
+
+$app->get('/test/duration/testfunctions/:testset/:project', function($testset, $project) use($app)
+{
+ $ini = Factory::conf();
+ $dbStatus = Factory::db()->getDbRefreshStatus();
+ if (Factory::checkTestset($testset)) {
+ $days = intval($ini['top_duration_last_days']) - 1;
+ $since = Factory::getSinceDate($days);
+ $testsetRoute = str_replace('/:testset/:project', '', Slim\Slim::getInstance()->urlFor('testset'));
+ $breadcrumb = array(
+ array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')),
+ array('name' => $testset, 'link' => $testsetRoute . '/' . $testset . '/' . $project)
+ );
+ $app->render('testfunctions_duration.html', array(
+ 'root' => Slim\Slim::getInstance()->urlFor('root'),
+ 'dbStatus' => $dbStatus,
+ 'refreshed' => $dbStatus['refreshed'] . ' (GMT)',
+ 'breadcrumb' => $breadcrumb,
+ 'lastDays' => $ini['top_duration_last_days'],
+ 'sinceDate' => $since,
+ 'durationLimitSec' => $ini['testfunction_top_duration_limit_sec'],
+ 'testset' => $testset,
+ 'project' => $project,
+ 'masterProject' => $ini['master_build_project'],
+ 'masterState' => $ini['master_build_state']
+ ));
+ } else {
+ $app->render('empty.html', array(
+ 'root' => Slim\Slim::getInstance()->urlFor('root'),
+ 'dbStatus' => $dbStatus,
+ 'message' => '404 Not Found'
+ ));
+ $app->response()->status(404);
+ }
+})->name('durationTestfunctions');
+
+$app->get('/data/test/duration/testfunctions/:testset/:project', function($testset, $project) use($app)
+{
+ $ini = Factory::conf();
+ $days = intval($ini['top_duration_last_days']) - 1;
+ $since = Factory::getSinceDate($days);
+ $testsetTestfunctionsRoute = str_replace('/:testset/:project/:conf', '', Slim\Slim::getInstance()->urlFor('testset_testfunctions'));
+ $app->render('testsets_duration_data.html', array(
+ 'testsetRoute' => Slim\Slim::getInstance()->urlFor('root') . 'testset',
+ 'testsetTestfunctionsRoute' => $testsetTestfunctionsRoute,
+ 'lastDays' => $ini['top_duration_last_days'],
+ 'sinceDate' => $since,
+ 'durationLimitSec' => $ini['testfunction_top_duration_limit_sec'],
+ 'list' => 'testfunctions',
+ 'testset' => $testset,
+ 'project' => $project,
+ 'runs' => Factory::createTestfunctionRunsMaxDuration(
+ $testset,
+ $project,
+ $ini['master_build_project'],
+ $ini['master_build_state']) // managed as objects
+ ));
+});
+
+/**
* UI route: /testset/:testset/:project (GET)
*/
@@ -667,6 +775,7 @@ $app->get('/testset/:testset/:project', function($testset, $project) use($app)
$testsetProjectRoute = str_replace('/:project', '', Slim\Slim::getInstance()->urlFor('testsetproject'));
$bpassedTestsetRoute = str_replace('/:testset/:project', '', Slim\Slim::getInstance()->urlFor('bpassedtestset'));
$bpassedtestsetTestrowsRoute = str_replace('/:testset/:project', '', Slim\Slim::getInstance()->urlFor('bpassedtestsetTestrows'));
+ $durationTestfunctionsRoute = str_replace('/:testset/:project', '', Slim\Slim::getInstance()->urlFor('durationTestfunctions'));
$app->render('testset.html', array(
'root' => Slim\Slim::getInstance()->urlFor('root'),
'dbStatus' => $dbStatus,
@@ -676,6 +785,7 @@ $app->get('/testset/:testset/:project', function($testset, $project) use($app)
'testsetProjectRoute' => $testsetProjectRoute,
'bpassedTestsetRoute' => $bpassedTestsetRoute,
'bpassedtestsetTestrowsRoute' => $bpassedtestsetTestrowsRoute,
+ 'durationTestfunctionsRoute' => $durationTestfunctionsRoute,
'lastDaysFailures' => $ini['top_failures_last_days'],
'lastDaysFlaky' => $ini['flaky_testsets_last_days'],
'sinceDateFailures' => Factory::getSinceDate(intval($ini['top_failures_last_days']) - 1),