Commit d5d3e15b by Karsa Zoltán István

style datastore page

parent 53fd6dee
......@@ -9,11 +9,33 @@
{% block content %}
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-body">
{% for ds in stores %}
{% if ds.name == name %}
<a href="#" class="badge badge-success">
<i class="fa fa-database"></i> {{ ds.hostname }}/{{ ds.name }}
</a>
{% else %}
<a href="#" class="badge badge-primary">
{{ ds.hostname }}/{{ ds.name }}
</a>
{% endif %}
{% empty %}
{% trans "None" %}
{% endfor %}
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="no-margin"><i class="fa fa-database"></i> {% trans "Datastore" %}</h3>
<h3 class="no-margin"><i class="fa fa-database"></i> {{ name }} {% trans "Datastore" %}</h3>
</div>
<div class="panel-body">
{% crispy form %}
......
......@@ -50,11 +50,12 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
def get_context_data(self, **kwargs):
context = super(StorageDetail, self).get_context_data(**kwargs)
context["stores"] = DataStore.objects.all()
ds = self.get_object()
try:
context['name'] = ds.name
context['stats'] = self._get_stats()
context['missing_disks'] = ds.get_missing_disks()
context['g'] = ds.get_missing_disks()
context['orphan_disks'] = ds.get_orphan_disks()
except WorkerNotFound:
messages.error(self.request, _("The DataStore is offline."))
......
......@@ -110,7 +110,7 @@ class DataStore(Model):
queue_name = self.get_remote_queue_name('storage', "slow")
files = set(storage_tasks.list_files.apply_async(
args=[self.path], queue=queue_name).get(timeout=timeout))
disks = Disk.objects.filter(destroyed__isnull=True, is_ready=True)
disks = Disk.objects.filter(destroyed__isnull=True, is_ready=True, datastore=self)
return disks.exclude(filename__in=files)
@method_cache(120)
......
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