Update bot watcher's dashboard to reflect that EWS is on iOS 9 now
[WebKit-https.git] / Tools / BuildSlaveSupport / build.webkit.org-config / public_html / dashboard / Scripts / BubbleQueueServer.js
1 /*
2  * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 BubbleQueueServer = function()
27 {
28     const queueInfo = {
29         "commit-queue": {platform: Dashboard.Platform.MacOSXMavericks, shortName: "commit", title: "Commit Queue"},
30         "style-queue": {shortName: "style", title: "Style Checker Queue"},
31         "gtk-wk2-ews": {platform: Dashboard.Platform.LinuxGTK, shortName: "gtk-wk2", title: "WebKit2\xa0Release\xa0Build\xa0EWS"},
32         "ios-ews": {platform: Dashboard.Platform.iOS9Device, shortName: "ios", title: "WebKit\xa0Release\xa0Build\xa0EWS"},
33         "mac-ews": {platform: Dashboard.Platform.MacOSXMavericks, shortName: "mac", title: "WebKit1\xa0Release\xa0Tests\xa0EWS"},
34         "mac-wk2-ews": {platform: Dashboard.Platform.MacOSXMavericks, shortName: "mac-wk2", title: "WebKit2\xa0Release\xa0Tests\xa0EWS"},
35         "win-ews": {platform: Dashboard.Platform.Windows7, shortName: "win", title: "WebKit1\xa0Release\xa0Build\xa0EWS"},
36         "efl-wk2-ews": {platform: Dashboard.Platform.LinuxEFL, shortName: "efl-wk2", title: "WebKit2\xa0Release\xa0Build\xa0EWS"}
37     };
38
39     BaseObject.call(this);
40
41     this.baseURL = "https://webkit-queues.webkit.org/";
42     this.queues = {};
43
44     for (var id in queueInfo)
45         this.queues[id] = new BubbleQueue(this, id, queueInfo[id]);
46 };
47
48 BaseObject.addConstructorFunctions(BubbleQueueServer);
49
50 BubbleQueueServer.prototype = {
51     constructor: BubbleQueueServer,
52     __proto__: BaseObject.prototype,
53
54     jsonQueueLengthURL: function(queueID)
55     {
56         return this.baseURL + "queue-length-json/" + encodeURIComponent(queueID);
57     },
58
59     jsonQueueStatusURL: function(queueID)
60     {
61         return this.baseURL + "queue-status-json/" + encodeURIComponent(queueID);
62     },
63
64     jsonProcessingTimesURL: function(fromTime, toTime)
65     {
66         return this.baseURL + "processing-times-json/" + [fromTime.getUTCFullYear(), fromTime.getUTCMonth() + 1, fromTime.getUTCDate(), fromTime.getUTCHours(), fromTime.getUTCMinutes(), fromTime.getUTCSeconds()].join("-")
67             + "-" + [toTime.getUTCFullYear(), toTime.getUTCMonth() + 1, toTime.getUTCDate(), toTime.getUTCHours(), toTime.getUTCMinutes(), toTime.getUTCSeconds()].join("-");
68     },
69
70     queueStatusURL: function(queueID)
71     {
72         return this.baseURL + "queue-status/" + encodeURIComponent(queueID);
73     },
74
75     // Retrieves information about all patches that were submitted in the time range:
76     // {
77     //     patch_id_1: {
78     //         queue_name_1: {
79     //             date: <date/time when the patch was submitted to the queue>,
80     //             retry_count: <number of times a bot had to bail out and drop the lock, for another bot to start from scratch>,
81     //             wait_duration: <how long it took before a bot first locked the patch for processing>,
82     //             process_duration: <how long it took from end of wait to finish, only valid for finished patches. Includes wait time between retries>
83     //             final_message: <(pass|fail|not processed|could not apply|internal error|in progress)>
84     //         },
85     //         ...
86     //     },
87     //     ...
88     // }
89     loadProcessingTimes: function(fromTime, toTime, callback)
90     {
91         JSON.load(this.jsonProcessingTimesURL(fromTime, toTime), function(data) {
92             for (patch in data) {
93                 for (queue in patch)
94                     queue.date = new Date(queue.date);
95             }
96             callback(data, fromTime, toTime);
97         }.bind(this));
98     },
99 };