OLD | NEW |
---|---|
(Empty) | |
1 <!-- | |
2 The common.js file must be included before this file. | |
3 | |
4 This in an HTML Import-able file that contains the definition | |
5 of the following elements: | |
6 | |
7 <fuzzer-collapse-details-sk> | |
8 | |
9 To use this file import it: | |
10 | |
11 <link href="/res/imp/fuzzer-collapse-details-sk.html" rel="import" /> | |
12 | |
13 Usage: | |
14 | |
15 <fuzzer-collapse-details-sk></fuzzer-collapse-details-sk> | |
16 | |
17 Properties: | |
18 details - The details object. Expected to have the following attributes: | |
19 lineNumber: Number, | |
20 apiCount: Number, | |
21 binaryCount: Number, | |
22 binaryReports: [optional] Array of Reports. If supplied, | |
23 an expandable details panel will be created containing representations o f the reports. | |
24 If omitted, just the summary will be shown. | |
25 Reports are objects and have the following attributes: | |
26 - binaryName: String, The name of the binary, likely an md5 hash | |
27 - binaryType: String, The type of the binary | |
28 - flags: Array of String, The flags associated with the run (e.g. DebugD umped) | |
29 - debugStackTrace: Object (see fuzzer-stacktrace-sk.html for schema) | |
30 - releaseStackTrace: Object (see fuzzer-stacktrace-sk.html for schema) | |
31 | |
32 Methods: | |
33 setDetails(details) - Programmatically set the details object. | |
34 showMore() - Programmatically show up to 6 more details panels. | |
35 showFewer() - Programmatically show up to 6 fewer details panels. | |
36 toggleDetails() - Programmticaly hide/show the details panels. | |
37 | |
38 Events: | |
39 None. | |
40 --> | |
41 <link rel="import" href="/res/imp/bower_components/iron-flex-layout/iron-flex-la yout.html"> | |
42 <link rel="import" href="/res/imp/bower_components/iron-collapse/iron-collapse.h tml"> | |
43 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l"> | |
44 <link rel="import" href="fuzzer-stacktrace-sk.html"> | |
45 <dom-module id="fuzzer-collapse-details-sk"> | |
46 <template> | |
47 <style> | |
48 #wrapper { | |
49 padding: 16px; | |
50 border-radius: 8px; | |
51 background-color: #DEDEDE; | |
52 color: #000000; | |
53 } | |
54 | |
55 #indicator { | |
56 cursor: pointer; | |
57 margin: 1px 6px 1px 1px; | |
58 /*Make the indicator icon a bit smaller than normal*/ | |
59 --iron-icon-height: 20px; | |
60 --iron-icon-width: 20px; | |
61 } | |
62 | |
63 #indicator.toggled { | |
64 transform: rotate(.25turn); | |
65 } | |
66 | |
67 .panel-container { | |
68 @apply(--layout-horizontal); | |
69 @apply(--layout-wrap); | |
70 @apply(--layout-start); | |
71 } | |
72 | |
73 .panel-container .title { | |
74 display: inline-block; | |
75 margin-top: .5em; | |
76 font-weight: bold; | |
77 font-size: 1.1em; | |
78 } | |
79 | |
80 .panel { | |
81 min-width: 100px; | |
82 max-width: 600px; | |
83 background-color: lightblue; | |
84 border-radius: 6px; | |
85 margin: 4px; | |
86 padding: 5px; | |
87 } | |
88 | |
89 .raw { | |
90 font-size: 0.7em; | |
91 display: inline-block; | |
92 } | |
93 | |
94 .show-more-less-bar { | |
95 @apply(--layout-horizontal); | |
96 width: 100%; | |
97 background-color: white; | |
98 border-radius: 8px; | |
99 } | |
100 | |
101 .show-more-less-bar .status { | |
102 @apply(--layout-horizontal); | |
103 @apply(--layout-flex); | |
104 } | |
105 | |
106 .center { | |
107 margin: auto; | |
108 } | |
109 </style> | |
110 <div id="wrapper"> | |
111 <template is="dom-if" if="{{!_hasDetails(details)}}"> | |
112 <li>line {{details.lineNumber}} -- {{totalCount}} outstanding fuzzes: {{ details.binaryCount}} binary and {{details.apiCount}} api</li> | |
113 </template> | |
114 <template is="dom-if" if="{{_hasDetails(details)}}"> | |
115 <li> | |
116 <iron-icon role="button" id="indicator" icon="icons:send" on-click="to ggleDetails" title="Click to toggle line number view"></iron-icon> | |
117 <span>line {{details.lineNumber}} -- {{totalCount}} outstanding fuzzes : {{details.binaryCount}} binary and {{details.apiCount}} api</span> | |
118 </li> | |
119 <iron-collapse id="detailsPanel"> | |
120 <div class="panel-container"> | |
121 <template is="dom-repeat" items="{{reports}}" as="report"> | |
122 <div class="panel"> | |
123 <span class="title">File: <a href$="{{_getDownloadLink(report)}} ">{{report.binaryName}}.{{report.binaryType}}</a></span> | |
124 <span class="raw"> | |
125 <a href$="{{_getErrLink(report,'debug')}}">debug_err</a> | |
126 <a href$="{{_getErrLink(report,'release')}}">release_err</a> | |
127 <a href$="{{_getDumpLink(report,'debug')}}">debug_dump</a> | |
128 <a href$="{{_getDumpLink(report,'release')}}">release_dump</a> | |
129 </span> | |
130 <div>{{_getFlags(report)}}</div> | |
131 <h4>Debug Stack Trace</h4> | |
132 <fuzzer-stacktrace-sk trace="{{report.debugStackTrace}}"></fuzze r-stacktrace-sk> | |
133 <h4>Release Stack Trace</h4> | |
134 <fuzzer-stacktrace-sk trace="{{report.releaseStackTrace}}"></fuz zer-stacktrace-sk> | |
135 </div> | |
136 </template> | |
137 <div class="show-more-less-bar"> | |
138 <paper-button disabled$="{{!hasFewer}}" on-click="showFewer">Show Fewer</paper-button> | |
139 <span class="status"> | |
140 <span class="center">Showing {{toShow}}/{{totalCount}}</span> | |
jcgregorio
2015/11/06 16:40:45
indent
| |
141 </span> | |
142 <paper-button disabled$="{{!hasMore}}" on-click="showMore">Show Mo re</paper-button> | |
143 </div> | |
144 <div> | |
145 </iron-collapse> | |
146 </template> | |
147 </div> | |
148 </template> | |
149 <script> | |
150 Polymer({ | |
151 is: 'fuzzer-collapse-details-sk', | |
152 | |
153 properties: { | |
154 details: { //expected to be provided | |
155 type: Object, | |
156 value: function() { | |
157 return {}; | |
158 } | |
159 }, | |
160 // Returns the total count of fuzzes represented here. | |
161 totalCount: { | |
162 type: Number, | |
163 computed: "_getTotalCount(details)", | |
164 }, | |
165 // The number of detail panels to show | |
166 toShow: { | |
167 type: Number, | |
168 value: 0, | |
169 readOnly: true, | |
170 }, | |
171 // Returns true if there are more detail panels to show | |
172 hasMore: { | |
173 type: Boolean, | |
174 computed: "_hasMore(details, toShow)" | |
175 }, | |
176 // Returns true if there are not 0 detail panels currently displayed. | |
177 hasFewer: { | |
178 type: Boolean, | |
179 computed: "_hasFewer(toShow)" | |
180 }, | |
181 // Returns the amount of detail panels equal to 'toShow' | |
182 reports: { | |
183 type: Array, | |
184 computed: "_getSomeReports(details, toShow)", | |
185 } | |
186 }, | |
187 | |
188 ready: function() { | |
189 if (this.details.binaryReports) { | |
190 this._setToShow(Math.min(6, this.details.binaryReports.length)); | |
191 } | |
192 }, | |
193 | |
194 setDetails: function(details) { | |
195 this.details = details; | |
196 this._setToShow(Math.min(6, this.details.binaryReports.length)); | |
197 }, | |
198 | |
199 _getTotalCount: function(details) { | |
200 return details.binaryCount + details.apiCount; | |
201 }, | |
202 | |
203 _hasDetails: function(details) { | |
204 return this.details.binaryReports && this.details.binaryReports.length > 0 ; | |
205 }, | |
206 | |
207 _getFlags: function(report) { | |
208 return report.flags.join(" | "); | |
209 }, | |
210 | |
211 showMore: function() { | |
212 this._setToShow(Math.min(this.toShow + 6, this.details.binaryReports.lengt h)); | |
213 }, | |
214 | |
215 showFewer: function() { | |
216 this._setToShow(Math.max(this.toShow - 6, 0)); | |
217 }, | |
218 | |
219 _hasMore: function(details, toShow) { | |
220 return details.binaryReports && toShow < details.binaryReports.length; | |
221 }, | |
222 | |
223 _hasFewer: function(toShow) { | |
224 return toShow > 0; | |
225 }, | |
226 | |
227 // _getSomeReports returns up to {{toShow}} reports from details | |
228 _getSomeReports: function(details, toShow) { | |
229 if (!details.binaryReports) { | |
230 return []; | |
231 } | |
232 if (toShow > details.binaryReports.length) { | |
233 return details.binaryReports; | |
234 } | |
235 return details.binaryReports.slice(0, toShow); | |
236 }, | |
237 | |
238 _getDownloadLink: function(report) { | |
239 return "/fuzz/binary/" + report.binaryType + "/" + report.binaryName; | |
240 }, | |
241 | |
242 _getErrLink: function(report, type) { | |
243 return "/err/" + type + "/" + report.binaryName; | |
244 }, | |
245 | |
246 _getDumpLink: function(report, type) { | |
247 return "/dump/" + type + "/" + report.binaryName; | |
248 }, | |
249 | |
250 toggleDetails: function() { | |
251 this.$$("#detailsPanel").toggle(); | |
252 this.$$("#indicator").toggleClass("toggled"); | |
253 } | |
254 }); | |
255 </script> | |
256 </dom-module> | |
OLD | NEW |