Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: masters/master.chromium/public_html/common-resources/milo.js

Issue 2491643003: Update waterfall templates to include Milo link. (Closed)
Patch Set: Remove superfluous comment. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function MiloInject(root, mastername) {
6 // Get our ".header" <div> (in "layout.html").
7 var header = document.querySelector(".header");
8 if (! header) {
9 return;
10 }
11
12 // Do we have a Milo substitution available?
13 var path = window.location.pathname;
14 var desc = null;
15 var miloPath = path;
16 [
17 {
18 re: /^(?:\/[ip]\/([^\/]+))?\/builders\/([^\/]+)$/,
19 desc: "builder faster",
20 replacer: function(match, master, builder, offset, string) {
21 master = mastername || master;
22 if (! master) {
23 return string;
24 }
25 return ["buildbot", master, builder].join("/");
26 },
27 },
28 {
29 re: /^(?:\/[ip]\/([^\/]+))?\/builders\/([^\/]+)\/builds\/([^\/]+)\/$/,
30 desc: "build faster and forever",
31 replacer: function(match, master, builder, buildno, offset, string) {
32 master = mastername || master;
33 if (! master) {
34 return string;
35 }
36 return ["buildbot", master, builder, buildno].join("/");
37 },
38 },
39 ].every(function(e) {
40 miloPath = path.replace(e.re, e.replacer);
41 desc = e.desc;
42 return (miloPath === path);
43 });
44 if (miloPath === path) {
45 return;
46 }
47
48 // Build our milo elements.
49 miloPath = "https://luci-milo.appspot.com/" + miloPath;
50 var miloElement = document.createElement("span");
51 miloElement.className = "header-right-align";
52 miloElement.innerHTML += `
53 <div class="milo-container">
54 <a class="milo-link" href="${miloPath}">
55 <img class=".milo-logo"
56 src="${root}common-resources/chrome-infra-logo-32x32.png" /><!--
57 -->[LogDog]</a>
58 <div class="milo-info">
59 <div>View this ${desc} with LogDog / Milo!</div>
60 <p></p>
61 <div><a href="${miloPath}">Permalink</a></div>
62 <p></p>
63 <div class="milo-cit-info">
64 <img src="${root}common-resources/chrome-infra-logo-32x32.png"></img>
65 <span>Part of Chrome Infrastructure Team's LUCI project.</span>
66 </div>
67 </div>
68 </div>
69 `;
70 header.appendChild(miloElement);
71 }
OLDNEW
« no previous file with comments | « masters/master.chromium/public_html/common-resources/milo.css ('k') | masters/master.chromium/templates/layout.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698