Changeset 200880 in webkit


Ignore:
Timestamp:
May 13, 2016 1:35:58 PM (8 years ago)
Author:
aakash_jain@apple.com
Message:

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.

Location:
trunk/Tools
Files:
9 edited

Legend:

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

    r191866 r200880  
    7676    },
    7777
    78     addLinkToRow: function(rowElement, className, text, url)
    79     {
    80         var linkElement = document.createElement("a");
    81         linkElement.className = className;
    82         linkElement.textContent = text;
    83         linkElement.href = url;
    84         linkElement.target = "_blank";
    85         rowElement.appendChild(linkElement);
    86     },
    87 
    88     addTextToRow: function(rowElement, className, text)
    89     {
    90         var spanElement = document.createElement("span");
    91         spanElement.className = className;
    92         spanElement.textContent = text;
    93         rowElement.appendChild(spanElement);
    94     },
    95 
    9678    _addQueueHeadingToPopover: function(queue, content)
    9779    {
     
    11294        title.textContent = "latest bot event";
    11395        content.appendChild(title);
    114     },
    115 
    116     _addDividerToPopover: function(content)
    117     {
    118         var divider = document.createElement("div");
    119         divider.className = "divider";
    120         content.appendChild(divider);
    12196    },
    12297
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js

    r190548 r200880  
    6666            }
    6767
    68             this._appendPendingRevisionCount(queue);
     68            this._appendPendingRevisionCount(queue, this._latestProductiveIteration.bind(this, queue));
    6969
    7070            var firstRecentUnsuccessfulIteration = queue.firstRecentUnsuccessfulIteration;
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotCombinedQueueView.js

    r196158 r200880  
    8585            // This can be slightly misleading after fixing a problem, because we can show a known broken revision as green.
    8686            var slowestQueue = this.queues.slice().sort(function(a, b) { return BuildbotQueue.prototype.compareIterationsByRevisions(a.mostRecentSuccessfulIteration, b.mostRecentSuccessfulIteration); }).pop();
    87             this._appendPendingRevisionCount(slowestQueue);
     87            this._appendPendingRevisionCount(slowestQueue, this._latestProductiveIteration.bind(this, slowestQueue));
    8888
    8989            var message = this.revisionContentForIteration(slowestQueue.mostRecentSuccessfulIteration);
     
    9999                }
    100100
    101                 this._appendPendingRevisionCount(queue);
     101                this._appendPendingRevisionCount(queue, this._latestProductiveIteration.bind(this, queue));
    102102
    103103                var firstRecentUnsuccessfulIteration = queue.firstRecentUnsuccessfulIteration;
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js

    r196402 r200880  
    7474    },
    7575
    76     _appendPendingRevisionCount: function(queue)
    77     {
    78         var latestProductiveIteration = this._latestProductiveIteration(queue);
    79         if (!latestProductiveIteration)
    80             return;
    81 
    82         var totalRevisionsBehind = 0;
    83 
    84         // FIXME: To be 100% correct, we should also filter out changes that are ignored by
    85         // the queue, see _should_file_trigger_build in wkbuild.py.
    86         var branches = queue.branches;
    87         for (var i = 0; i < branches.length; ++i) {
    88             var branch = branches[i];
    89             var repository = branch.repository;
    90             var repositoryName = repository.name;
    91             var trac = repository.trac;
    92             var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
    93             if (!latestProductiveRevisionNumber)
    94                 continue;
    95             if (!trac)
    96                 continue;
    97             if (!trac.latestRecordedRevisionNumber || trac.indexOfRevision(trac.oldestRecordedRevisionNumber) > trac.indexOfRevision(latestProductiveRevisionNumber)) {
    98                 trac.loadMoreHistoricalData();
    99                 return;
    100             }
    101 
    102             totalRevisionsBehind += trac.commitsOnBranchLaterThanRevision(branch.name, latestProductiveRevisionNumber).length;
    103         }
    104 
    105         if (!totalRevisionsBehind)
    106             return;
    107 
    108         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.
    109         messageElement.textContent = totalRevisionsBehind + " " + (totalRevisionsBehind === 1 ? "revision behind" : "revisions behind");
    110         var status = new StatusLineView(messageElement, StatusLineView.Status.NoBubble);
    111         this.element.appendChild(status.element);
    112 
    113         new PopoverTracker(messageElement, this._presentPopoverForPendingCommits.bind(this), queue);
    114     },
    115 
    116     _popoverLinesForCommitRange: function(trac, branch, firstRevisionNumber, lastRevisionNumber)
    117     {
    118         function lineForCommit(trac, commit)
    119         {
    120             var result = document.createElement("div");
    121             result.className = "pending-commit";
    122 
    123             var linkElement = document.createElement("a");
    124             linkElement.className = "revision";
    125             linkElement.href = trac.revisionURL(commit.revisionNumber);
    126             linkElement.target = "_blank";
    127             linkElement.textContent = this._formatRevisionForDisplay(commit.revisionNumber, branch.repository);
    128             result.appendChild(linkElement);
    129 
    130             var authorElement = document.createElement("span");
    131             authorElement.className = "author";
    132             authorElement.textContent = commit.author;
    133             result.appendChild(authorElement);
    134 
    135             var titleElement = document.createElement("span");
    136             titleElement.className = "title";
    137             titleElement.innerHTML = commit.title.innerHTML;
    138             result.appendChild(titleElement);
    139 
    140             return result;
    141         }
    142 
    143         console.assert(trac.indexOfRevision(trac.oldestRecordedRevisionNumber) <= trac.indexOfRevision(firstRevisionNumber));
    144 
    145         // FIXME: To be 100% correct, we should also filter out changes that are ignored by
    146         // the queue, see _should_file_trigger_build in wkbuild.py.
    147         var commits = trac.commitsOnBranchInRevisionRange(branch.name, firstRevisionNumber, lastRevisionNumber);
    148         return commits.map(function(commit) {
    149             return lineForCommit.call(this, trac, commit);
    150         }, this).reverse();
    151     },
    152 
    153     _presentPopoverForPendingCommits: function(element, popover, queue)
    154     {
    155         var latestProductiveIteration = this._latestProductiveIteration(queue);
    156         if (!latestProductiveIteration)
    157             return false;
    158 
    159         var content = document.createElement("div");
    160         content.className = "commit-history-popover";
    161 
    162         var shouldAddDivider = false;
    163         var branches = queue.branches;
    164         for (var i = 0; i < branches.length; ++i) {
    165             var branch = branches[i];
    166             var repository = branch.repository;
    167             var repositoryName = repository.name;
    168             var trac = repository.trac;
    169             var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
    170             if (!latestProductiveRevisionNumber || !trac.latestRecordedRevisionNumber)
    171                 continue;
    172             var nextRevision = trac.nextRevision(branch.name, latestProductiveRevisionNumber);
    173             if (nextRevision === Trac.NO_MORE_REVISIONS)
    174                 continue;
    175             var lines = this._popoverLinesForCommitRange(trac, branch, nextRevision, trac.latestRecordedRevisionNumber);
    176             var length = lines.length;
    177             if (length && shouldAddDivider)
    178                 this._addDividerToPopover(content);
    179             for (var j = 0; j < length; ++j)
    180                 content.appendChild(lines[j]);
    181             shouldAddDivider = shouldAddDivider || length > 0;
    182         }
    183 
    184         var rect = Dashboard.Rect.rectFromClientRect(element.getBoundingClientRect());
    185         popover.content = content;
    186         popover.present(rect, [Dashboard.RectEdge.MIN_Y, Dashboard.RectEdge.MAX_Y, Dashboard.RectEdge.MAX_X, Dashboard.RectEdge.MIN_X]);
    187 
    188         return true;
    189     },
    190 
    19176    _presentPopoverForRevisionRange: function(element, popover, context)
    19277    {
     
    288173
    289174        content.appendChild(title);
    290     },
    291 
    292     _addDividerToPopover: function(content)
    293     {
    294         var divider = document.createElement("div");
    295         divider.className = "divider";
    296         content.appendChild(divider);
    297175    },
    298176
     
    357235    {
    358236        this.updateSoon();
    359     },
    360 
    361     _formatRevisionForDisplay: function(revision, repository)
    362     {
    363         console.assert(repository.isSVN || repository.isGit, "Should not get here; " + repository.name + " did not specify a known VCS type.");
    364         if (repository.isSVN)
    365             return "r" + revision;
    366         // Truncating for display. Git traditionally uses seven characters for a short hash.
    367         return revision.substr(0, 7);
    368237    }
    369238};
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js

    r190730 r200880  
    5353            }
    5454
    55             this._appendPendingRevisionCount(queue);
     55            this._appendPendingRevisionCount(queue, this._latestProductiveIteration.bind(this, queue));
    5656
    5757            var appendedStatus = false;
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js

    r195961 r200880  
    2727var BubblesCategory = "bubbles";
    2828
    29 var categorizedQueuesByPlatformAndBuildType = {};
     29if (!categorizedQueuesByPlatformAndBuildType)
     30    var categorizedQueuesByPlatformAndBuildType = {};
    3031var platformsByFamily = {};
    3132
     
    259260        }
    260261
     262        if (platformQueues.customView)
     263            cell.appendChild(platformQueues.customView.element);
     264
    261265        if (platformQueues[BubblesCategory]) {
    262266            var view = new BubbleQueueView(platformQueues[BubblesCategory]);
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/QueueView.js

    r190303 r200880  
    7979            this.updateTimer = null;
    8080        }
     81    },
     82
     83    addLinkToRow: function(rowElement, className, text, url)
     84    {   
     85        var linkElement = document.createElement("a");
     86        linkElement.className = className;
     87        linkElement.textContent = text;
     88        linkElement.href = url;
     89        linkElement.target = "_blank";
     90        rowElement.appendChild(linkElement);
     91    }, 
     92
     93    addTextToRow: function(rowElement, className, text)
     94    {   
     95        var spanElement = document.createElement("span");
     96        spanElement.className = className;
     97        spanElement.textContent = text;
     98        rowElement.appendChild(spanElement);
     99    },
     100
     101    _addDividerToPopover: function(content)
     102    {
     103        var divider = document.createElement("div");
     104        divider.className = "divider";
     105        content.appendChild(divider);
     106    },
     107
     108    _appendPendingRevisionCount: function(queue, latestIterationGetter)
     109    {
     110        var latestProductiveIteration = latestIterationGetter();
     111        if (!latestProductiveIteration)
     112            return;
     113
     114        var totalRevisionsBehind = 0;
     115
     116        // FIXME: To be 100% correct, we should also filter out changes that are ignored by
     117        // the queue, see _should_file_trigger_build in wkbuild.py.
     118        var branches = queue.branches;
     119        for (var i = 0; i < branches.length; ++i) {
     120            var branch = branches[i];
     121            var repository = branch.repository;
     122            var repositoryName = repository.name;
     123            var trac = repository.trac;
     124            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
     125            if (!latestProductiveRevisionNumber)
     126                continue;
     127            if (!trac)
     128                continue;
     129            if (!trac.latestRecordedRevisionNumber || trac.indexOfRevision(trac.oldestRecordedRevisionNumber) > trac.indexOfRevision(latestProductiveRevisionNumber)) {
     130                trac.loadMoreHistoricalData();
     131                return;
     132            }
     133
     134            totalRevisionsBehind += trac.commitsOnBranchLaterThanRevision(branch.name, latestProductiveRevisionNumber).length;
     135        }
     136
     137        if (!totalRevisionsBehind)
     138            return;
     139
     140        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.
     141        messageElement.textContent = totalRevisionsBehind + " " + (totalRevisionsBehind === 1 ? "revision behind" : "revisions behind");
     142        var status = new StatusLineView(messageElement, StatusLineView.Status.NoBubble);
     143        this.element.appendChild(status.element);
     144
     145        new PopoverTracker(messageElement, this._presentPopoverForPendingCommits.bind(this, latestIterationGetter), queue);
     146    },
     147
     148    _popoverLinesForCommitRange: function(trac, branch, firstRevisionNumber, lastRevisionNumber)
     149    {
     150        function lineForCommit(trac, commit)
     151        {
     152            var result = document.createElement("div");
     153            result.className = "pending-commit";
     154
     155            var linkElement = document.createElement("a");
     156            linkElement.className = "revision";
     157            linkElement.href = trac.revisionURL(commit.revisionNumber);
     158            linkElement.target = "_blank";
     159            linkElement.textContent = this._formatRevisionForDisplay(commit.revisionNumber, branch.repository);
     160            result.appendChild(linkElement);
     161
     162            var authorElement = document.createElement("span");
     163            authorElement.className = "author";
     164            authorElement.textContent = commit.author;
     165            result.appendChild(authorElement);
     166
     167            var titleElement = document.createElement("span");
     168            titleElement.className = "title";
     169            titleElement.innerHTML = commit.title.innerHTML;
     170            result.appendChild(titleElement);
     171
     172            return result;
     173        }
     174
     175        console.assert(trac.indexOfRevision(trac.oldestRecordedRevisionNumber) <= trac.indexOfRevision(firstRevisionNumber));
     176
     177        // FIXME: To be 100% correct, we should also filter out changes that are ignored by
     178        // the queue, see _should_file_trigger_build in wkbuild.py.
     179        var commits = trac.commitsOnBranchInRevisionRange(branch.name, firstRevisionNumber, lastRevisionNumber);
     180        return commits.map(function(commit) {
     181            return lineForCommit.call(this, trac, commit);
     182        }, this).reverse();
     183    },
     184
     185    _presentPopoverForPendingCommits: function(latestIterationGetter, element, popover, queue)
     186    {
     187        var latestProductiveIteration = latestIterationGetter();
     188        if (!latestProductiveIteration)
     189            return false;
     190
     191        var content = document.createElement("div");
     192        content.className = "commit-history-popover";
     193
     194        var shouldAddDivider = false;
     195        var branches = queue.branches;
     196        for (var i = 0; i < branches.length; ++i) {
     197            var branch = branches[i];
     198            var repository = branch.repository;
     199            var repositoryName = repository.name;
     200            var trac = repository.trac;
     201            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
     202            if (!latestProductiveRevisionNumber || !trac.latestRecordedRevisionNumber)
     203                continue;
     204            var nextRevision = trac.nextRevision(branch.name, latestProductiveRevisionNumber);
     205            if (nextRevision === Trac.NO_MORE_REVISIONS)
     206                continue;
     207            var lines = this._popoverLinesForCommitRange(trac, branch, nextRevision, trac.latestRecordedRevisionNumber);
     208            var length = lines.length;
     209            if (length && shouldAddDivider)
     210                this._addDividerToPopover(content);
     211            for (var j = 0; j < length; ++j)
     212                content.appendChild(lines[j]);
     213            shouldAddDivider = shouldAddDivider || length > 0;
     214        }
     215
     216        var rect = Dashboard.Rect.rectFromClientRect(element.getBoundingClientRect());
     217        popover.content = content;
     218        popover.present(rect, [Dashboard.RectEdge.MIN_Y, Dashboard.RectEdge.MAX_Y, Dashboard.RectEdge.MAX_X, Dashboard.RectEdge.MIN_X]);
     219
     220        return true;
     221    },
     222
     223    _formatRevisionForDisplay: function(revision, repository)
     224    {
     225        console.assert(repository.isSVN || repository.isGit, "Should not get here; " + repository.name + " did not specify a known VCS type.");
     226        if (repository.isSVN)
     227            return "r" + revision;
     228        // Truncating for display. Git traditionally uses seven characters for a short hash.
     229        return revision.substr(0, 7);
    81230    }
    82231};
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css

    r192707 r200880  
    3939}
    4040
    41 a:hover {
     41a:hover:link {
    4242    text-decoration: underline;
    4343}
  • trunk/Tools/ChangeLog

    r200863 r200880  
     12016-05-13  Aakash Jain  <aakash_jain@apple.com>
     2
     3        Dashboard code restructuring
     4        https://bugs.webkit.org/show_bug.cgi?id=157680
     5        <rdar://problem/14736888>
     6
     7        Reviewed by Alexey Proskuryakov.
     8
     9        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueView.js:
     10        (BubbleQueueView.prototype.addLinkToRow): Moved to base class.
     11        (BubbleQueueView.prototype.addTextToRow): Moved to base class.
     12        (BubbleQueueView.prototype._addDividerToPopover): Moved to base class.
     13        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotBuilderQueueView.js:
     14        (BuildbotBuilderQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
     15        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotCombinedQueueView.js:
     16        (BuildbotCombinedQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
     17        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
     18        (BuildbotTesterQueueView.prototype.update): Passing additional argument to _appendPendingRevisionCount.
     19        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
     20        (BuildbotQueueView.prototype._appendPendingRevisionCount): Moved to base class and modified to take
     21        additional argument.
     22        (BuildbotQueueView.prototype._popoverLinesForCommitRange): Moved to base class.
     23        (BuildbotQueueView.prototype._presentPopoverForPendingCommits): Moved to base class.
     24        (BuildbotQueueView.prototype._addDividerToPopover): Moved to base class.
     25        (BuildbotQueueView.prototype._formatRevisionForDisplay): Moved to base class.
     26        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Main.js:
     27        (documentReady): Display any customView if available.
     28        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/QueueView.js:
     29        (QueueView.prototype.addLinkToRow): Moved from child class, no changes.
     30        (QueueView.prototype.addTextToRow): Moved from child class, no changes.
     31        (QueueView.prototype._addDividerToPopover): Moved from child class, no changes.
     32        (QueueView.prototype._appendPendingRevisionCount): Moved from child class, made it more generic
     33        by taking latestIterationGetter method as an argument.
     34        (QueueView.prototype._popoverLinesForCommitRange): Moved from child class, no changes.
     35        (QueueView.prototype._presentPopoverForPendingCommits): Moved from child class, no changes.
     36        (QueueView.prototype._formatRevisionForDisplay): Moved from child class, no changes.
     37        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/Main.css:
     38        (a:hover:link): Underline only when there is a link.
     39
    1402016-05-13  Yoav Weiss  <yoav@yoav.ws>
    241
Note: See TracChangeset for help on using the changeset viewer.