Skip to content

Commit

Permalink
Bugid: 365, add custom properties fields to force and resubmit forms.
Browse files Browse the repository at this point in the history
    * buildbot/status/web/base.py: Part of this fix was already
      commited, but was funky to use in more than one place.  Refactored
      the change into a function.
    * buildbot/status/web/build.py: use the refactored function to add
      property fields to the resubmit form.
  • Loading branch information
Dan Locks committed Oct 2, 2009
1 parent 07b8e3d commit 32ebee2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
34 changes: 22 additions & 12 deletions buildbot/status/web/base.py
Expand Up @@ -84,6 +84,22 @@ def make_stop_form(stopURL, useUserPasswd, on_all=False, label="Build"):
data += '<input type="submit" value="Stop %s" /></form>\n' % label
return data

def make_extra_property_row(N):
"""helper function to create the html for adding extra build
properties to a forced (or resubmitted) build. "N" is an integer
inserted into the form names so that more than one property can be
used in the form.
"""
prop_html = '''
<div class="row">Property %(N)i
<span class="label">Name:</span>
<span class="field"><input type="text" name="property%(N)iname" /></span>
<span class="label">Value:</span>
<span class="field"><input type="text" name="property%(N)ivalue" /></span>
</div>
''' % {"N": N}
return prop_html

def make_force_build_form(forceURL, useUserPasswd, on_all=False):
if on_all:
data = """<form method="post" action="%s" class="command forcebuild">
Expand All @@ -101,15 +117,9 @@ def make_force_build_form(forceURL, useUserPasswd, on_all=False):
"<input type='text' name='branch' />")
+ make_row("Revision to build:",
"<input type='text' name='revision' />")
+ make_row("Property 1, ",
"Name: <input type='text' name='prop1name' /> " + \
"Value: <input type='text' name='prop1value' />")
+ make_row("Property 2, ",
"Name: <input type='text' name='prop2name' /> " + \
"Value: <input type='text' name='prop2value' />")
+ make_row("Property 3, ",
"Name: <input type='text' name='prop3name' /> " + \
"Value: <input type='text' name='prop3value' />")
+ make_extra_property_row(1)
+ make_extra_property_row(2)
+ make_extra_property_row(3)
+ '<input type="submit" value="Force Build" /></form>\n')

def td(text="", parms={}, **props):
Expand Down Expand Up @@ -300,10 +310,10 @@ def getChangemaster(self, request):
def path_to_root(self, request):
return path_to_root(request)

def footer(self, s, req):
def footer(self, status, req):
# TODO: this stuff should be generated by a template of some sort
projectURL = s.getProjectURL()
projectName = s.getProjectName()
projectURL = status.getProjectURL()
projectName = status.getProjectName()
data = '<hr /><div class="footer">\n'

welcomeurl = self.path_to_root(req) + "index.html"
Expand Down
8 changes: 6 additions & 2 deletions buildbot/status/web/build.py
Expand Up @@ -6,7 +6,9 @@
import urllib, time
from twisted.python import log
from buildbot.status.web.base import HtmlResource, make_row, make_stop_form, \
css_classes, path_to_builder, path_to_slave, make_name_user_passwd_form
make_extra_property_row, css_classes, path_to_builder, path_to_slave, \
make_name_user_passwd_form


from buildbot.status.web.tests import TestsResource
from buildbot.status.web.step import StepsResource
Expand All @@ -30,7 +32,6 @@ def getTitle(self, request):
def body(self, req):
b = self.build_status
status = self.getStatus(req)
projectURL = status.getProjectURL()
projectName = status.getProjectName()
data = ('<div class="title"><a href="%s">%s</a></div>\n'
% (self.path_to_root(req), projectName))
Expand Down Expand Up @@ -206,6 +207,9 @@ def body(self, req):
data += ('<form method="post" action="%s" class="command rebuild">\n'
% rebuildURL)
data += make_name_user_passwd_form(self.isUsingUserPasswd(req))
data += make_extra_property_row(1)
data += make_extra_property_row(2)
data += make_extra_property_row(3)
data += make_row("Reason for re-running build:",
"<input type='text' name='comments' />")
data += '<input type="submit" value="Rebuild" />\n'
Expand Down

0 comments on commit 32ebee2

Please sign in to comment.