Ticket #138: 0003-Add-a-Stop-Builder-button-next-to-the-Force-Build.patch

File 0003-Add-a-Stop-Builder-button-next-to-the-Force-Build.patch, 1.6 KB (added by tsuna, 4 years ago)

[PATCH 03/11] Add a Stop Builder' button next to the Force Build' one.

  • buildbot/status/web/builder.py

    From 5927ce7489892dae91d8aabf09c870a0d93190fe Mon Sep 17 00:00:00 2001
    From: Benoit Sigoure <tsuna@lrde.epita.fr>
    Date: Wed, 7 Nov 2007 23:26:19 +0100
    Subject: [PATCH 03/11] Add a `Stop Builder' button next to the `Force Build' one.
    
    	I find it more convenient and natural to be able to start/stop
    	builds from the same page.
    	* buildbot/status/web/builder.py (StatusResourceBuilder.build_line):
    	Here.
    
    Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
    ---
     buildbot/status/web/builder.py |    9 +++++++++
     1 files changed, 9 insertions(+), 0 deletions(-)
    
    diff --git a/buildbot/status/web/builder.py b/buildbot/status/web/builder.py
    index e56d1fd..4cabf0d 100644
    a b class StatusResourceBuilder(HtmlResource, OneLineMixin): 
    2828        buildnum = build.getNumber() 
    2929        buildurl = req.childLink("builds/%d" % buildnum) 
    3030        data = '<a href="%s">#%d</a> ' % (buildurl, buildnum) 
     31 
    3132        when = build.getETA() 
    3233        if when is not None: 
    3334            when_time = time.strftime("%H:%M:%S", 
    3435                                      time.localtime(time.time() + when)) 
    3536            data += "ETA %ds (%s) " % (when, when_time) 
    3637        data += "[%s]" % build.getCurrentStep().getName() 
     38 
     39        if self.builder_control is not None: 
     40            stopURL = urllib.quote(req.childLink("builds/%d/stop" % buildnum)) 
     41            data += ''' 
     42<form action="%s" class="command stopbuild" style="display:inline"> 
     43  <input type="submit" value="Stop Builder" /> 
     44</form>''' % stopURL 
     45 
    3746        return data 
    3847 
    3948    def body(self, req):