Commit 8aef786d authored by Daniele Venzano's avatar Daniele Venzano 🏇

Merge branch 'devel/fixes' into 'master'

Fixes for small bugs reported on github

See merge request !13
parents 601bc856 2a78b2d6
......@@ -36,6 +36,7 @@ def web_init(api_endpoint) -> List[tornado.web.URLSpec]:
tornado.web.url(r'/', zoe_api.web.start.RootWeb, route_args, name='root'),
tornado.web.url(r'/user', zoe_api.web.start.HomeWeb, route_args, name='home_user'),
tornado.web.url(r'/login', zoe_api.web.start.LoginWeb, route_args, name='login'),
tornado.web.url(r'/logout', zoe_api.web.start.LogoutWeb, route_args, name='logout'),
tornado.web.url(r'/executions/new', zoe_api.web.executions.ExecutionDefineWeb, route_args, name='execution_define'),
tornado.web.url(r'/executions/start', zoe_api.web.executions.ExecutionStartWeb, route_args, name='execution_start'),
......
......@@ -33,11 +33,15 @@ class ExecutionDefineWeb(ZoeRequestHandler):
@catch_exceptions
def get(self):
"""Define a new execution."""
uid, role_ = get_auth(self)
uid, role = get_auth(self)
if uid is None:
return self.redirect(self.get_argument('next', u'/login'))
self.render('execution_new.html')
template_vars = {
"uid": uid,
"role": role,
}
self.render('execution_new.html', **template_vars)
class ExecutionStartWeb(ZoeRequestHandler):
......@@ -146,6 +150,8 @@ class ExecutionInspectWeb(ZoeRequestHandler):
endpoints = self.api_endpoint.execution_endpoints(uid, role, e)[1]
template_vars = {
"uid": uid,
"role": role,
"e": e,
"services_info": services_info,
"endpoints": endpoints,
......@@ -168,9 +174,10 @@ class ServiceLogsWeb(ZoeRequestHandler):
return self.redirect(self.get_argument('next', u'/login'))
service = self.api_endpoint.service_by_id(uid, role, service_id)
#log_obj = self.api_endpoint.service_logs(uid, role, service_id, stream=True)
template_vars = {
"uid": uid,
"role": role,
"service": service,
}
self.render('service_logs.html', **template_vars)
......@@ -58,6 +58,20 @@ class LoginWeb(ZoeRequestHandler):
self.redirect(self.get_argument("next", u"/user"))
class LogoutWeb(ZoeRequestHandler):
"""The logout web page."""
def initialize(self, **kwargs):
"""Initializes the request handler."""
super().initialize(**kwargs)
self.api_endpoint = kwargs['api_endpoint'] # type: APIEndpoint
@catch_exceptions
def get(self):
"""Login page."""
self.clear_cookie('zoe')
self.redirect(self.get_argument("next", u"/login"))
class HomeWeb(ZoeRequestHandler):
"""Handler class"""
def initialize(self, **kwargs):
......@@ -78,6 +92,8 @@ class HomeWeb(ZoeRequestHandler):
executions = self.api_endpoint.execution_list(uid, role)
template_vars = {
"uid": uid,
"role": role,
'executions': sorted(executions, key=lambda e: e.id),
'is_admin': role == 'admin',
}
......
......@@ -40,31 +40,10 @@ div.status_line {
float: left;
}
span#app_name {
font-family: cursive;
font-size: larger;
}
span#status {
#footer {
font-size: smaller;
}
div.copyright {
float: left;
padding-left: 3em;
}
textarea#log {
width: 90%;
height: 40em;
}
span.fakelink {
color: rgba(79, 140, 30, 1);
text-decoration: none;
cursor: pointer;
}
#wrapper {
width: 800px;
}
......@@ -87,31 +66,6 @@ label.error {
position: relative;
}
.wizard {
background-color: #fff;
border: #ddd 1px solid;
border-radius: 10px;
margin: 10px;
padding: 10px;
}
.wizard .wizard-header {
background-color: #f4f4f4;
border-bottom: #ddd 1px solid;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
padding: 5px 10px;
margin: 0 0 10px 0;
}
.wizard .wizard-step {
margin: 10px 0;
}
.wizard .wizard-step p {
padding: 5px;
}
.navigation {
border-top: #ddd 1px solid;
margin-top: 10px;
......@@ -171,3 +125,11 @@ textarea.logoutput {
overflow-x: auto;
overflow-y: auto;
}
#userinfo {
position: absolute;
top: 0;
right: 0;
padding-right: 1em;
padding-top: 0.4em;
}
......@@ -49,23 +49,30 @@
document.write((bytes / Math.pow(k, i)).toPrecision(dm) + ' ' + sizes[i]);
}
</script>
{% if uid %}
<div id="userinfo">
{{ uid }} ({{ role }}) <a href="{{ reverse_url("logout") }}">logout</a>
</div>
{% endif %}
<div id="content">{% block content %}{% endblock %}</div>
<div id="footer">
{% block footer %}
<div class="status_line">
<p>
<span id="app_name"><a href="http://zoe-analytics.eu">Zoe</a> v. {{ zoe_version }}</span>
<span id="app_name">
<a href="http://zoe-analytics.eu">Zoe</a> v. {{ zoe_version }}
</span>
<!-- <span id="status">
[<span id="num_nodes">N/A</span> swarm nodes, <span id="num_containers">N/A</span> active containers]
</span> -->
&nbsp;&mdash;&nbsp;
<span>
&mdash;Submit issues and ideas for improvement at <a href="https://github.com/DistributedSystemsGroup/zoe/issues">Zoe's issue tracker</a>.
<a href="https://github.com/DistributedSystemsGroup/zoe/issues">Give us some feedback!</a>
</span>
&nbsp;&mdash;&nbsp;
<span>&copy; Copyright 2017 by <a href="http://distsysgroup.wordpress.com/">DSG</a></span>
</p>
</div>
<div class="copyright">
<h6>&copy; Copyright 2016 by <a href="http://distsysgroup.wordpress.com/">DSG</a></h6>
</div>
{% endblock %}
</div>
</body>
......
......@@ -3,8 +3,3 @@
{% block content %}
{{ super() }}
{% endblock %}
{% block footer %}
<p><a href="{{ reverse_url("home_user") }}">Home</a></p>
{{ super() }}
{% endblock %}
......@@ -57,4 +57,7 @@
</div>
</div>
<div>
<p><a href="{{ reverse_url("home_user") }}">Home</a></p>
</div>
{% endblock %}
......@@ -10,4 +10,7 @@
<input type="submit" value="Start!">
</form>
<div>
<p><a href="{{ reverse_url("home_user") }}">Home</a></p>
</div>
{% endblock %}
......@@ -44,8 +44,7 @@
{% if e.is_active %}
<td><a href="/executions/terminate/{{ e.id }}">Terminate</a></td>
{% else %}
<td><a href="/executions/restart/{{ e.id }}">Restart</a>,
<a href="/executions/delete/{{ e.id }}">Delete</a></td>
<td><a href="/executions/restart/{{ e.id }}">Restart</a></td>
{% endif %}
</tr>
{% endfor %}
......
......@@ -62,12 +62,14 @@ def get_auth_login(username, password):
"""Authenticate username and password against the configured user store."""
# First of all try to authenticate against a fixed list of users in a text file
authenticator = PlainTextAuthenticator() # type: BaseAuthenticator
try:
authenticator = PlainTextAuthenticator() # type: BaseAuthenticator
uid, role = authenticator.auth(username, password)
return uid, role
except zoe_api.exceptions.ZoeAuthException:
pass
except zoe_api.exceptions.ZoeNotFoundException:
pass
# It it fails, continue with the normal authentication
if get_conf().auth_type == 'ldap':
......
......@@ -570,6 +570,9 @@ class ArgumentParser(argparse.ArgumentParser):
elif source.startswith(_CONFIG_FILE_SOURCE_KEY):
for key, (action, value) in settings.items():
config_file_items[key] = value
if 'write-config' in config_file_items:
del config_file_items['write-config']
return config_file_items
def convert_item_to_command_line_arg(self, action, key, value):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment