From d6be6e314d0b9f54d4bdcea3fd77287a181d288d Mon Sep 17 00:00:00 2001 From: "rniwa@webkit.org" Date: Sun, 27 Oct 2013 00:48:54 +0000 Subject: [PATCH] Make new bug link in flakiness dashboard configurable https://bugs.webkit.org/show_bug.cgi?id=123386 Reviewed by Alexey Proskuryakov. * config.json: Added Bugzilla as the default destination for new bugs. * public/api/manifest.php: Include newBugLinks in the manifest. * public/index.html: (TestResultsView): Initialize _newBugLinks. (TestResultsView.setNewBugLinks): Added. (TestResultsView._populateTestPane): (TestResultsView._createTestResultRow): Replaced the hard-coded Bugzilla URL by the code to generate hyper-links based on _newBugLinks. Also added a nullity check while formatting revision checks so that we don't blow up when some build doesn't contain all revision info. (TestResultsView._populateBuilderPane): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158095 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Websites/test-results/ChangeLog | 18 +++++++++++++++ Websites/test-results/config.json | 8 ++++++- Websites/test-results/public/api/manifest.php | 3 ++- Websites/test-results/public/index.html | 23 ++++++++++++++----- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/Websites/test-results/ChangeLog b/Websites/test-results/ChangeLog index f77b941027fd..7739c4f9ec95 100644 --- a/Websites/test-results/ChangeLog +++ b/Websites/test-results/ChangeLog @@ -1,3 +1,21 @@ +2013-10-26 Ryosuke Niwa + + Make new bug link in flakiness dashboard configurable + https://bugs.webkit.org/show_bug.cgi?id=123386 + + Reviewed by Alexey Proskuryakov. + + * config.json: Added Bugzilla as the default destination for new bugs. + * public/api/manifest.php: Include newBugLinks in the manifest. + * public/index.html: + (TestResultsView): Initialize _newBugLinks. + (TestResultsView.setNewBugLinks): Added. + (TestResultsView._populateTestPane): + (TestResultsView._createTestResultRow): Replaced the hard-coded Bugzilla URL by the code + to generate hyper-links based on _newBugLinks. Also added a nullity check while formatting + revision checks so that we don't blow up when some build doesn't contain all revision info. + (TestResultsView._populateBuilderPane): + 2013-10-26 Ryosuke Niwa New flakiness dashboard should support substring matching diff --git a/Websites/test-results/config.json b/Websites/test-results/config.json index 8a178db58587..7ba4c5016053 100644 --- a/Websites/test-results/config.json +++ b/Websites/test-results/config.json @@ -17,5 +17,11 @@ "LayoutTest": { "url": "https://trac.webkit.org/browser/trunk/LayoutTests/$testName" } - } + }, + "newBugLinks": [ + { + "label": "File a bug", + "url": "https://bugs.webkit.org/enter_bug.cgi?product=WebKit&component=Tools%20/%20Tests&form_name=enter_bug&keywords=LayoutTestFailure" + } + ] } diff --git a/Websites/test-results/public/api/manifest.php b/Websites/test-results/public/api/manifest.php index 20fb7dfe76e3..d23647820781 100644 --- a/Websites/test-results/public/api/manifest.php +++ b/Websites/test-results/public/api/manifest.php @@ -16,5 +16,6 @@ exit_with_success(array('tests' => $db->fetch_table('tests'), 'builders' => $builders, 'slaves' => $db->fetch_table('slaves'), 'repositories' => $repositories, - 'testCategories' => config('testCategories'))); + 'testCategories' => config('testCategories'), + 'newBugLinks' => config('newBugLinks'))); ?> diff --git a/Websites/test-results/public/index.html b/Websites/test-results/public/index.html index a52aa8f0d32f..384e13735a22 100644 --- a/Websites/test-results/public/index.html +++ b/Websites/test-results/public/index.html @@ -65,6 +65,7 @@ var TestResultsView = new (function () { this._slaves = {}; this._repositories = {}; this._testCategories = {}; + this._newBugLinks = []; }); TestResultsView.setAvailableTests = function (availableTests) { @@ -91,6 +92,10 @@ TestResultsView.setTestCategories = function (testCategories) { this._testCategories = testCategories; } +TestResultsView.setNewBugLinks = function (newBugLinks) { + this._newBugLinks = newBugLinks; +} + TestResultsView.showTooltip = function (anchor, contentElement) { var tooltipContainer = this._tooltipContainer; tooltipContainer.style.display = null; @@ -190,7 +195,7 @@ TestResultsView._populateTestPane = function(testName, results, section) { var self = this; this._sortObjectsByName(builders).forEach(function (builder) { - tbody.appendChild(self._createTestResultRow(builder.name, resultsByBuilder[builder.id], builder, buildTimes, repositories)); + tbody.appendChild(self._createTestResultRow(builder.name, resultsByBuilder[builder.id], test, builder, buildTimes, repositories)); }) table.appendChild(tbody); @@ -246,7 +251,7 @@ TestResultsView._createBuildsAndComputeSlownessOfResults = function (builderId, } } -TestResultsView._createTestResultRow = function (title, results, builder, buildTimes, repositories) { +TestResultsView._createTestResultRow = function (title, results, test, builder, buildTimes, repositories) { var sortedResults = results.sort(function (result1, result2) { return result2.build.time() - result1.build.time(); }); var cells = new Array(); @@ -283,9 +288,12 @@ TestResultsView._createTestResultRow = function (title, results, builder, buildT if (!seenBugLink) { // FIXME: Make bug tracker configurable. - formattedModifiers.push(element('a', - {'href': 'https://bugs.webkit.org/enter_bug.cgi?product=WebKit&component=Tools%20/%20Tests&form_name=enter_bug&keywords=LayoutTestFailure'}, - ['File a bug'])); + for (var i = 0; i < this._newBugLinks.length; i++) { + if (i) + formattedModifiers.push(' / '); + var link = this._newBugLinks[i]; + formattedModifiers.push(element('a', {'href': link.url.replace(/\$testName/g, test.name)}, link.label)); + } } var slowestTime = Math.max.apply(Math, results.map(function (result) { return result.roundedTime; })); @@ -298,6 +306,8 @@ TestResultsView._createTestResultRow = function (title, results, builder, buildT if (repositories) { var build = sortedResults[0].build; for (var i = 0; i < repositories.length; i++) { + if (!build.revision(repositories[i].id)) + continue; var revisionInfo = build.formattedRevision(repositories[i].id); if (latestRevisions.length) latestRevisions.push(' / '); @@ -402,7 +412,7 @@ TestResultsView._populateBuilderPane = function(builderName, failureType, result event.preventDefault(); return false; } - tbody.appendChild(self._createTestResultRow(element('span', [testName, externalTestLink]), results, builder)); + tbody.appendChild(self._createTestResultRow(element('span', [testName, externalTestLink]), results, test, builder)); }); table.appendChild(tbody); @@ -564,6 +574,7 @@ fetchManifest(function (response) { TestResultsView.setSlaves(mapById(response['slaves'])); TestResultsView.setRepositories(mapById(response['repositories'])); TestResultsView.setTestCategories(response['testCategories']); + TestResultsView.setNewBugLinks(response['newBugLinks']); // FIXME: Updating location.href shouldn't be TestResultsView's responsibility. var parsedStates = TestResultsView.loadTestsFromLocationHash(); if (parsedStates['builder']) { -- 2.36.0