Commit 709eec33 by Bach Dániel

Merge branch 'node-fixes' into 'master'

Node fixes

- Labels in node box weren't aware of the new node states
- The search input disappeared when switching view modes
- Fixed filtering by nodes on vm list

See merge request !235
parents 424ff978 9443953b
...@@ -445,7 +445,7 @@ function generateNodeHTML(name, icon, _status, url, is_last) { ...@@ -445,7 +445,7 @@ function generateNodeHTML(name, icon, _status, url, is_last) {
function generateNodeTagHTML(name, icon, _status, label , url) { function generateNodeTagHTML(name, icon, _status, label , url) {
return '<a href="' + url + '" class="label ' + label + '" >' + return '<a href="' + url + '" class="label ' + label + '" >' +
'<i class="' + icon + '" title="' + _status + '"></i> ' + name + '<i class="fa ' + icon + '" title="' + _status + '"></i> ' + name +
'</a> '; '</a> ';
} }
......
{% load i18n %} {% load i18n %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<div class="pull-right toolbar"> <div class="pull-right toolbar">
<div class="btn-group"> <div class="btn-group">
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
data-container="body"><i class="fa fa-dashboard"></i></a> data-container="body"><i class="fa fa-dashboard"></i></a>
<a href="#index-list-view" data-index-box="node" class="btn btn-default btn-xs disabled" <a href="#index-list-view" data-index-box="node" class="btn btn-default btn-xs disabled"
data-container="body"><i class="fa fa-list"></i></a> data-container="body"><i class="fa fa-list"></i></a>
</div> </div>
<span class="btn btn-default btn-xs infobtn" title="{% trans "List of compute nodes, also called worker nodes or hypervisors, which run the virtual machines." %}"><i class="fa fa-info-circle"></i></span> <span class="btn btn-default btn-xs infobtn" title="{% trans "List of compute nodes, also called worker nodes or hypervisors, which run the virtual machines." %}">
<i class="fa fa-info-circle"></i>
</span>
</div> </div>
<h3 class="no-margin"> <h3 class="no-margin">
<i class="fa fa-sitemap"></i> {% trans "Nodes" %} <i class="fa fa-sitemap"></i> {% trans "Nodes" %}
...@@ -28,50 +29,55 @@ ...@@ -28,50 +29,55 @@
</a> </a>
{% endfor %} {% endfor %}
</div> </div>
<div href="#" class="list-group-item list-group-footer"> </div><!-- #node-list-view -->
<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="fa fa-search"></i></button>
</div>
</div>
<div class="col-sm-6 text-right">
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}">
<i class="fa fa-chevron-circle-right"></i>
{% if more_nodes > 0 %}
{% blocktrans with count=more_nodes %}<strong>{{count}}</strong> more{% endblocktrans %}
{% else %}
{% trans "list" %}
{% endif %}
</a>
<a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="fa fa-plus-circle"></i> {% trans "new" %}</a>
</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; min-height: 204px;">
<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">
<p><span class="big"><big>{{ node_num.running }}</big> running </span> <input class="knob" data-fgColor="chartreuse"
+ <big>{{ node_num.missing }}</big> missing + <br><big>{{ node_num.disabled }}</big> disabled + <big>{{ node_num.offline }}</big> offline</p> data-thickness=".4" data-width="60" data-height="60" data-readOnly="true"
<ul class="list-inline" id="dashboard-node-taglist"> value="{% widthratio node_num.running sum_node_num 100 %}">
{% for i in nodes %} </p>
<a href="{{ i.get_absolute_url }}" class="label {{i.get_status_label}}" > <p>
<i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i> {{ i.name }}</a> <span class="big">
{% endfor %} <big>{{ node_num.running }}</big> running
</ul> </span>
+ <big>{{ node_num.missing }}</big>
missing + <br><big>{{ node_num.disabled }}</big> disabled + <big>{{ node_num.offline }}</big> offline
</p>
<ul class="list-inline" id="dashboard-node-taglist">
{% for i in nodes %}
<a href="{{ i.get_absolute_url }}" class="label {{i.get_status_label}}" >
<i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i> {{ i.name }}</a>
{% endfor %}
</ul>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row"> </div>
<div class="col-sm-6 text-right pull-right">
{% if more_nodes >= 0 %} <div href="#" class="list-group-item list-group-footer">
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}"> <div class="row">
<i class="fa fa-chevron-circle-right"></i> {% blocktrans with count=more_nodes %}<strong>{{count}}</strong> more{% endblocktrans %} <div class="col-sm-6 col-xs-6 input-group input-group-sm">
</a> <input id="dashboard-node-search-input" type="text" class="form-control"
{% endif %} placeholder="{% trans "Search..." %}" />
<a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="fa fa-plus-circle"></i> {% trans "new" %}</a> <div class="input-group-btn">
<button type="submit" class="btn btn-primary" title="{% trans "Search" %}" data-container="body">
<i class="fa fa-search"></i>
</button>
</div> </div>
</div> </div>
</div> <div class="col-sm-6 text-right">
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}">
<i class="fa fa-chevron-circle-right"></i>
{% if more_nodes > 0 %}
{% blocktrans with count=more_nodes %}<strong>{{count}}</strong> more{% endblocktrans %}
{% else %}
{% trans "list" %}
{% endif %}
</a>
<a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}">
<i class="fa fa-plus-circle"></i> {% trans "new" %}
</a>
</div>
</div>
</div>
</div> </div>
{% load i18n %} {% load i18n %}
<div id="node-list-column-vm"> <div id="node-list-column-vm">
<a class="real-link" href="{% url "dashboard.views.vm-list" %}?s=node:{{ record.name }}"> <a class="real-link" href="{% url "dashboard.views.vm-list" %}?s=node_exact:{{ record.name }}">
{{ value }} {{ value }}
</a> </a>
</div> </div>
...@@ -807,6 +807,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView): ...@@ -807,6 +807,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
allowed_filters = { allowed_filters = {
'name': "name__icontains", 'name': "name__icontains",
'node': "node__name__icontains", 'node': "node__name__icontains",
'node_exact': "node__name",
'status': "status__iexact", 'status': "status__iexact",
'tags[]': "tags__name__in", 'tags[]': "tags__name__in",
'tags': "tags__name__in", # for search string 'tags': "tags__name__in", # for search string
......
...@@ -313,10 +313,11 @@ class Node(OperatedMixin, TimeStampedModel): ...@@ -313,10 +313,11 @@ class Node(OperatedMixin, TimeStampedModel):
def get_status_label(self): def get_status_label(self):
return { return {
'OFFLINE': 'label-warning', 'OFFLINE': 'label-warning',
'DISABLED': 'label-warning', 'DISABLED': 'label-danger',
'MISSING': 'label-danger', 'MISSING': 'label-danger',
'ONLINE': 'label-success'}.get(self.get_state(), 'ACTIVE': 'label-success',
'label-danger') 'PASSIVE': 'label-warning',
}.get(self.get_state(), 'label-danger')
@node_available @node_available
def update_vm_states(self): def update_vm_states(self):
......
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