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

Side by Side Diff: dashboard/dashboard/elements/bug-details.html

Issue 2706813003: Add new endpoint to get bug details as JSON. (Closed)
Patch Set: Added polymer ui Created 3 years, 10 months 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 <!DOCTYPE html>
2 <!--
3 Copyright 2017 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
6 -->
7 <link rel="import" href="/components/polymer/polymer.html">
8
9 <link rel="import" href="/dashboard/static/simple_xhr.html">
10
11 <dom-module id="bug-details">
12 <style>
13 .error {
14 color: #dd4b39;
15 font-weight: bold;
16 }
17
18 #loading-spinner {
19 width: 100%;
20 display: flex;
21 justify-content: center;
22 }
23
24 .container {
25 padding: 20px;
26 background-color: #eaeaea;
27 border-radius: 4px;
28 margin: 20px;
29 width: 600px;
30 }
31
32 .bordered-cell {
33 border: 1px solid #a8a8a8;
34 border-radius: 4px;
35 }
36
37 td {
38 padding-left, padding-right: 10px;
39 }
40 </style>
41 <template>
42 <template is="dom-if" if="{{loading}}">
43 <div id="loading-spinner"><img src="//www.google.com/images/loading.gif">< /div>
44 </template>
45 <template is="dom-if" if="{{error}}">
46 <div class="error">{{error}}</div>
47 </template>
48 <template is="dom-if" if="{{computeSuccessfulLoad(loading, error)}}">
49 <table class="container">
50 <tr><th colspan="2">Bug {{bugId}}</th></tr>
51 <tr><td colspan="2">{{summary}}</td></tr>
52 <tr><td>Filed</td><td>{{formatDate(published)}}</td></tr>
53 <tr><td>Owner</td><td>{{owner}}</td></tr>
54 <tr><td>State</td><td>{{state}}</td></tr>
55 <tr><td>Status</td><td>{{status}}</td></tr>
56 <template is="dom-if" if="{{bisects.length}}">
57 <tr>
58 <td class="bordered-cell">Bisects</td>
59 <td class="bordered-cell"><ul><template is="dom-repeat" items="{{bis ects}}">
60 <li><a href="{{item.buildbucket_link}}">{{item.metric}} on {{item. bot}}</a>: {{item.status}}
61 </template></ul></td>
62 </tr>
63 </template>
64 <template is="dom-if" if="{{reviewUrls.length}}">
65 <tr>
66 <td class="bordered-cell">Changelists</td>
67 <td class="bordered-cell"><ul><template is="dom-repeat" items="{{rev iewUrls}}">
68 <li><a href="{{item}}">{{item}}</a>
69 </template></ul></td>
70 </tr>
71 </template>
72 </table>
73 </template>
74 </template>
75 <script>
76 'use strict';
77 Polymer({
78 is: 'bug-details',
79 properties: {
80 bisects: {
81 notify: true,
82 type: Array
83 },
84 bugId: {
85 notify: true,
86 type: Number
87 },
88 comments: {
89 notify: true,
90 type: Array
91 },
92 error: {
93 notify: true,
94 type: Boolean,
95 value: false
96 },
97 loading: {
98 notify: true,
99 type: Boolean,
100 value: true
101 },
102 owner: {
103 notify: true,
104 type: String
105 },
106 published: {
107 notify: true
108 },
109 reviewUrls: {
110 notify: true,
111 type: Array
112 },
113 state: {
114 notify: true,
115 type: String
116 },
117 status: {
118 notify: true,
119 type: String
120 },
121 summary: {
122 notify: true,
123 type: String
124 }
125 },
126
127 computeSuccessfulLoad: (loading, error) => !(loading || error),
128
129 formatDate: d => d.getFullYear() + '-' + d.getMonth() + '-' + d.getDate(),
130
131 attached: function() {
132 var params = {
133 'bug_id': this.bugId
134 };
135 simple_xhr.send('/bug_details', params,
136 response => {
137 this.bisects = response['bisects'];
138 this.comments = response['comments'];
139 this.owner = response['owner'];
140 this.published = new Date(response['published']);
141 this.reviewUrls = response['review_urls'];
142 this.state = response['state'];
143 this.status = response['status'];
144 this.summary = response['summary'];
145 this.loading = false;
146 },
147 errorMsg => {
148 this.error = errorMsg;
149 this.loading = false;
150 });
151 }
152 });
153 </script>
154 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698