Commit bc6d45ee by Oláh István Gergely

dashboard: change searchbox place, fix search

parent 42c6b366
...@@ -261,6 +261,16 @@ $(function () { ...@@ -261,6 +261,16 @@ $(function () {
html += '<div class="list-group-item">No result</div>'; html += '<div class="list-group-item">No result</div>';
$("#dashboard-node-list").html(html); $("#dashboard-node-list").html(html);
html = '';
for(var i=0; i<5 && i<search_result.length; i++)
html += generateNodeTagHTML(search_result[i].pk, search_result[i].name,
search_result[i].icon, search_result[i].status,
search_result[i].url);
if(search_result.length == 0)
html += '<div class="list-group-item">No result</div>';
$("#dashboard-node-taglist").html(html);
// if there is only one result and ENTER is pressed redirect // if there is only one result and ENTER is pressed redirect
if(e.keyCode == 13 && search_result.length == 1) { if(e.keyCode == 13 && search_result.length == 1) {
window.location.href = "/dashboard/node/" + search_result[0].pk + "/"; window.location.href = "/dashboard/node/" + search_result[0].pk + "/";
...@@ -304,6 +314,12 @@ function generateNodeHTML(pk, name, icon, _status, url) { ...@@ -304,6 +314,12 @@ function generateNodeHTML(pk, name, icon, _status, url) {
'</a>'; '</a>';
} }
function generateNodeTagHTML(pk, name, icon, _status, url) {
return '<a href="' + url + '" class="label label-danger" >' +
'<i class="' + icon + '" title="' + _status + '"></i> ' + name +
'</a> ';
}
/* copare vm-s by fav, pk order */ /* copare vm-s by fav, pk order */
function compareVmByFav(a, b) { function compareVmByFav(a, b) {
if(a.fav && b.fav) { if(a.fav && b.fav) {
......
...@@ -25,31 +25,13 @@ ...@@ -25,31 +25,13 @@
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
<div href="#" class="list-group-item list-group-footer">
<div class="row">
<div class="col-sm-6 col-xs-6 input-group input-group-sm">
<input id="dashboard-node-search-input" type="text" class="form-control" placeholder="{% trans "Search..." %}" />
<div class="input-group-btn">
<button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button>
</div>
</div>
<div class="col-sm-6 text-right">
{% if more_nodes > 0 %}
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}">
<i class="icon-chevron-sign-right"></i> <strong>{{ more_nodes }}</strong> more
</a>
{% endif %}
<a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a>
</div>
</div>
</div>
</div> </div>
<div class="panel-body" id="node-graph-view" style="display: none"> <div class="panel-body" id="node-graph-view" style="display: none">
<p class="pull-right"> <input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-width="60" data-height="60" data-readOnly="true" value="{% widthratio node_num.running sum_node_num 100 %}"></p> <p class="pull-right"> <input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-width="60" data-height="60" data-readOnly="true" value="{% widthratio node_num.running sum_node_num 100 %}"></p>
<p><span class="big"><big>{{ node_num.running }}</big> running </span> <p><span class="big"><big>{{ node_num.running }}</big> running </span>
+ <big>{{ node_num.missing }}</big> missing + <br><big>{{ node_num.disabled }}</big> disabled + <big>{{ node_num.offline }}</big> offline</p> + <big>{{ node_num.missing }}</big> missing + <br><big>{{ node_num.disabled }}</big> disabled + <big>{{ node_num.offline }}</big> offline</p>
<ul class="list-inline"> <div class="list-group" id="dashboard-node-taglist">
{% for i in nodes %} {% for i in nodes %}
<a class="label {% if i.state == 'ONLINE' %}label-success <a class="label {% if i.state == 'ONLINE' %}label-success
{% elif i.state == 'MISSING' %}label-danger {% elif i.state == 'MISSING' %}label-danger
...@@ -57,24 +39,26 @@ ...@@ -57,24 +39,26 @@
{% elif i.state == 'OFFLINE' %}label-warning {% elif i.state == 'OFFLINE' %}label-warning
{% endif %}" href="{% url "dashboard.views.node-detail" pk=i.pk %}"><i class="icon-{% if i.enabled == True %}play-sign{% else %}pause{% endif %}"></i> {{ i.name}}</a> {% endif %}" href="{% url "dashboard.views.node-detail" pk=i.pk %}"><i class="icon-{% if i.enabled == True %}play-sign{% else %}pause{% endif %}"></i> {{ i.name}}</a>
{% endfor %} {% endfor %}
</ul> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div>
<div href="#" class="list-group-item list-group-footer">
<div class="row"> <div class="row">
<div class="col-sm-6 col-xs-6 input-group input-group-sm"> <div class="col-sm-6 col-xs-6 input-group input-group-sm">
<input type="text" class="form-control" placeholder="{% trans "Search..." %}" /> <input id="dashboard-node-search-input" type="text" class="form-control" placeholder="{% trans "Search..." %}" />
<div class="input-group-btn"> <div class="input-group-btn">
<button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button> <button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button>
</div> </div>
</div> </div>
<div class="col-sm-6 text-right"> <div class="col-sm-6 text-right">
{% if more_nodes >= 0 %} {% if more_nodes > 0 %}
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}"> <a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}">
<i class="icon-chevron-sign-right"></i> {% blocktrans with count=more_nodes %}<strong>{{count}}</strong> more{% endblocktrans %} <i class="icon-chevron-sign-right"></i> <strong>{{ more_nodes }}</strong> more
</a> </a>
{% endif %} {% endif %}
<a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a> <a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
...@@ -276,6 +276,14 @@ class Node(OperatedMixin, TimeStampedModel): ...@@ -276,6 +276,14 @@ class Node(OperatedMixin, TimeStampedModel):
'ONLINE': 'icon-play-sign'}.get(self.get_state(), 'ONLINE': 'icon-play-sign'}.get(self.get_state(),
'icon-question-sign') 'icon-question-sign')
def get_status_label(self):
return {
'OFFLINE': 'label-warning',
'DISABLED': 'label-warning',
'MISSING': 'label-danger',
'ONLINE': 'label-success'}.get(self.get_state(),
'label-danger')
@node_available @node_available
def update_vm_states(self): def update_vm_states(self):
"""Update state of Instances running on this Node. """Update state of Instances running on this Node.
......
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 sign in to comment