[Demi-commits] r71 - / web web/templates

John Morrissey jwm-guest at costa.debian.org
Mon Jan 30 19:21:01 UTC 2006


Author: jwm-guest
Date: 2006-01-30 19:20:58 +0000 (Mon, 30 Jan 2006)
New Revision: 71

Modified:
   TODO
   web/command.py
   web/templates/command_list.tmpl
   web/templates/machine_detail.tmpl
Log:
add Retry button for failed commands


Modified: TODO
===================================================================
--- TODO	2006-01-30 19:19:41 UTC (rev 70)
+++ TODO	2006-01-30 19:20:58 UTC (rev 71)
@@ -2,7 +2,6 @@
 autodetect demi web root
   req.uri, req.filename, and/or req.path_info seem useful
 e-mail on new/updated DSAs
-"try it again" button for failed commands
 better transport of machine data
   leo's thinking about
   dconf with a demi-specific config

Modified: web/command.py
===================================================================
--- web/command.py	2006-01-30 19:19:41 UTC (rev 70)
+++ web/command.py	2006-01-30 19:20:58 UTC (rev 71)
@@ -18,11 +18,13 @@
 #
 # $Id$
 
-from mod_python   import apache
+from mod_python       import apache
 from Cheetah.Template import Template
-from demi.command import Command, getCommands
-from demi.machine import Machine
 
+from demi.command       import Command, getCommands
+from demi.remotecommand import RemoteCommand
+from demi.machine       import Machine
+
 def pending(req):
 	t = Template(file = req.hlist.directory + "/templates/command_list.tmpl")
 	t.req = req
@@ -60,15 +62,24 @@
 		t.title += "s"
 	return t
 
-def archive(req, cid):
+def action(req, action, cid):
 	if type(cid) != type([]):
 		cid = [cid]
 
 	for c in getCommands(ids = cid):
-		if c.status == Command.STATUS_PENDING:
-			# FIXME: display notification that this failed.
-			continue
-		c.archive()
+		if action == "Archive":
+			if c.status == Command.STATUS_PENDING:
+				# FIXME: display notification that this failed.
+				continue
+			c.archive()
+		elif action == "Retry":
+			if c.status != Command.STATUS_FAILED:
+				# FIXME: display notification that this failed.
+				continue
+			repush = RemoteCommand(c.command.split()[0], c.command.split()[1:])
+			repush.push(Machine(id = c.mid))
+			c.archive()
+		# FIXME: else, notify of invalid action.
 
 	# FIXME: display notification that this was successful.
 

Modified: web/templates/command_list.tmpl
===================================================================
--- web/templates/command_list.tmpl	2006-01-30 19:19:41 UTC (rev 70)
+++ web/templates/command_list.tmpl	2006-01-30 19:20:58 UTC (rev 71)
@@ -7,7 +7,7 @@
 	#echo cgi.escape($title)
 </h2>
 
-<form method="post" action="/command/archive">
+<form method="post" action="/command/action">
 <table class="list highlightRows">
 <thead>
 	<tr>
@@ -106,6 +106,12 @@
 			#if $showArchive
 				<span class="floatLeft">
 					<input type="submit" name="action" value="Archive" />
+					#for $command in $commands
+						#if $command.status == Command.STATUS_FAILED
+							<input type="submit" name="action" value="Retry" />
+							#break
+						#end if
+					#end for
 				</span>
 			#end if
 			<span class="floatRight">

Modified: web/templates/machine_detail.tmpl
===================================================================
--- web/templates/machine_detail.tmpl	2006-01-30 19:19:41 UTC (rev 70)
+++ web/templates/machine_detail.tmpl	2006-01-30 19:20:58 UTC (rev 71)
@@ -50,7 +50,7 @@
 	Recent Commands
 </h2>
 
-<form method="post" action="/command/archive">
+<form method="post" action="/command/action">
 <table class="list highlightRows">
 <thead>
 	<tr>




More information about the Demi-commits mailing list