Dashboard code restructuring
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 May 2016 20:35:58 +0000 (20:35 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 May 2016 20:35:58 +0000 (20:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157680
<rdar://problem/14736888>

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueView.js:
(BubbleQueueView.prototype.addLinkToRow): Moved to base class.
(BubbleQueueView.prototype.addTextToRow): Moved to base class.
(BubbleQueueView.prototype._addDividerToPopover): Moved to base class.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:
(BuildbotBuilderQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotCombinedQueueView.js:
(BuildbotCombinedQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
(BuildbotTesterQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
(BuildbotQueueView.prototype._appendPendingRevisionCount): Moved to base class and modified to take
additional argument.
(BuildbotQueueView.prototype._popoverLinesForCommitRange): Moved to base class.
(BuildbotQueueView.prototype._presentPopoverForPendingCommits): Moved to base class.
(BuildbotQueueView.prototype._addDividerToPopover): Moved to base class.
(BuildbotQueueView.prototype._formatRevisionForDisplay): Moved to base class.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js:
(documentReady): Display any customView if available.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/QueueView.js:
(QueueView.prototype.addLinkToRow): Moved from child class, no changes.
(QueueView.prototype.addTextToRow): Moved from child class, no changes.
(QueueView.prototype._addDividerToPopover): Moved from child class, no changes.
(QueueView.prototype._appendPendingRevisionCount): Moved from child class, made it more generic
by taking latestIterationGetter method as an argument.
(QueueView.prototype._popoverLinesForCommitRange): Moved from child class, no changes.
(QueueView.prototype._presentPopoverForPendingCommits): Moved from child class, no changes.
(QueueView.prototype._formatRevisionForDisplay): Moved from child class, no changes.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css:
(a:hover:link): Underline only when there is a link.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200880 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotCombinedQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/QueueView.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css
Tools/ChangeLog

index e1d44e4..721ffe2 100644 (file)
@@ -75,24 +75,6 @@ BubbleQueueView.prototype = {
         }, this);
     },
 
-    addLinkToRow: function(rowElement, className, text, url)
-    {
-        var linkElement = document.createElement("a");
-        linkElement.className = className;
-        linkElement.textContent = text;
-        linkElement.href = url;
-        linkElement.target = "_blank";
-        rowElement.appendChild(linkElement);
-    },
-
-    addTextToRow: function(rowElement, className, text)
-    {
-        var spanElement = document.createElement("span");
-        spanElement.className = className;
-        spanElement.textContent = text;
-        rowElement.appendChild(spanElement);
-    },
-
     _addQueueHeadingToPopover: function(queue, content)
     {
         var title = document.createElement("div");
@@ -113,13 +95,6 @@ BubbleQueueView.prototype = {
         content.appendChild(title);
     },
 
-    _addDividerToPopover: function(content)
-    {
-        var divider = document.createElement("div");
-        divider.className = "divider";
-        content.appendChild(divider);
-    },
-
     _timeIntervalString: function(time)
     {
         var secondsInHour = 60 * 60;
index ccc69cb..0555f92 100644 (file)
@@ -65,7 +65,7 @@ BuildbotBuilderQueueView.prototype = {
                 return;
             }
 
-            this._appendPendingRevisionCount(queue);
+            this._appendPendingRevisionCount(queue, this._latestProductiveIteration.bind(this, queue));
 
             var firstRecentUnsuccessfulIteration = queue.firstRecentUnsuccessfulIteration;
             var mostRecentFinishedIteration = queue.mostRecentFinishedIteration;
index d2f2188..13874d5 100644 (file)
@@ -84,7 +84,7 @@ BuildbotCombinedQueueView.prototype = {
             // Show the revision for the slowest queue, because we don't know if any newer revisions are green on all queues.
             // This can be slightly misleading after fixing a problem, because we can show a known broken revision as green.
             var slowestQueue = this.queues.slice().sort(function(a, b) { return BuildbotQueue.prototype.compareIterationsByRevisions(a.mostRecentSuccessfulIteration, b.mostRecentSuccessfulIteration); }).pop();
-            this._appendPendingRevisionCount(slowestQueue);
+            this._appendPendingRevisionCount(slowestQueue, this._latestProductiveIteration.bind(this, slowestQueue));
 
             var message = this.revisionContentForIteration(slowestQueue.mostRecentSuccessfulIteration);
             var statusMessagePassed = "all " + (queue.builder ? "builds succeeded" : "tests passed");
@@ -98,7 +98,7 @@ BuildbotCombinedQueueView.prototype = {
                     return;
                 }
 
-                this._appendPendingRevisionCount(queue);
+                this._appendPendingRevisionCount(queue, this._latestProductiveIteration.bind(this, queue));
 
                 var firstRecentUnsuccessfulIteration = queue.firstRecentUnsuccessfulIteration;
                 var mostRecentFinishedIteration = queue.mostRecentFinishedIteration;
index 92b829c..4113c0e 100644 (file)
@@ -73,121 +73,6 @@ BuildbotQueueView.prototype = {
         this.element.appendChild(status.element);
     },
 
-    _appendPendingRevisionCount: function(queue)
-    {
-        var latestProductiveIteration = this._latestProductiveIteration(queue);
-        if (!latestProductiveIteration)
-            return;
-
-        var totalRevisionsBehind = 0;
-
-        // FIXME: To be 100% correct, we should also filter out changes that are ignored by
-        // the queue, see _should_file_trigger_build in wkbuild.py.
-        var branches = queue.branches;
-        for (var i = 0; i < branches.length; ++i) {
-            var branch = branches[i];
-            var repository = branch.repository;
-            var repositoryName = repository.name;
-            var trac = repository.trac;
-            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
-            if (!latestProductiveRevisionNumber)
-                continue;
-            if (!trac)
-                continue;
-            if (!trac.latestRecordedRevisionNumber || trac.indexOfRevision(trac.oldestRecordedRevisionNumber) > trac.indexOfRevision(latestProductiveRevisionNumber)) {
-                trac.loadMoreHistoricalData();
-                return;
-            }
-
-            totalRevisionsBehind += trac.commitsOnBranchLaterThanRevision(branch.name, latestProductiveRevisionNumber).length;
-        }
-
-        if (!totalRevisionsBehind)
-            return;
-
-        var messageElement = document.createElement("span"); // We can't just pass text to StatusLineView here, because we need an element that perfectly fits the text for popover positioning.
-        messageElement.textContent = totalRevisionsBehind + " " + (totalRevisionsBehind === 1 ? "revision behind" : "revisions behind");
-        var status = new StatusLineView(messageElement, StatusLineView.Status.NoBubble);
-        this.element.appendChild(status.element);
-
-        new PopoverTracker(messageElement, this._presentPopoverForPendingCommits.bind(this), queue);
-    },
-
-    _popoverLinesForCommitRange: function(trac, branch, firstRevisionNumber, lastRevisionNumber)
-    {
-        function lineForCommit(trac, commit)
-        {
-            var result = document.createElement("div");
-            result.className = "pending-commit";
-
-            var linkElement = document.createElement("a");
-            linkElement.className = "revision";
-            linkElement.href = trac.revisionURL(commit.revisionNumber);
-            linkElement.target = "_blank";
-            linkElement.textContent = this._formatRevisionForDisplay(commit.revisionNumber, branch.repository);
-            result.appendChild(linkElement);
-
-            var authorElement = document.createElement("span");
-            authorElement.className = "author";
-            authorElement.textContent = commit.author;
-            result.appendChild(authorElement);
-
-            var titleElement = document.createElement("span");
-            titleElement.className = "title";
-            titleElement.innerHTML = commit.title.innerHTML;
-            result.appendChild(titleElement);
-
-            return result;
-        }
-
-        console.assert(trac.indexOfRevision(trac.oldestRecordedRevisionNumber) <= trac.indexOfRevision(firstRevisionNumber));
-
-        // FIXME: To be 100% correct, we should also filter out changes that are ignored by
-        // the queue, see _should_file_trigger_build in wkbuild.py.
-        var commits = trac.commitsOnBranchInRevisionRange(branch.name, firstRevisionNumber, lastRevisionNumber);
-        return commits.map(function(commit) {
-            return lineForCommit.call(this, trac, commit);
-        }, this).reverse();
-    },
-
-    _presentPopoverForPendingCommits: function(element, popover, queue)
-    {
-        var latestProductiveIteration = this._latestProductiveIteration(queue);
-        if (!latestProductiveIteration)
-            return false;
-
-        var content = document.createElement("div");
-        content.className = "commit-history-popover";
-
-        var shouldAddDivider = false;
-        var branches = queue.branches;
-        for (var i = 0; i < branches.length; ++i) {
-            var branch = branches[i];
-            var repository = branch.repository;
-            var repositoryName = repository.name;
-            var trac = repository.trac;
-            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
-            if (!latestProductiveRevisionNumber || !trac.latestRecordedRevisionNumber)
-                continue;
-            var nextRevision = trac.nextRevision(branch.name, latestProductiveRevisionNumber);
-            if (nextRevision === Trac.NO_MORE_REVISIONS)
-                continue;
-            var lines = this._popoverLinesForCommitRange(trac, branch, nextRevision, trac.latestRecordedRevisionNumber);
-            var length = lines.length;
-            if (length && shouldAddDivider)
-                this._addDividerToPopover(content);
-            for (var j = 0; j < length; ++j)
-                content.appendChild(lines[j]);
-            shouldAddDivider = shouldAddDivider || length > 0;
-        }
-
-        var rect = Dashboard.Rect.rectFromClientRect(element.getBoundingClientRect());
-        popover.content = content;
-        popover.present(rect, [Dashboard.RectEdge.MIN_Y, Dashboard.RectEdge.MAX_Y, Dashboard.RectEdge.MAX_X, Dashboard.RectEdge.MIN_X]);
-
-        return true;
-    },
-
     _presentPopoverForRevisionRange: function(element, popover, context)
     {
         var content = document.createElement("div");
@@ -289,13 +174,6 @@ BuildbotQueueView.prototype = {
         content.appendChild(title);
     },
 
-    _addDividerToPopover: function(content)
-    {
-        var divider = document.createElement("div");
-        divider.className = "divider";
-        content.appendChild(divider);
-    },
-
     revisionContentForIteration: function(iteration, previousDisplayedIteration)
     {
         var fragment = document.createDocumentFragment();
@@ -356,14 +234,5 @@ BuildbotQueueView.prototype = {
     _unauthorizedAccess: function(event)
     {
         this.updateSoon();
-    },
-
-    _formatRevisionForDisplay: function(revision, repository)
-    {
-        console.assert(repository.isSVN || repository.isGit, "Should not get here; " + repository.name + " did not specify a known VCS type.");
-        if (repository.isSVN)
-            return "r" + revision;
-        // Truncating for display. Git traditionally uses seven characters for a short hash.
-        return revision.substr(0, 7);
     }
 };
index 7d0567f..72d8246 100644 (file)
@@ -52,7 +52,7 @@ BuildbotTesterQueueView.prototype = {
                 return;
             }
 
-            this._appendPendingRevisionCount(queue);
+            this._appendPendingRevisionCount(queue, this._latestProductiveIteration.bind(this, queue));
 
             var appendedStatus = false;
 
index 913be1c..650414d 100644 (file)
@@ -26,7 +26,8 @@
 var hasBubbles = typeof bubbleQueueServer != "undefined";
 var BubblesCategory = "bubbles";
 
-var categorizedQueuesByPlatformAndBuildType = {};
+if (!categorizedQueuesByPlatformAndBuildType)
+    var categorizedQueuesByPlatformAndBuildType = {};
 var platformsByFamily = {};
 
 for (var i = 0; i < buildbots.length; ++i) {
@@ -258,6 +259,9 @@ function documentReady()
             cell.appendChild(view.element);
         }
 
+        if (platformQueues.customView)
+            cell.appendChild(platformQueues.customView.element);
+
         if (platformQueues[BubblesCategory]) {
             var view = new BubbleQueueView(platformQueues[BubblesCategory]);
             cell.appendChild(view.element);
index b7194aa..8e1282e 100644 (file)
@@ -78,5 +78,154 @@ QueueView.prototype = {
             clearInterval(this.updateTimer);
             this.updateTimer = null;
         }
+    },
+
+    addLinkToRow: function(rowElement, className, text, url)
+    {   
+        var linkElement = document.createElement("a");
+        linkElement.className = className;
+        linkElement.textContent = text;
+        linkElement.href = url;
+        linkElement.target = "_blank";
+        rowElement.appendChild(linkElement);
+    },  
+
+    addTextToRow: function(rowElement, className, text)
+    {   
+        var spanElement = document.createElement("span");
+        spanElement.className = className;
+        spanElement.textContent = text;
+        rowElement.appendChild(spanElement);
+    },
+
+    _addDividerToPopover: function(content)
+    {
+        var divider = document.createElement("div");
+        divider.className = "divider";
+        content.appendChild(divider);
+    },
+
+    _appendPendingRevisionCount: function(queue, latestIterationGetter)
+    {
+        var latestProductiveIteration = latestIterationGetter();
+        if (!latestProductiveIteration)
+            return;
+
+        var totalRevisionsBehind = 0;
+
+        // FIXME: To be 100% correct, we should also filter out changes that are ignored by
+        // the queue, see _should_file_trigger_build in wkbuild.py.
+        var branches = queue.branches;
+        for (var i = 0; i < branches.length; ++i) {
+            var branch = branches[i];
+            var repository = branch.repository;
+            var repositoryName = repository.name;
+            var trac = repository.trac;
+            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
+            if (!latestProductiveRevisionNumber)
+                continue;
+            if (!trac)
+                continue;
+            if (!trac.latestRecordedRevisionNumber || trac.indexOfRevision(trac.oldestRecordedRevisionNumber) > trac.indexOfRevision(latestProductiveRevisionNumber)) {
+                trac.loadMoreHistoricalData();
+                return;
+            }
+
+            totalRevisionsBehind += trac.commitsOnBranchLaterThanRevision(branch.name, latestProductiveRevisionNumber).length;
+        }
+
+        if (!totalRevisionsBehind)
+            return;
+
+        var messageElement = document.createElement("span"); // We can't just pass text to StatusLineView here, because we need an element that perfectly fits the text for popover positioning.
+        messageElement.textContent = totalRevisionsBehind + " " + (totalRevisionsBehind === 1 ? "revision behind" : "revisions behind");
+        var status = new StatusLineView(messageElement, StatusLineView.Status.NoBubble);
+        this.element.appendChild(status.element);
+
+        new PopoverTracker(messageElement, this._presentPopoverForPendingCommits.bind(this, latestIterationGetter), queue);
+    },
+
+    _popoverLinesForCommitRange: function(trac, branch, firstRevisionNumber, lastRevisionNumber)
+    {
+        function lineForCommit(trac, commit)
+        {
+            var result = document.createElement("div");
+            result.className = "pending-commit";
+
+            var linkElement = document.createElement("a");
+            linkElement.className = "revision";
+            linkElement.href = trac.revisionURL(commit.revisionNumber);
+            linkElement.target = "_blank";
+            linkElement.textContent = this._formatRevisionForDisplay(commit.revisionNumber, branch.repository);
+            result.appendChild(linkElement);
+
+            var authorElement = document.createElement("span");
+            authorElement.className = "author";
+            authorElement.textContent = commit.author;
+            result.appendChild(authorElement);
+
+            var titleElement = document.createElement("span");
+            titleElement.className = "title";
+            titleElement.innerHTML = commit.title.innerHTML;
+            result.appendChild(titleElement);
+
+            return result;
+        }
+
+        console.assert(trac.indexOfRevision(trac.oldestRecordedRevisionNumber) <= trac.indexOfRevision(firstRevisionNumber));
+
+        // FIXME: To be 100% correct, we should also filter out changes that are ignored by
+        // the queue, see _should_file_trigger_build in wkbuild.py.
+        var commits = trac.commitsOnBranchInRevisionRange(branch.name, firstRevisionNumber, lastRevisionNumber);
+        return commits.map(function(commit) {
+            return lineForCommit.call(this, trac, commit);
+        }, this).reverse();
+    },
+
+    _presentPopoverForPendingCommits: function(latestIterationGetter, element, popover, queue)
+    {
+        var latestProductiveIteration = latestIterationGetter();
+        if (!latestProductiveIteration)
+            return false;
+
+        var content = document.createElement("div");
+        content.className = "commit-history-popover";
+
+        var shouldAddDivider = false;
+        var branches = queue.branches;
+        for (var i = 0; i < branches.length; ++i) {
+            var branch = branches[i];
+            var repository = branch.repository;
+            var repositoryName = repository.name;
+            var trac = repository.trac;
+            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
+            if (!latestProductiveRevisionNumber || !trac.latestRecordedRevisionNumber)
+                continue;
+            var nextRevision = trac.nextRevision(branch.name, latestProductiveRevisionNumber);
+            if (nextRevision === Trac.NO_MORE_REVISIONS)
+                continue;
+            var lines = this._popoverLinesForCommitRange(trac, branch, nextRevision, trac.latestRecordedRevisionNumber);
+            var length = lines.length;
+            if (length && shouldAddDivider)
+                this._addDividerToPopover(content);
+            for (var j = 0; j < length; ++j)
+                content.appendChild(lines[j]);
+            shouldAddDivider = shouldAddDivider || length > 0;
+        }
+
+        var rect = Dashboard.Rect.rectFromClientRect(element.getBoundingClientRect());
+        popover.content = content;
+        popover.present(rect, [Dashboard.RectEdge.MIN_Y, Dashboard.RectEdge.MAX_Y, Dashboard.RectEdge.MAX_X, Dashboard.RectEdge.MIN_X]);
+
+        return true;
+    },
+
+    _formatRevisionForDisplay: function(revision, repository)
+    {
+        console.assert(repository.isSVN || repository.isGit, "Should not get here; " + repository.name + " did not specify a known VCS type.");
+        if (repository.isSVN)
+            return "r" + revision;
+        // Truncating for display. Git traditionally uses seven characters for a short hash.
+        return revision.substr(0, 7);
     }
 };
index bdf42b5..b646d16 100644 (file)
@@ -1,3 +1,42 @@
+2016-05-13  Aakash Jain  <aakash_jain@apple.com>
+
+        Dashboard code restructuring
+        https://bugs.webkit.org/show_bug.cgi?id=157680
+        <rdar://problem/14736888>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueView.js:
+        (BubbleQueueView.prototype.addLinkToRow): Moved to base class.
+        (BubbleQueueView.prototype.addTextToRow): Moved to base class.
+        (BubbleQueueView.prototype._addDividerToPopover): Moved to base class.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:
+        (BuildbotBuilderQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotCombinedQueueView.js:
+        (BuildbotCombinedQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
+        (BuildbotTesterQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
+        (BuildbotQueueView.prototype._appendPendingRevisionCount): Moved to base class and modified to take
+        additional argument.
+        (BuildbotQueueView.prototype._popoverLinesForCommitRange): Moved to base class.
+        (BuildbotQueueView.prototype._presentPopoverForPendingCommits): Moved to base class.
+        (BuildbotQueueView.prototype._addDividerToPopover): Moved to base class.
+        (BuildbotQueueView.prototype._formatRevisionForDisplay): Moved to base class.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js:
+        (documentReady): Display any customView if available.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/QueueView.js:
+        (QueueView.prototype.addLinkToRow): Moved from child class, no changes.
+        (QueueView.prototype.addTextToRow): Moved from child class, no changes.
+        (QueueView.prototype._addDividerToPopover): Moved from child class, no changes.
+        (QueueView.prototype._appendPendingRevisionCount): Moved from child class, made it more generic
+        by taking latestIterationGetter method as an argument.
+        (QueueView.prototype._popoverLinesForCommitRange): Moved from child class, no changes.
+        (QueueView.prototype._presentPopoverForPendingCommits): Moved from child class, no changes.
+        (QueueView.prototype._formatRevisionForDisplay): Moved from child class, no changes.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css:
+        (a:hover:link): Underline only when there is a link.
+
 2016-05-13  Yoav Weiss  <yoav@yoav.ws>
 
         Turn on WEB_TIMING for all ports