Merge pull request #3 from SandyWalsh/ui_tweaks

cleanup UI and add search
This commit is contained in:
Sandy Walsh 2012-02-28 19:38:01 -08:00
commit b08ccb6fbd
5 changed files with 50 additions and 21 deletions

View File

@ -30,7 +30,7 @@ under the License.
.fancy { .fancy {
font-family: 'Kaushan Script'; font-family: 'Kaushan Script';
font-style: normal; font-style: normal;
padding-bottom: 1em; padding-bottom: 0em;
font-size: 3em; font-size: 3em;
color:#C63520; color:#C63520;
} }
@ -86,7 +86,7 @@ under the License.
margin-bottom:1em; margin-bottom:1em;
} }
.std-height { .std-height {
height:5em; height:30em;
overflow-y:scroll; overflow-y:scroll;
overflow-x:hidden; overflow-x:hidden;
} }

View File

@ -10,6 +10,16 @@
{ {
$("#row_expansion_" + row_id).load('/' + tenant_id + '/expand/' + row_id); $("#row_expansion_" + row_id).load('/' + tenant_id + '/expand/' + row_id);
}; };
function search_form(tenant_id)
{
var field = $("#field").val();
var value = $("#query").val();
var data = {'field':field, 'value':value};
$("#detail").load('/' + tenant_id + '/search/', data);
return false;
};
{% endblock %} {% endblock %}
{% block extra_init_js %} {% block extra_init_js %}
@ -19,28 +29,33 @@
{% block body %} {% block body %}
<div style='float:right;'>{{state.tenant.email}} (TID:{{state.tenant.tenant_id}}) - {{state.tenant.project_name}} <a href='/logout'>logout</a></div> <div style='float:right;'>{{state.tenant.email}} (TID:{{state.tenant.tenant_id}}) - {{state.tenant.project_name}} <a href='/logout'>logout</a></div>
<div class='status-title'>Recent Host Activity</div> <div class='status-title'>Recent Activity</div>
<div id='host-box' class='status std-height'> <div id='host-box' class='status std-height'>
<div id='host_activity' class='status-inner'> <div id='host_activity' class='status-inner'>
{% include "host_status.html" %} {% include "host_status.html" %}
</div> </div>
</div> </div>
<div class='status-title'>Recent Instance Activity</div>
<div id='instance-box' class='status std-height'>
<div id='instance_activity' class='status-inner'>
{% include "instance_status.html" %}
</div>
</div>
<!--
<div class='status-title'>Commands</div> <div class='status-title'>Commands</div>
<div class='status'> <div class='status'>
<div class='status-inner'> <div class='status-inner' style='padding-bottom:0em; margin-bottom:0em; margin-top:1em'>
<input type=text style='width:100%; background-color:black;color:white;' <div>
value='<custom query here>'/> <form action="">
<select id='field'>
<option value='routing_key'>source
<option value='nova_tenant'>tenant
<option>service
<option>host
<option>event
<option selected='true'>instance
</select>
<input type='text' id='query' size='60' value=''/>
<input type='submit' value='Search' onclick='return search_form({{state.tenant.tenant_id}});'/>
</form>
</div>
</div> </div>
</div> </div>
-->
<div class='status-title'>Details</div> <div class='status-title'>Details</div>
<div class='status'> <div class='status'>
<div id='detail' class='status-inner'> <div id='detail' class='status-inner'>

View File

@ -9,6 +9,9 @@
<td class='title'>instance</td> <td class='title'>instance</td>
<td class='title'>when</td> <td class='title'>when</td>
</th> </th>
{% if not rows %}
<tr><td>No results</td></tr>
{% endif %}
{% for row in rows %} {% for row in rows %}
<tr {% if row.highlight %}style='background-color:#FFD88F;'{% endif %} > <tr {% if row.highlight %}style='background-color:#FFD88F;'{% endif %} >
<td> <td>
@ -37,7 +40,7 @@
{% endif %} {% endif %}
</a> </a>
</td> </td>
<td class='cell-border'><a href='#' onclick='details({{state.tenant.tenant_id}}, "when", {{row.id}});'>{% if show_absolute_time %}{{row.when}}{%else%}{{row.when|timesince:utc}} ago{%endif%}</a></td> <td class='cell-border'><a href='#' onclick='details({{state.tenant.tenant_id}}, "when", {{row.id}});'>{% if show_absolute_time %}{{row.when}} (+{{row.when.microsecond}}){%else%}{{row.when|timesince:utc}} ago{%endif%}</a></td>
</tr> </tr>
{% if allow_expansion %} {% if allow_expansion %}
<tr> <tr>

View File

@ -15,7 +15,7 @@
<ul> <ul>
<li>Get a <a href='/new_tenant'>StackTach Tenant ID</a> <li>Get a <a href='/new_tenant'>StackTach Tenant ID</a>
<li>Add <pre>--notification_driver=nova.notifier.rabbit_notifier</pre> and <li>Add <pre>--notification_driver=nova.notifier.rabbit_notifier</pre> and
<li><pre>--notification_topics=info,monitor</pre> to your nova.conf file. <li><pre>--notification_topics=notifications,monitor</pre> to your nova.conf file.
<li>Configure and run the <a target='_blank' href='https://github.com/Rackspace/StackTach'>StackTach Worker</a> somewhere in your Nova development environment. <li>Configure and run the <a target='_blank' href='https://github.com/Rackspace/StackTach'>StackTach Worker</a> somewhere in your Nova development environment.
<li>Restart Nova and visit http://[your server]/[your_tenant_id]/ to see your Nova installation in action! <li>Restart Nova and visit http://[your server]/[your_tenant_id]/ to see your Nova installation in action!
</ul> </ul>

21
urls.py
View File

@ -1,9 +1,20 @@
from django.conf.urls.defaults import patterns, include, url from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^', include('stacktach.url')), url(r'^$', 'stacktach.views.welcome', name='welcome'),
url(r'new_tenant', 'stacktach.views.new_tenant', name='new_tenant'),
url(r'logout', 'stacktach.views.logout', name='logout'),
url(r'^(?P<tenant_id>\d+)/$', 'stacktach.views.home', name='home'),
url(r'^(?P<tenant_id>\d+)/data/$', 'stacktach.views.data',
name='data'),
url(r'^(?P<tenant_id>\d+)/details/(?P<column>\w+)/(?P<row_id>\d+)/$',
'stacktach.views.details', name='details'),
url(r'^(?P<tenant_id>\d+)/search/$',
'stacktach.views.search', name='search'),
url(r'^(?P<tenant_id>\d+)/expand/(?P<row_id>\d+)/$',
'stacktach.views.expand', name='expand'),
url(r'^(?P<tenant_id>\d+)/host_status/$',
'stacktach.views.host_status', name='host_status'),
url(r'^(?P<tenant_id>\d+)/instance_status/$',
'stacktach.views.instance_status', name='instance_status'),
) )