Changeset 161120 in webkit


Ignore:
Timestamp:
Dec 29, 2013 9:24:57 AM (10 years ago)
Author:
ap@apple.com
Message:

Please display information about pending runs in build.webkit.org/dashboard
https://bugs.webkit.org/show_bug.cgi?id=122180

Reviewed by Timothy Hatcher.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:

(BuildbotBuilderQueueView.prototype.update.appendBuilderQueueStatus): Added a semicolon at the end of a line.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:

(BuildbotQueueView.prototype._latestFinishedIteration): Factored out of _appendPendingRevisionCount.
(BuildbotQueueView.prototype._appendPendingRevisionCount): Install a popover tracker over the element.
(BuildbotQueueView.prototype.lineForCommit): Build an element for a particular commit ot be shown in popover.
(BuildbotQueueView.prototype.presentPopoverForElement): Build and show popover content when PopoverTracker
asks us to.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Geometry.js: Added.

Taken from WebInspector with minimal changes:

  • Changed root name from WebInspector to Dashboard.
  • Removed some unused functionality.
  • Added Rect.containsPoint.
  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Popover.js: Added.

Popover has extensive changes compared to WebInspector version, only drawing code is the same:

  • Fixed to work in scrollable pages - WebInspector version assumes that window

and document coordinates are the same, and also erroneously dismisses a scrollable
popover if scrolling cascades out of it after reaching a bound.

  • Simplified API and implementation to Dashboard needs, it is no longer possible to

change content of an existing popover.

  • Rewrote visibility tracking to be more complete, and not rely on external tracker

object so much.

  • Added code to flash scroll bars when showing a scrollable popover.
  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/PopoverTracker.js: Added.

Objects of this class show and hide popovers as appropriate for registered active elements.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/StatusLineView.js:

(StatusLineView.prototype.get messageElement): Added an accessor, so that we could
install a popover on message element. It's the only visible element in pending commit
line, but the line has different bounds, so we can't install a popover on it (it
would be incorrectly positioned if we did).

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:

(Trac.prototype._convertCommitInfoElementToObject):

  • Some trac installations report author in a different element, updated to support that.
  • Changed to parse title out of description, because trac titles are ugly. Also,

we get a nice HTML with links from the description.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:

(Node.prototype.isAncestor): Copied from Web Inspector, only changing the form for
consistency with the rest of this file (add a property on prototype with assignment
instead of using Object.defineProperty).
(Node.prototype.isDescendant): Ditto.
(Node.prototype.isSelfOrAncestor): Ditto.
(Node.prototype.isSelfOrDescendant): Ditto.
(DOMTokenList.prototype.contains): Ditto.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Popover.css: Added.

Like JS counterpart, mostly lifted from Web Inspector.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/QueueView.css:

Added style rules for pending commits popover.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/StatusLineView.css:

