From 096b99cdfc4f6ee17a09aa09c77a650be4877e06 Mon Sep 17 00:00:00 2001 From: Juha Sippola Date: Mon, 21 Sep 2015 15:39:07 +0300 Subject: Qt Metrics 2 (v0.23): Testfunction page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New page to list failed or skipped testrows for selected testfunction in selected testset and configuration. Change-Id: I64e7b7acf1a6001c08d0f11460f063bef279d607 Reviewed-by: Tony Sarajärvi --- non-puppet/qtmetrics2/index.php | 57 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) (limited to 'non-puppet/qtmetrics2/index.php') diff --git a/non-puppet/qtmetrics2/index.php b/non-puppet/qtmetrics2/index.php index 545d0e6..8cef994 100644 --- a/non-puppet/qtmetrics2/index.php +++ b/non-puppet/qtmetrics2/index.php @@ -34,7 +34,7 @@ /** * Qt Metrics API - * @since 08-09-2015 + * @since 09-09-2015 * @author Juha Sippola */ @@ -488,8 +488,7 @@ $app->get('/testset/:testset/:project/:conf', function($testset, $project, $conf array('name' => $project, 'link' => $testsetProjectRoute . '/' . $project), array('name' => $conf, 'link' => $confProjectRoute . '/' . urlencode($conf) . '/' . $project) ); - $confProjectRoute = str_replace('/:conf/:testsetproject', '', Slim\Slim::getInstance()->urlFor('conf_testsetproject')); - $testfunctionRoute = 'testfunction'; // TODO: Replace later with $testfunctionRoute = str_replace('/:testfunction', '', Slim\Slim::getInstance()->urlFor('testfunction')); + $testfunctionRoute = str_replace('/:testfunction/:testset/:project/:conf', '', Slim\Slim::getInstance()->urlFor('testfunction')); $app->render('testset_testfunctions.html', array( 'root' => Slim\Slim::getInstance()->urlFor('root'), 'breadcrumb' => $breadcrumb, @@ -522,6 +521,58 @@ $app->get('/testset/:testset/:project/:conf', function($testset, $project, $conf } })->name('testset_testfunctions'); +/** + * UI route: /testfunction/:testfunction/:testset/:project/:conf (GET) + */ + +$app->get('/testfunction/:testfunction/:testset/:project/:conf', function($testfunction, $testset, $project, $conf) use($app) +{ + $testfunction = strip_tags($testfunction); + $testset = strip_tags($testset); + $project = strip_tags($project); + $conf = strip_tags($conf); + if (Factory::checkTestset($testset)) { + $testsetTestfunctionRoute = str_replace('/:testset/:project/:conf', '', Slim\Slim::getInstance()->urlFor('testset_testfunctions')); + $testsetRoute = str_replace('/:testset/:project', '', Slim\Slim::getInstance()->urlFor('testset')); + $testsetProjectRoute = str_replace('/:project', '', Slim\Slim::getInstance()->urlFor('testsetproject')); + $confProjectRoute = str_replace('/:conf/:testsetproject', '', Slim\Slim::getInstance()->urlFor('conf_testsetproject')); + $ini = Factory::conf(); + $breadcrumb = array( + array('name' => 'home', 'link' => Slim\Slim::getInstance()->urlFor('root')), + array('name' => 'overview', 'link' => Slim\Slim::getInstance()->urlFor('overview')), + array('name' => $project, 'link' => $testsetProjectRoute . '/' . $project), + array('name' => $conf, 'link' => $confProjectRoute . '/' . urlencode($conf) . '/' . $project), + array('name' => $testset, 'link' => $testsetTestfunctionRoute . '/' . $testset . '/' . $project . '/' . urlencode($conf)) + ); + $app->render('testfunction.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), + 'breadcrumb' => $breadcrumb, + 'refreshed' => Factory::db()->getDbRefreshed() . ' (GMT)', + 'masterProject' => $ini['master_build_project'], + 'masterState' => $ini['master_build_state'], + 'conf' => $conf, + 'testset' => $testset, + 'testfunction' => $testfunction, + 'projectRuns' => Factory::createProjectRuns( + $ini['master_build_project'], + $ini['master_build_state']), // managed as objects + 'testrowRuns' => Factory::createTestrowRunsInConf( + $testfunction, + $testset, + $project, + $conf, + $ini['master_build_project'], + $ini['master_build_state']) // managed as objects + )); + } else { + $app->render('empty.html', array( + 'root' => Slim\Slim::getInstance()->urlFor('root'), + 'message' => '404 Not Found' + )); + $app->response()->status(404); + } +})->name('testfunction'); + /** * UI route: /sitemap (GET) */ -- cgit v1.2.3