2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 17:43:14 +00:00

Rework the 'update' button for clearer use alongside other buttons

This commit is contained in:
Jarrod Johnson 2013-11-22 18:27:15 -05:00
parent 163f96177a
commit 343600c2aa
3 changed files with 12 additions and 4 deletions

View File

@ -257,7 +257,6 @@ def _assemble_html(responses, resource, querydict, url):
yield '<hr>'
yield 'Only fields that have their boxes checked will have their '
yield 'respective values honored by the confluent server.<hr>'
yield '<input type="hidden" name="restexplorerop" value="update">'
yield '<input type="hidden" name="restexplorerhonorkey" value="">'
yield '<a rel="self" href="%s">%s</a><br>' % (resource, resource)
if url == '/':
@ -279,7 +278,9 @@ def _assemble_html(responses, resource, querydict, url):
yield rsp.html()
yield "<br>"
if not iscollection:
yield '<input value="PUT" type="submit"></form></body></html>'
yield '<input value="update" name="restexplorerop" type="submit"></form></body></html>'
else:
yield '<input type="hidden" name="restexplorerop" value="update">'
def _assemble_json(responses, resource, url):

View File

@ -98,6 +98,7 @@ class LinkRelation(ConfluentMessage):
This is used by the API explorer aspect of httpapi"""
return '<a href="%s" rel="%s">%s</a>' % (self.href, self.rel, self.href)
#return '<a href="%s" rel="%s">%s</a><input type="submit" name="restexprerorop" value="delete:%s"' % (self.href, self.rel, self.href, self.href)
@ -187,7 +188,7 @@ class BootDevice(ConfluentChoiceMessage):
def __init__(self, node, device):
if device not in self.valid_values:
raise Exception("Invalid boot device argument passed in")
raise Exception("Invalid boot device argument passed in: %s" % device)
self.kvpairs = {
node: {
'bootdevice': { 'value': device },

View File

@ -251,6 +251,9 @@ class IpmiHandler(object):
def handle_request(self):
while not self.loggedin:
wait_on_ipmi()
bootdevices = {
'optical': 'cd'
}
if self.element == [ 'power', 'state' ]:
if 'read' == self.op:
power = self.call_ipmicmd(self.ipmicmd.get_power)
@ -266,12 +269,15 @@ class IpmiHandler(object):
elif self.element == [ 'boot', 'device' ]:
if 'read' == self.op:
bootdev = self.call_ipmicmd(self.ipmicmd.get_bootdev)
print repr(bootdev)
if bootdev['bootdev'] in bootdevices:
bootdev['bootdev'] = bootdevices[bootdev['bootdev']]
return msg.BootDevice(node=self.node,
device=bootdev['bootdev'])
elif 'update' == self.op:
bootdev = self.inputdata.bootdevice(self.node)
bootdev = self.call_ipmicmd(self.ipmicmd.set_bootdev, bootdev)
if bootdev['bootdev'] in bootdevices:
bootdev['bootdev'] = bootdevices[bootdev['bootdev']]
return msg.BootDevice(node=self.node,
device=bootdev['bootdev'])