Changeset 162373 in webkit


Ignore:
Timestamp:
Jan 20, 2014 1:33:51 PM (10 years ago)
Author:
ap@apple.com
Message:

build.webkit.org/dashboard should display information about patches in EWS
https://bugs.webkit.org/show_bug.cgi?id=127006

Reviewed by Ryosuke Niwa.

  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html:
  • BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Bugzilla.js: Added.

(Bugzilla.prototype.detailsURLForAttachment):
Added a class for Bugzilla. So far, the only thing it can do is build patch URLs,
which is needed when one wants to do something with a patch EWS is stuck on.

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

Create a Bugzilla instance.

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

(EWS.prototype.jsonQueueLengthURL):
(EWS.prototype.jsonQueueStatusURL):
Build JSON ULRs here, not in EWSQueue, as this is how other classes are structured.

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

(EWSQueue.prototype.get statusPageURL): Changed to use a URL provided by EWS instead
of second guessing.
(EWSQueue.prototype.get chartsPageURL): Added.
(EWSQueue.prototype.get loadedDetailedStatus): Tells whether we currently have
additional data already loaded (it's reset with every update).
(EWSQueue.prototype.get patches): Get patch queue.
(EWSQueue.prototype.get bots): Get bots.
(EWSQueue.prototype.update): Changed to use a specialized cheaper URL.
(EWSQueue.prototype.loadDetailedStatus): Load and transform detailed status JSON.

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

(EWSQueueView.prototype.update.appendQueue): Add a popover is there are any patches
in the queue.
(EWSQueueView.prototype.addLinkToRow): A helper to build the popover.
(EWSQueueView.prototype.addTextToRow): Ditto.
(EWSQueueView.prototype._addQueueHeadingToPopover): Ditto.
(EWSQueueView.prototype._addBotsHeadingToPopover): Ditto.
(EWSQueueView.prototype._addDividerToPopover): Ditto.
(EWSQueueView.prototype._timeIntervalString): A helper to format a timestamp into a
relative string.
(EWSQueueView.prototype._popoverContentForEWSQueue): Build the popover.
(EWSQueueView.prototype._presentPopoverForEWSQueue): Start loading data, and present
it when done.

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

Added rules for EWS popover. Removed a duplicate rule for build-logs-popover.
Changed a few difficult to read padding styles to padding-left.

Location:
trunk/Tools
Files:
1 added
7 edited

Legend:

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

    r161099 r162373  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5050    constructor: EWS,
    5151    __proto__: BaseObject.prototype,
     52
     53    jsonQueueLengthURL: function(queueID)
     54    {
     55        return this.baseURL + "queue-length-json/" + encodeURIComponent(queueID) + "-ews";
     56    },
     57
     58    jsonQueueStatusURL: function(queueID)
     59    {
     60        return this.baseURL + "queue-status-json/" + encodeURIComponent(queueID) + "-ews";
     61    },
    5262};
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/EWSQueue.js

    r161103 r162373  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5050    __proto__: BaseObject.prototype,
    5151
    52     get baseURL()
     52    get statusPageURL()
    5353    {
    54         return this.ews.baseURL + "queue-status-json/" + encodeURIComponent(this.id) + "-ews";
     54        return this._statusPageURL;
    5555    },
    5656
    57     get statusPage()
     57    get chartsPageURL()
    5858    {
    59         return this.ews.baseURL + "queue-status/" + encodeURIComponent(this.id) + "-ews";
     59        return this._chartsPageURL;
    6060    },
    6161
     
    6565    },
    6666
     67    get loadedDetailedStatus()
     68    {
     69        return this._loadedDetailedStatus;
     70    },
     71
     72    get patches()
     73    {
     74        console.assert(this._loadedDetailedStatus);
     75        return this._queue;
     76    },
     77
     78    get bots()
     79    {
     80        console.assert(this._loadedDetailedStatus);
     81        return this._bots;
     82    },
     83
    6784    update: function()
    6885    {
    69         JSON.load(this.baseURL, function(data) {
    70             var newPatchCount = data.queue.length;
     86        this._loadedDetailedStatus = false;
     87
     88        JSON.load(this.ews.jsonQueueLengthURL(this.id), function(data) {
     89            var newPatchCount = data.queue_length;
    7190            if (this._patchCount == newPatchCount)
    7291                return;
    7392            this._patchCount = newPatchCount;
    74 
    7593            this.dispatchEventToListeners(EWSQueue.Event.Updated, null);
    7694        }.bind(this));
    77     }
     95    },
     96
     97    loadDetailedStatus: function(callback)
     98    {
     99        JSON.load(this.ews.jsonQueueStatusURL(this.id), function(data) {
     100            this._queue = [];
     101            for (var i = 0, end = data.queue.length; i < end; ++i) {
     102                var patch = data.queue[i];
     103                var activeSinceTime = patch.active_since ? Date.parse(patch.active_since) : 0;
     104                this._queue.push({
     105                    attachmentID: patch.attachment_id,
     106                    statusPageURL: patch.status_page,
     107                    latestMessage: patch.latest_message,
     108                    latestMessageTime: patch.latest_message_time ? new Date(patch.latest_message_time) : null,
     109                    detailedResultsURLForLatestMessage: patch.latest_results,
     110                    messageCount: patch.message_count,
     111                    active: patch.active,
     112                    activeSince: new Date(activeSinceTime),
     113                });
     114            }
     115
     116            this._bots = [];
     117            for (var i = 0, end = data.bots.length; i < end; ++i) {
     118                var bot = data.bots[i];
     119                var latestMessageTime = bot.latest_message_time ? Date.parse(bot.latest_message_time) : 0;
     120
     121                var oneDayInMilliseconds = 24 * 60 * 60 * 1000;
     122                var botIsCurrentlyActive = Date.now() < latestMessageTime + oneDayInMilliseconds;
     123                if (!botIsCurrentlyActive)
     124                    continue;
     125
     126                // Sometimes (rarely), there are status messages with an empty bot name added to the database.
     127                if (!bot.bot_id.length)
     128                    bot.bot_id = "<empty name>";
     129
     130                this._bots.push({
     131                    id: bot.bot_id,
     132                    statusPageURL: bot.status_page,
     133                    latestMessageTime: new Date(latestMessageTime),
     134                });
     135            }
     136
     137            this._statusPageURL = data.status_page;
     138            this._chartsPageURL = data.charts_page;
     139
     140            this._loadedDetailedStatus = true;
     141            callback();
     142        }.bind(this));
     143    },
    78144};
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/EWSQueueView.js

    r161099 r162373  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5555        function appendQueue(queue)
    5656        {
    57             var releaseLabel = document.createElement("a");
    58             releaseLabel.classList.add("queueLabel");
    59             releaseLabel.textContent = queue.title;
    60             releaseLabel.href = queue.statusPage;
    61             releaseLabel.target = "_blank";
    62             this.element.appendChild(releaseLabel);
     57            var queueLabel = document.createElement("a");
     58            queueLabel.classList.add("queueLabel");
     59            queueLabel.textContent = queue.title;
     60            queueLabel.href = queue.statusPageURL;
     61            queueLabel.target = "_blank";
     62            this.element.appendChild(queueLabel);
    6363
    6464            var patchCount = queue.patchCount;
     
    6767            var status = new StatusLineView(message, StatusLineView.Status.Neutral, null, patchCount || "0");
    6868            this.element.appendChild(status.element);
     69
     70            if (patchCount > 0)
     71                new PopoverTracker(status.statusBubbleElement, this._presentPopoverForEWSQueue.bind(this), queue);
    6972        }
    7073
     
    7477    },
    7578
     79    addLinkToRow: function(rowElement, className, text, url)
     80    {
     81        var linkElement = document.createElement("a");
     82        linkElement.className = className;
     83        linkElement.textContent = text;
     84        linkElement.href = url;
     85        linkElement.target = "_blank";
     86        rowElement.appendChild(linkElement);
     87    },
     88
     89    addTextToRow: function(rowElement, className, text)
     90    {
     91        var spanElement = document.createElement("span");
     92        spanElement.className = className;
     93        spanElement.textContent = text;
     94        rowElement.appendChild(spanElement);
     95    },
     96
     97    _addQueueHeadingToPopover: function(queue, content)
     98    {
     99        var title = document.createElement("div");
     100        title.className = "popover-queue-heading";
     101
     102        this.addTextToRow(title, "queue-name", queue.id + " ews queue");
     103        this.addLinkToRow(title, "queue-status-link", "status page", queue.statusPageURL);
     104        this.addLinkToRow(title, "queue-charts-link", "charts", queue.chartsPageURL);
     105
     106        content.appendChild(title);
     107    },
     108
     109    _addBotsHeadingToPopover: function(queue, content)
     110    {
     111        var title = document.createElement("div");
     112        title.className = "popover-bots-heading";
     113        title.textContent = "latest bot event";
     114        content.appendChild(title);
     115    },
     116
     117    _addDividerToPopover: function(content)
     118    {
     119        var divider = document.createElement("div");
     120        divider.className = "divider";
     121        content.appendChild(divider);
     122    },
     123
     124    _timeIntervalString: function(time)
     125    {
     126        var secondsInHour = 60 * 60;
     127        var timeDifference = (Date.now() - time.getTime()) / 1000;
     128        var hours = Math.floor(timeDifference / secondsInHour);
     129        var minutes = Math.floor((timeDifference - hours * secondsInHour) / 60);
     130        var hoursPart = "";
     131        if (hours === 1)
     132            hoursPart = "1\xa0hour and ";
     133        else if (hours > 0)
     134            hoursPart = hours + "\xa0hours and ";
     135        if (!minutes)
     136            return "less than a minute";
     137        if (minutes === 1)
     138            return hoursPart + "1\xa0minute";
     139        return hoursPart + minutes + "\xa0minutes";
     140    },
     141
     142    _popoverContentForEWSQueue: function(queue)
     143    {
     144        var content = document.createElement("div");
     145        content.className = "ews-popover";
     146
     147        this._addQueueHeadingToPopover(queue, content);
     148        this._addDividerToPopover(content);
     149
     150        var patches = queue.patches;
     151        for (var i = 0, end = patches.length; i < end; ++i) {
     152            var patch = patches[i];
     153
     154            var rowElement = document.createElement("div");
     155
     156            this.addLinkToRow(rowElement, "patch-details-link", patch.attachmentID, patch.statusPageURL);
     157
     158            if (patch.messageCount)
     159                this.addTextToRow(rowElement, "failure-count", patch.messageCount + "\xa0" + (patch.messageCount === 1 ? "attempt" : "attempts"));
     160
     161            if (patch.detailedResultsURLForLatestMessage)
     162                this.addLinkToRow(rowElement, "latest-status-with-link", patch.latestMessage, patch.detailedResultsURLForLatestMessage);
     163            else if (patch.latestMessage && patch.latestMessage.length)
     164                this.addTextToRow(rowElement, "latest-status-no-link", patch.latestMessage);
     165            else if (patch.active) {
     166                this.addTextToRow(rowElement, "latest-status-no-link", "Started");
     167                this.addTextToRow(rowElement, "time-since-message", this._timeIntervalString(patch.activeSince) + "\xa0ago");
     168            } else
     169                this.addTextToRow(rowElement, "latest-status-no-link", "Not started yet");
     170
     171            if (patch.latestMessageTime)
     172                this.addTextToRow(rowElement, "time-since-message", this._timeIntervalString(patch.latestMessageTime) + "\xa0ago");
     173
     174            this.addLinkToRow(rowElement, "bugzilla-link", "bugzilla", bugzilla.detailsURLForAttachment(patch.attachmentID));
     175
     176            content.appendChild(rowElement);
     177        }
     178
     179        this._addDividerToPopover(content);
     180        this._addBotsHeadingToPopover(queue, content);
     181        this._addDividerToPopover(content);
     182
     183        var bots = queue.bots;
     184        for (var i = 0, end = bots.length; i < end; ++i) {
     185            var bot = bots[i];
     186
     187            var rowElement = document.createElement("div");
     188
     189            this.addLinkToRow(rowElement, "bot-status-link", bot.id, bot.statusPageURL);
     190            this.addTextToRow(rowElement, "bot-status-description", this._timeIntervalString(bot.latestMessageTime) + "\xa0ago");
     191
     192            content.appendChild(rowElement);
     193        }
     194
     195        return content;
     196    },
     197
     198    _presentPopoverForEWSQueue: function(element, popover, queue)
     199    {
     200        if (queue.loadedDetailedStatus)
     201            var content = this._popoverContentForEWSQueue(queue);
     202        else {
     203            var content = document.createElement("div");
     204            content.className = "ews-popover";
     205
     206            var loadingIndicator = document.createElement("div");
     207            loadingIndicator.className = "loading-indicator";
     208            loadingIndicator.textContent = "Loading\u2026";
     209            content.appendChild(loadingIndicator);
     210
     211            queue.loadDetailedStatus(function() {
     212                popover.content = this._popoverContentForEWSQueue(queue);
     213            }.bind(this));
     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        return true;
     220    },
     221
    76222    _updateQueues: function()
    77223    {
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Initialization.js

    r161273 r162373  
    2727var buildbot = new WebKitBuildbot;
    2828var webkitTrac = new Trac("http://trac.webkit.org/");
     29var bugzilla = new Bugzilla;
    2930var ews = new EWS;
    3031var testHistory = new TestHistory;
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/QueueView.css

    r162191 r162373  
    7676}
    7777
    78 .build-logs-popover {
    79     font-family: "HelveticaNeue-Light", "Helvetica Neue", sans-serif;
    80     color: rgb(145, 135, 95);
    81     font-size: 12px;
    82     text-align: left;
    83     padding: 1px 6px 1px 6px;
    84 }
    85 
    8678.build-logs-popover .build-logs-heading {
    8779    display: inline;
     
    116108.test-results-popover .failure-kind-indicator {
    117109    color: rgb(191, 67, 41);
    118     padding: 0px 0px 0px 7px;
     110    padding-left: 7px;
    119111}
    120112
    121113.test-results-popover .test-history-link {
    122114    color: rgb(145, 135, 95);
    123     padding: 0px 0px 0px 7px;
     115    padding-left: 7px;
    124116}
    125117
    126118.test-results-popover .additional-link {
    127119    color: rgb(145, 135, 95);
    128     padding: 0px 0px 0px 7px;
     120    padding-left: 7px;
    129121}
     122
     123.ews-popover {
     124    font-family: "HelveticaNeue-Light", "Helvetica Neue", sans-serif;
     125    color: rgb(145, 135, 95);
     126    font-size: 12px;
     127    text-align: left;
     128    padding: 1px 6px 1px 6px;
     129}
     130
     131.ews-popover .popover-queue-heading .queue-status-link,
     132.ews-popover .popover-queue-heading .queue-charts-link {
     133    color: rgb(145, 135, 95);
     134    padding-left: 7px;
     135}
     136
     137.ews-popover .latest-status-with-link,
     138.ews-popover .latest-status-no-link {
     139    color: black;
     140    padding-left: 7px;
     141}
     142
     143.ews-popover .failure-count,
     144.ews-popover .time-since-message,
     145.ews-popover .bugzilla-link,
     146.ews-popover .bot-status-description {
     147    padding-left: 7px;
     148}
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html

    r161273 r162373  
    3737    <script src="Scripts/Dashboard.js"></script>
    3838    <script src="Scripts/Buildbot.js"></script>
     39    <script src="Scripts/Bugzilla.js"></script>
    3940    <script src="Scripts/EWS.js"></script>
    4041    <script src="Scripts/WebKitBuildbot.js"></script>
  • trunk/Tools/ChangeLog

    r162371 r162373  
     12014-01-20  Alexey Proskuryakov  <ap@apple.com>
     2
     3        build.webkit.org/dashboard should display information about patches in EWS
     4        https://bugs.webkit.org/show_bug.cgi?id=127006
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/index.html:
     9        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Bugzilla.js: Added.
     10        (Bugzilla.prototype.detailsURLForAttachment):
     11        Added a class for Bugzilla. So far, the only thing it can do is build patch URLs,
     12        which is needed when one wants to do something with a patch EWS is stuck on.
     13
     14        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Initialization.js:
     15        Create a Bugzilla instance.
     16
     17        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/EWS.js:
     18        (EWS.prototype.jsonQueueLengthURL):
     19        (EWS.prototype.jsonQueueStatusURL):
     20        Build JSON ULRs here, not in EWSQueue, as this is how other classes are structured.
     21
     22        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/EWSQueue.js:
     23        (EWSQueue.prototype.get statusPageURL): Changed to use a URL provided by EWS instead
     24        of second guessing.
     25        (EWSQueue.prototype.get chartsPageURL): Added.
     26        (EWSQueue.prototype.get loadedDetailedStatus): Tells whether we currently have
     27        additional data already loaded (it's reset with every update).
     28        (EWSQueue.prototype.get patches): Get patch queue.
     29        (EWSQueue.prototype.get bots): Get bots.
     30        (EWSQueue.prototype.update): Changed to use a specialized cheaper URL.
     31        (EWSQueue.prototype.loadDetailedStatus): Load and transform detailed status JSON.
     32
     33        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/EWSQueueView.js:
     34        (EWSQueueView.prototype.update.appendQueue): Add a popover is there are any patches
     35        in the queue.
     36        (EWSQueueView.prototype.addLinkToRow): A helper to build the popover.
     37        (EWSQueueView.prototype.addTextToRow): Ditto.
     38        (EWSQueueView.prototype._addQueueHeadingToPopover): Ditto.
     39        (EWSQueueView.prototype._addBotsHeadingToPopover): Ditto.
     40        (EWSQueueView.prototype._addDividerToPopover): Ditto.
     41        (EWSQueueView.prototype._timeIntervalString): A helper to format a timestamp into a
     42        relative string.
     43        (EWSQueueView.prototype._popoverContentForEWSQueue): Build the popover.
     44        (EWSQueueView.prototype._presentPopoverForEWSQueue): Start loading data, and present
     45        it when done.
     46
     47        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Styles/QueueView.css:
     48        Added rules for EWS popover. Removed a duplicate rule for build-logs-popover.
     49        Changed a few difficult to read padding styles to padding-left.
     50
    1512014-01-20  Alexey Proskuryakov  <ap@apple.com>
    252
Note: See TracChangeset for help on using the changeset viewer.