HTTP Debug interface tweaks

This commit is contained in:
Paulus Schoutsen 2014-06-05 23:05:13 -07:00
parent 69882ff4cf
commit b09fe4a3a7
3 changed files with 24 additions and 16 deletions

View file

@ -351,7 +351,7 @@ class RequestHandler(BaseHTTPRequestHandler):
# Describe state machine:
write(("<div class='row'>"
"<div class='col-xs-12'>"
"<div class='panel panel-primary'>"
"<div class='states panel panel-primary'>"
"<div class='panel-heading'><h2 class='panel-title'>"
" States</h2></div>"
"<form method='post' action='/change_state' "
@ -378,9 +378,10 @@ class RequestHandler(BaseHTTPRequestHandler):
else:
action = SERVICE_TURN_ON
write((" (<a data-service='homeassistant/{}' "
"data-entity_id='{}' data-service-autofire='1' "
"href='#'>change</a>)").format(action, state.entity_id))
write(("<a class='glyphicon glyphicon-off pull-right' "
"data-service='homeassistant/{}' "
"data-entity_id='{}' data-service-autofire "
"href='#'></a>").format(action, state.entity_id))
write("</td><td>{}</td><td>{}</td></tr>".format(
attributes, util.datetime_to_str(state.last_changed)))
@ -413,12 +414,9 @@ class RequestHandler(BaseHTTPRequestHandler):
self.server.hass.services.services.items()):
write("<tr><td>{}</td><td>".format(domain))
for index, service in enumerate(services):
if index > 0:
write(", ")
write("<a href='#' data-service='{0}/{1}'>{1}</a>".format(
domain, service))
write(", ".join(
"<a href='#' data-service='{0}/{1}'>{1}</a>".format(
domain, service) for service in sorted(services)))
write("</td></tr>")

View file

@ -24,10 +24,11 @@ $(function() {
form.find("#service_data").val("");
}
if(el.attr("data-service-autofire")) {
// if it has the attirbute autofire we submit the form
if(el.is("[data-service-autofire]")) {
form.submit();
}
return false;
}).css('cursor', 'pointer')
})
})

View file

@ -1,5 +1,18 @@
@import url(//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.min.css);
.states td .glyphicon {
margin-top: 3px;
}
.states td:nth-child(3) {
max-width: 550px;
word-break: break-word;
}
.states td:nth-child(4) {
white-space: nowrap;
}
.panel > form, .panel > form > .table {
margin-bottom: 0;
}
@ -37,7 +50,3 @@
.form-fire-event .form-group:last-child {
margin-bottom: 0;
}
*[data-service] {
text-decoration: dashed;
}