Cleaning up the code
parent
3db43d6545
commit
506496743d
homeassistant
components/http
www_static
|
@ -18,7 +18,7 @@ import homeassistant.components as core_components
|
|||
import homeassistant.components.group as group
|
||||
|
||||
|
||||
# pylint: disable=too-many-branches
|
||||
# pylint: disable=too-many-branches, too-many-statements
|
||||
def from_config_dict(config, hass=None):
|
||||
"""
|
||||
Tries to configure Home Assistant from a config dict.
|
||||
|
|
|
@ -164,6 +164,7 @@ def setup(hass, config):
|
|||
class HomeAssistantHTTPServer(ThreadingMixIn, HTTPServer):
|
||||
""" Handle HTTP requests in a threaded fashion. """
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, server_address, RequestHandlerClass,
|
||||
hass, api_password, development=False):
|
||||
super().__init__(server_address, RequestHandlerClass)
|
||||
|
@ -182,7 +183,6 @@ class HomeAssistantHTTPServer(ThreadingMixIn, HTTPServer):
|
|||
|
||||
if development:
|
||||
self.logger.info("running frontend in development mode")
|
||||
|
||||
|
||||
def start(self):
|
||||
""" Starts the server. """
|
||||
|
@ -405,8 +405,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|||
" user-scalable=no, initial-scale=1.0, "
|
||||
" minimum-scale=1.0, maximum-scale=1.0' />"
|
||||
"</head>"
|
||||
"<body unresolved fullbleed"
|
||||
" style='background-color: #E5E5E5'>"
|
||||
"<body>"
|
||||
"<home-assistant-main auth='{}'></home-assistant-main>"
|
||||
"</body></html>").format(app_url, self.server.api_password))
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
height: 100%;
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
core-toolbar {
|
||||
|
@ -42,7 +43,7 @@
|
|||
|
||||
<home-assistant-api auth="{{auth}}" id="api"></home-assistant-api>
|
||||
|
||||
<core-header-panel layout>
|
||||
<core-header-panel unresolved fullbleed>
|
||||
|
||||
<core-toolbar>
|
||||
<div flex>
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
// from http://stackoverflow.com/questions/1403888/get-escaped-url-parameter
|
||||
function getURLParameter(name) {
|
||||
return decodeURI(
|
||||
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$(function() {
|
||||
$("[data-service]").click(function() {
|
||||
var form = $(".form-call-service");
|
||||
|
||||
var el = $(this);
|
||||
var parts = el.attr("data-service").split("/");
|
||||
|
||||
form.find("#domain").val(parts[0]);
|
||||
form.find("#service").val(parts[1]);
|
||||
|
||||
var entity_id = el.attr("data-entity_id");
|
||||
|
||||
if(entity_id) {
|
||||
form.find("#service_data").val(JSON.stringify({entity_id: entity_id}));
|
||||
} else {
|
||||
form.find("#service_data").val("");
|
||||
}
|
||||
|
||||
// if it has the attirbute autofire we submit the form
|
||||
if(el.is("[data-service-autofire]")) {
|
||||
form.submit();
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
})
|
|
@ -1,57 +0,0 @@
|
|||
@import url(//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.2/css/bootstrap.min.css);
|
||||
|
||||
.states td .glyphicon, .services td .glyphicon {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.states td:nth-child(1), .services td:nth-child(1) {
|
||||
width: 22px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.states td:nth-child(4) {
|
||||
max-width: 550px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.states td:nth-child(5) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.panel > form, .panel > form > .table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.panel .table {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
.form-signin {
|
||||
max-width: 330px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.form-signin .form-control {
|
||||
margin-top: 40px;
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
height: auto;
|
||||
padding: 10px;
|
||||
margin-bottom: -1px;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.form-signin .btn-primary {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
}
|
||||
|
||||
.form-fire-event, .form-call-service {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.form-fire-event .form-group:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
Loading…
Reference in New Issue