(.status-line.no-bubble .message): Changed to display:inline-block, so that it fits
to content, and we can show the popover in a correct place.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html: Added new files.
Location:
trunk/Tools
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js

    r161090 r161120  
    6161        function appendBuilderQueueStatus(queue)
    6262        {
    63             this._appendPendingRevisionCount(queue)
     63            this._appendPendingRevisionCount(queue);
    6464
    6565            var firstRecentFailedIteration = queue.firstRecentFailedIteration;
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js

    r161099 r161120  
    6161    __proto__: QueueView.prototype,
    6262
    63     _appendPendingRevisionCount: function(queue)
     63    _latestFinishedIteration: function(queue)
    6464    {
    6565        for (var i = 0; i < queue.iterations.length; ++i) {
     
    6767            if (!iteration.loaded || !iteration.finished)
    6868                continue;
    69 
    70             var latestRecordedOpenSourceRevisionNumber = webkitTrac.latestRecordedRevisionNumber;
    71             if (!latestRecordedOpenSourceRevisionNumber)
     69            return iteration;
     70        }
     71        return null;
     72    },
     73
     74    _appendPendingRevisionCount: function(queue)
     75    {
     76        var latestFinishedIteration = this._latestFinishedIteration(queue);
     77        if (!latestFinishedIteration)
     78            return;
     79
     80        var latestRecordedOpenSourceRevisionNumber = webkitTrac.latestRecordedRevisionNumber;
     81        if (!latestRecordedOpenSourceRevisionNumber)
     82            return;
     83
     84        var openSourceRevisionsBehind = latestRecordedOpenSourceRevisionNumber - latestFinishedIteration.openSourceRevision;
     85        if (openSourceRevisionsBehind < 0)
     86            openSourceRevisionsBehind = 0;
     87
     88        if (latestFinishedIteration.internalRevision) {
     89            var latestRecordedInternalRevisionNumber = internalTrac.latestRecordedRevisionNumber;
     90            if (!latestRecordedInternalRevisionNumber)
    7291                return;
    7392
    74             var openSourceRevisionsBehind = latestRecordedOpenSourceRevisionNumber - iteration.openSourceRevision;
    75             if (openSourceRevisionsBehind < 0)
    76                 openSourceRevisionsBehind = 0;
    77 
    78             if (iteration.internalRevision) {
    79                 var latestRecordedInternalRevisionNumber = internalTrac.latestRecordedRevisionNumber;
    80                 if (!latestRecordedInternalRevisionNumber)
    81                     return;
    82 
    83                 var internalRevisionsBehind = latestRecordedInternalRevisionNumber - iteration.internalRevision;
    84                 if (internalRevisionsBehind < 0)
    85                     internalRevisionsBehind = 0;
    86                 if (openSourceRevisionsBehind || internalRevisionsBehind) {
    87                     var message = openSourceRevisionsBehind + " \uff0b " + internalRevisionsBehind + " revisions behind";
    88                     var status = new StatusLineView(message, StatusLineView.Status.NoBubble);
    89                     this.element.appendChild(status.element);
    90                 }
    91             } else if (openSourceRevisionsBehind) {
    92                 var message = openSourceRevisionsBehind + " " + (openSourceRevisionsBehind === 1 ? "revision behind" : "revisions behind");
     93            var internalRevisionsBehind = latestRecordedInternalRevisionNumber - latestFinishedIteration.internalRevision;
     94            if (internalRevisionsBehind < 0)
     95                internalRevisionsBehind = 0;
     96            if (openSourceRevisionsBehind || internalRevisionsBehind) {
     97                var message = openSourceRevisionsBehind + " \uff0b " + internalRevisionsBehind + " revisions behind";
    9398                var status = new StatusLineView(message, StatusLineView.Status.NoBubble);
    9499                this.element.appendChild(status.element);
    95100            }
    96 
    97             return;
    98         }
     101        } else if (openSourceRevisionsBehind) {
     102            var message = openSourceRevisionsBehind + " " + (openSourceRevisionsBehind === 1 ? "revision behind" : "revisions behind");
     103            var status = new StatusLineView(message, StatusLineView.Status.NoBubble);
     104            this.element.appendChild(status.element);
     105        }
     106
     107        if (status)
     108            new PopoverTracker(status.messageElement, this, queue);
     109    },
     110
     111    presentPopoverForElement: function(element, popover, queue)
     112    {
     113        var latestFinishedIteration = this._latestFinishedIteration(queue);
     114        if (!latestFinishedIteration)
     115            return false;
     116
     117        function lineForCommit(trac, commit)
     118        {
     119            var result = document.createElement("div");
     120            result.className = "pending-commit";
     121
     122            var linkElement = document.createElement("a");
     123            linkElement.className = "revision";
     124            linkElement.href = trac.revisionURL(commit.revisionNumber);
     125            linkElement.target = "_blank";
     126            linkElement.textContent = "r" + commit.revisionNumber;
     127            result.appendChild(linkElement);
     128
     129            var authorElement = document.createElement("span");
     130            authorElement.className = "author";
     131            authorElement.textContent = commit.author;
     132            result.appendChild(authorElement);
     133
     134            var titleElement = document.createElement("span");
     135            titleElement.className = "title";
     136            titleElement.innerHTML = commit.title.innerHTML;
     137            result.appendChild(titleElement);
     138
     139            return result;
     140        }
     141
     142        var content = document.createElement("div");
     143        content.className = "pending-commits-popover";
     144
     145        for (var i = webkitTrac.recordedCommits.length - 1; i >= 0; --i) {
     146            var commit = webkitTrac.recordedCommits[i];
     147            if (commit.revisionNumber <= latestFinishedIteration.openSourceRevision)
     148                break;
     149
     150            content.appendChild(lineForCommit(webkitTrac, commit));
     151        }
     152
     153        if (latestFinishedIteration.internalRevision && internalTrac.latestRecordedRevisionNumber) {
     154            if (latestFinishedIteration.internalRevision < internalTrac.latestRecordedRevisionNumber && content.hasChildNodes()) {
     155                var divider = document.createElement("div");
     156                divider.className = "divider";
     157                content.appendChild(divider);
     158            }
     159
     160            for (var i = internalTrac.recordedCommits.length - 1; i >= 0; --i) {
     161                var commit = internalTrac.recordedCommits[i];
     162                if (commit.revisionNumber <= latestFinishedIteration.internalRevision)
     163                    break;
     164
     165                content.appendChild(lineForCommit(internalTrac, commit));
     166            }
     167        }
     168
     169        var rect = Dashboard.Rect.rectFromClientRect(element.getBoundingClientRect());
     170        popover.present(rect, content, [Dashboard.RectEdge.MIN_Y, Dashboard.RectEdge.MAX_Y, Dashboard.RectEdge.MAX_X, Dashboard.RectEdge.MIN_X]);
     171
     172        return true;
    99173    },
    100174
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/StatusLineView.js

    r161092 r161120  
    161161            this._messageElement.textContent = x;
    162162        }
     163    },
     164
     165    get messageElement()
     166    {
     167        return this._messageElement;
    163168    }
    164169};
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js

    r161090 r161120  
    7171        var revisionNumber = parseInt(/\d+$/.exec(link))
    7272
    73         var title = doc.evaluate("./title", commitElement, null, XPathResult.STRING_TYPE).stringValue;
    74         title = title.replace(/^Changeset \[\d+\]: /, "");
    75         var author = doc.evaluate("./author", commitElement, null, XPathResult.STRING_TYPE).stringValue;
     73        function tracNSResolver(prefix)
     74        {
     75            if (prefix == "dc")
     76                return "http://purl.org/dc/elements/1.1/";
     77            return null;
     78        }
     79
     80        var author = doc.evaluate("./author|dc:creator", commitElement, tracNSResolver, XPathResult.STRING_TYPE).stringValue;
    7681        var date = doc.evaluate("./pubDate", commitElement, null, XPathResult.STRING_TYPE).stringValue;
    7782        date = new Date(Date.parse(date));
    7883        var description = doc.evaluate("./description", commitElement, null, XPathResult.STRING_TYPE).stringValue;
     84
     85        // The feed contains a <title>, but it's not parsed as well as what we are getting from description.
     86        var parsedDescription = document.createElement("div");
     87        parsedDescription.innerHTML = description;
     88        var title = document.createElement("div");
     89        var node = parsedDescription.firstChild.firstChild;
     90        while (node && node.tagName != "BR") {
     91            title.appendChild(node.cloneNode(true));
     92            node = node.nextSibling;
     93        }
     94
     95        // For some reason, trac titles start with a newline. Delete it.
     96        if (title.firstChild && title.firstChild.nodeType == Node.TEXT_NODE && title.firstChild.textContent.length > 0 && title.firstChild.textContent[0] == "\n")
     97            title.firstChild.textContent = title.firstChild.textContent.substring(1);
    7998
    8099        return {
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js

    r161090 r161120  
    7171};
    7272
     73Node.prototype.isAncestor = function(node)
     74{
     75    if (!node)
     76        return false;
     77
     78    var currentNode = node.parentNode;
     79    while (currentNode) {
     80        if (this === currentNode)
     81            return true;
     82        currentNode = currentNode.parentNode;
     83    }
     84
     85    return false;
     86}
     87
     88Node.prototype.isDescendant = function(descendant)
     89{
     90    return !!descendant && descendant.isAncestor(this);
     91}
     92
     93Node.prototype.isSelfOrAncestor = function(node)
     94{
     95    return !!node && (node === this || this.isAncestor(node));
     96}
     97
     98Node.prototype.isSelfOrDescendant = function(node)
     99{
     100    return !!node && (node === this || this.isDescendant(node));
     101}
     102
    73103Element.prototype.removeChildren = function()
    74104{
     
    77107        this.textContent = "";
    78108};
     109
     110DOMTokenList.prototype.contains = function(string)
     111{
     112    for (var i = 0, end = this.length; i < end; ++i) {
     113        if (this.item(i) === string)
     114            return true;
     115    }
     116    return false;
     117}
    79118
    80119Array.prototype.contains = function(value)
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/QueueView.css

    r161099 r161120  
    4040    margin-top: 10px;
    4141}
     42
     43.pending-commits-popover > .pending-commit {
     44    font-family: "HelveticaNeue-Light", "Helvetica Neue", sans-serif;
     45    color: rgb(145, 135, 95);
     46    font-size: 12px;
     47    text-align: left;
     48    padding: 1px 6px 1px 6px;
     49    user-select: auto;
     50}
     51
     52.pending-commits-popover > .pending-commit > .author {
     53    padding-left: 5px;
     54    padding-right: 5px;
     55}
     56
     57.pending-commits-popover > .pending-commit > .title {
     58    color: black;
     59}
     60
     61.pending-commits-popover > .divider {
     62    height: 7px;
     63}
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/StatusLineView.css

    r161092 r161120  
    110110}
    111111
     112.status-line.no-bubble .message {
     113    display: inline-block; /* Fit block to content, so that popovers are positioned correctly. */
     114}
     115
    112116.status-line.neutral .label,
    113117.status-line.neutral .message,
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html

    r161099 r161120  
    2929
    3030    <link rel="stylesheet" href="Styles/Main.css"></link>
     31    <link rel="stylesheet" href="Styles/Popover.css"></link>
    3132    <link rel="stylesheet" href="Styles/QueueView.css"></link>
    3233    <link rel="stylesheet" href="Styles/StatusLineView.css"></link>
     
    4243    <script src="Scripts/BuildbotIteration.js"></script>
    4344    <script src="Scripts/BuildbotTestResults.js"></script>
     45    <script src="Scripts/Geometry.js"></script>
     46    <script src="Scripts/Popover.js"></script>
     47    <script src="Scripts/PopoverTracker.js"></script>
    4448    <script src="Scripts/QueueView.js"></script>
    4549    <script src="Scripts/BuildbotQueueView.js"></script>
  • trunk/Tools/ChangeLog

    r161116 r161120  
     12013-12-29  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Please display information about pending runs in build.webkit.org/dashboard
     4        https://bugs.webkit.org/show_bug.cgi?id=122180
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:
     9        (BuildbotBuilderQueueView.prototype.update.appendBuilderQueueStatus): Added a semicolon at the end of a line.
     10
     11        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
     12        (BuildbotQueueView.prototype._latestFinishedIteration): Factored out of _appendPendingRevisionCount.
     13        (BuildbotQueueView.prototype._appendPendingRevisionCount): Install a popover tracker over the element.
     14        (BuildbotQueueView.prototype.lineForCommit): Build an element for a particular commit ot be shown in popover.
     15        (BuildbotQueueView.prototype.presentPopoverForElement): Build and show popover content when PopoverTracker
     16        asks us to.
     17
     18        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Geometry.js: Added.
     19        Taken from WebInspector with minimal changes:
     20        - Changed root name from WebInspector to Dashboard.
     21        - Removed some unused functionality.
     22        - Added Rect.containsPoint.
     23
     24        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Popover.js: Added.
     25        Popover has extensive changes compared to WebInspector version, only drawing code is the same:
     26        - Fixed to work in scrollable pages - WebInspector version assumes that window
     27        and document coordinates are the same, and also erroneously dismisses a scrollable
     28        popover if scrolling cascades out of it after reaching a bound.
     29        - Simplified API and implementation to Dashboard needs, it is no longer possible to
     30        change content of an existing popover.
     31        - Rewrote visibility tracking to be more complete, and not rely on external tracker
     32        object so much.
     33        - Added code to flash scroll bars when showing a scrollable popover.
     34
     35        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/PopoverTracker.js: Added.
     36        Objects of this class show and hide popovers as appropriate for registered active elements.
     37
     38        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/StatusLineView.js:
     39        (StatusLineView.prototype.get messageElement): Added an accessor, so that we could
     40        install a popover on message element. It's the only visible element in pending commit
     41        line, but the line has different bounds, so we can't install a popover on it (it
     42        would be incorrectly positioned if we did).
     43
     44        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:
     45        (Trac.prototype._convertCommitInfoElementToObject):
     46        - Some trac installations report author in a different element, updated to support that.
     47        - Changed to parse title out of description, because trac titles are ugly. Also,
     48        we get a nice HTML with links from the description.
     49
     50        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:
     51        (Node.prototype.isAncestor): Copied from Web Inspector, only changing the form for
     52        consistency with the rest of this file (add a property on prototype with assignment
     53        instead of using Object.defineProperty).
     54        (Node.prototype.isDescendant): Ditto.
     55        (Node.prototype.isSelfOrAncestor): Ditto.
     56        (Node.prototype.isSelfOrDescendant): Ditto.
     57        (DOMTokenList.prototype.contains): Ditto.
     58
     59        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Popover.css: Added.
     60        Like JS counterpart, mostly lifted from Web Inspector.
     61
     62        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/QueueView.css:
     63        Added style rules for pending commits popover.
     64
     65        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/StatusLineView.css:
     66        (.status-line.no-bubble .message): Changed to display:inline-block, so that it fits
     67        to content, and we can show the popover in a correct place.
     68
     69        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html: Added new files.
     70
    1712013-12-27  Gavin Barraclough  <barraclough@apple.com>
    272
Note: See TracChangeset for help on using the changeset viewer.