1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from twisted.internet import defer
17 from buildbot.status.web.base import HtmlResource
18 from buildbot.status.web.base import build_get_class, path_to_builder, path_to_build
19 from buildbot.sourcestamp import SourceStamp
22
24 - def getPageTitle(self, request):
25 status = self.getStatus(request)
26 p = status.getTitle()
27 if p:
28 return "BuildBot: %s" % p
29 else:
30 return "BuildBot"
31
32
33
35 if "reload" in request.args:
36 try:
37 reload_time = int(request.args["reload"][0])
38 return max(reload_time, 15)
39 except ValueError:
40 pass
41 return None
42
63
64 @defer.inlineCallbacks
89
91 """Given two source stamps, we want to assign them to the same row if
92 they are the same version of code, even if they differ in minor detail.
93
94 This function returns an appropriate comparison key for that.
95 """
96 return (ss.branch, ss.revision, ss.patch)
97
125
152
154
155 status = None
156 changemaster = None
157
158 @defer.inlineCallbacks
159 - def content(self, request, cxt):
160 """This method builds the regular grid display.
161 That is, build stamps across the top, build hosts down the left side
162 """
163
164
165 numBuilds = int(request.args.get("width", [5])[0])
166 categories = request.args.get("category", [])
167 branch = request.args.get("branch", [ANYBRANCH])[0]
168 if branch == 'trunk': branch = None
169
170
171 status = self.getStatus(request)
172 stamps = self.getRecentSourcestamps(status, numBuilds, categories, branch)
173
174 cxt['refresh'] = self.get_reload_time(request)
175
176 cxt.update({'categories': categories,
177 'branch': branch,
178 'ANYBRANCH': ANYBRANCH,
179 'stamps': map(SourceStamp.asDict, stamps)
180 })
181
182 sortedBuilderNames = status.getBuilderNames()[:]
183 sortedBuilderNames.sort()
184
185 cxt['builders'] = []
186
187 for bn in sortedBuilderNames:
188 builds = [None] * len(stamps)
189
190 builder = status.getBuilder(bn)
191 if categories and builder.category not in categories:
192 continue
193
194 for build in self.getRecentBuilds(builder, numBuilds, branch):
195
196 if len(build.getSourceStamps()) == 1:
197 ss = build.getSourceStamps(absolute=True)[0]
198 key= self.getSourceStampKey(ss)
199 for i in range(len(stamps)):
200 if key == self.getSourceStampKey(stamps[i]) and builds[i] is None:
201 builds[i] = build
202
203 b = yield self.builder_cxt(request, builder)
204
205 b['builds'] = []
206 for build in builds:
207 b['builds'].append(self.build_cxt(request, build))
208
209 cxt['builders'].append(b)
210
211 template = request.site.buildbot_service.templates.get_template("grid.html")
212 defer.returnValue(template.render(**cxt))
213
216
217 status = None
218 changemaster = None
219 default_rev_order = "asc"
220
221 @defer.inlineCallbacks
222 - def content(self, request, cxt):
223 """This method builds the transposed grid display.
224 That is, build hosts across the top, build stamps down the left side
225 """
226
227
228 numBuilds = int(request.args.get("length", [5])[0])
229 categories = request.args.get("category", [])
230 branch = request.args.get("branch", [ANYBRANCH])[0]
231 if branch == 'trunk': branch = None
232
233 rev_order = request.args.get("rev_order", [self.default_rev_order])[0]
234 if rev_order not in ["asc", "desc"]:
235 rev_order = self.default_rev_order
236
237 cxt['refresh'] = self.get_reload_time(request)
238
239
240 status = self.getStatus(request)
241 stamps = self.getRecentSourcestamps(status, numBuilds, categories, branch)
242
243 cxt.update({'categories': categories,
244 'branch': branch,
245 'ANYBRANCH': ANYBRANCH,
246 'stamps': map(SourceStamp.asDict, stamps),
247 })
248
249 sortedBuilderNames = status.getBuilderNames()[:]
250 sortedBuilderNames.sort()
251
252 cxt['sorted_builder_names'] = sortedBuilderNames
253 cxt['builder_builds'] = builder_builds = []
254 cxt['builders'] = builders = []
255 cxt['range'] = range(len(stamps))
256 if rev_order == "desc":
257 cxt['range'].reverse()
258
259 for bn in sortedBuilderNames:
260 builds = [None] * len(stamps)
261
262 builder = status.getBuilder(bn)
263 if categories and builder.category not in categories:
264 continue
265
266 for build in self.getRecentBuilds(builder, numBuilds, branch):
267
268 if len(build.getSourceStamps()) == 1:
269 ss = build.getSourceStamps(absolute=True)[0]
270 key = self.getSourceStampKey(ss)
271 for i in range(len(stamps)):
272 if key == self.getSourceStampKey(stamps[i]) and builds[i] is None:
273 builds[i] = build
274
275 b = yield self.builder_cxt(request, builder)
276 builders.append(b)
277
278 builder_builds.append(map(lambda b: self.build_cxt(request, b), builds))
279
280 template = request.site.buildbot_service.templates.get_template('grid_transposed.html')
281 defer.returnValue(template.render(**cxt))
282