Skip to content

Commit

Permalink
support for configs in appier extras
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Nov 5, 2015
1 parent 59befda commit 8a815db
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/appier_extras/parts/admin/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def routes(self):
(("GET",), "/admin/status", self.status),
(("GET",), "/admin/social", self.social),
(("GET",), "/admin/routes", self.list_routes),
(("GET",), "/admin/configs", self.list_configs),
(("GET",), "/admin/sessions", self.list_sessions),
(("GET",), "/admin/database", self.database),
(("GET",), "/admin/database/export", self.database_export),
Expand Down Expand Up @@ -355,6 +356,17 @@ def list_routes(self):
routes = self._routes()
)

@appier.ensure(token = "admin")
def list_configs(self):
configs = appier.config.CONFIGS
configs = appier.legacy.items(configs)
configs.sort()
return self.template(
"configs.html.tpl",
section = "status",
configs = configs
)

@appier.ensure(token = "admin")
def list_sessions(self):
return self.template(
Expand Down
24 changes: 24 additions & 0 deletions src/appier_extras/parts/admin/templates/fluid/configs.html.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends "admin/admin.fluid.html.tpl" %}
{% block title %}Configuration{% endblock %}
{% block name %}Configuration{% endblock %}
{% block style %}no-padding{% endblock %}
{% block content %}
<table class="filter" data-no_input="1">
<thead>
<tr class="table-row table-header">
<th class="text-left">Key</th>
<th class="text-left">Value</th>
</tr>
</thead>
<tbody class="filter-contents">
{% for key, value in configs %}
<tr class="table-row">
<td class="text-left">
<strong>{{ key }}</strong>
</td>
<td class="text-left">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
6 changes: 6 additions & 0 deletions src/appier_extras/parts/admin/templates/fluid/status.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<a href="{{ url_for('admin.list_routes') }}">{{ own.info().routes }} routes</a>
</dd>
</div>
<div class="item">
<dt>Configuration</dt>
<dd>
<a href="{{ url_for('admin.list_configs') }}">{{ own.info().configs }} items</a>
</dd>
</div>
<div class="separator"></div>
<div class="item">
<dt>Session class</dt>
Expand Down

0 comments on commit 8a815db

Please sign in to comment.