def body(self, req): status = self.getStatus(req) authz = self.getAuthz(req) builders = req.args.get( "builder", status.getBuilderNames(categories=self.categories)) branches = [b for b in req.args.get("branch", []) if b] if not branches: branches = ["master"] if branches and "master" not in branches: defaultCount = "1" else: defaultCount = "10" num_builds = int(req.args.get("num_builds", [defaultCount])[0]) tag = tags.div() tag(tags.script(src="hlbb.js")) tag( tags.h2(style="float:left; margin-top:0")("Latest builds: ", ", ".join(branches))) form = tags.form(method="get", action="", style="float:right", onsubmit="return checkBranch(branch.value)") form( tags.input(type="test", name="branch", placeholder=branches[0], size="40")) form(tags.input(type="submit", value="View")) if (yield authz.actionAllowed('forceAllBuilds', req)): # XXX: Unsafe interpolation form( tags.button(type="button", onclick="forceBranch(branch.value || %r, %r)" % ( branches[0], self.categories, ))("Force")) tag(form) table = tags.table(style="clear:both") tag(table) for bn in filter(lambda bn: bn not in self.failing_builders, builders): table(self.builder_row(bn, req, branches, num_builds)) table(tags.tr()(tags.td(colspan="100")( tags.h3(style="float:left; margin-top:0")("Expected failures: ")))) for bn in filter(lambda bn: bn in self.failing_builders, builders): table(self.builder_row(bn, req, branches, num_builds)) defer.returnValue((yield flattenString(req, tag)))
def body(self, req): status = self.getStatus(req) authz = self.getAuthz(req) builders = req.args.get( "builder", status.getBuilderNames(categories=self.categories)) branches = [b for b in req.args.get("branch", []) if b] if not branches: branches = ["master"] if branches and "master" not in branches: defaultCount = "1" else: defaultCount = "10" num_builds = int(req.args.get("num_builds", [defaultCount])[0]) tag = tags.div() tag(tags.script(src="hlbb.js")) tag(tags.h2(style="float:left; margin-top:0") ("Latest builds: ", ", ".join(branches))) form = tags.form(method="get", action="", style="float:right", onsubmit="return checkBranch(branch.value)") form(tags.input(type="test", name="branch", placeholder=branches[0], size="40")) form(tags.input(type="submit", value="View")) if (yield authz.actionAllowed('forceAllBuilds', req)): # XXX: Unsafe interpolation form(tags.button( type="button", onclick="forceBranch(branch.value || %r, %r)" % (branches[0], self.categories,) )("Force")) tag(form) table = tags.table(style="clear:both") tag(table) for bn in filter(lambda bn: bn not in self.failing_builders, builders): table(self.builder_row(bn, req, branches, num_builds)) table(tags.tr()(tags.td(colspan="100")( tags.h3(style="float:left; margin-top:0") ("Expected failures: ")))) for bn in filter(lambda bn: bn in self.failing_builders, builders): table(self.builder_row(bn, req, branches, num_builds)) defer.returnValue((yield flattenString(req, tag)))
def world(self, request, tag, world): l = [] total = (len(world.chunk_cache) + len(world.dirty_chunk_cache) + len(world._pending_chunks)) l.append(tags.li("Total chunks: %d" % total)) l.append(tags.li("Clean chunks: %d" % len(world.chunk_cache))) l.append(tags.li("Dirty chunks: %d" % len(world.dirty_chunk_cache))) l.append(tags.li("Chunks being generated: %d" % len(world._pending_chunks))) if world.permanent_cache: l.append(tags.li("Permanent cache: enabled, %d chunks" % len(world.permanent_cache))) else: l.append(tags.li("Permanent cache: disabled")) status = tags.ul(*l) return tag(tags.h3("World status"), status)
def world(self, request, tag, world): l = [] total = (len(world.chunk_cache) + len(world.dirty_chunk_cache) + len(world._pending_chunks)) l.append(tags.li("Total chunks: %d" % total)) l.append(tags.li("Clean chunks: %d" % len(world.chunk_cache))) l.append(tags.li("Dirty chunks: %d" % len(world.dirty_chunk_cache))) l.append( tags.li("Chunks being generated: %d" % len(world._pending_chunks))) if world.permanent_cache: l.append( tags.li("Permanent cache: enabled, %d chunks" % len(world.permanent_cache))) else: l.append(tags.li("Permanent cache: disabled")) status = tags.ul(*l) return tag(tags.h3("World status"), status)
def bravofactory(self, request, tag, factory): g = (tags.li(username) for username in factory.protocols) users = tags.div(tags.h3("Users"), tags.ul(*g)) world = self.world(request, tags.div, factory.world) return tag(tags.h2("Bravo world %s" % factory.name), users, world)