Port-detail: fix builders sorting and frontend details

This commit is contained in:
arjunsalyan
2020-05-31 16:30:41 +05:30
committed by Arjun Salyan
parent 55e00edad6
commit c181163fbf
4 changed files with 32 additions and 13 deletions
+14 -7
View File
@@ -121,13 +121,14 @@
<span class="badge text-danger p-0"><i class="fa fa-times"></i></span>
{% endif %}
{{ builder.display_name }}
<span class="f10">({{ builder.name }})</span>
</a>
{% if latest_build.files.all|length > 0 %}
<button class="btn btn-link text-secondary p-0 m-0 float-right" data-toggle="modal" data-target="#files{{ forloop.counter }}">Installed Files</button>
{% endif %}
</li>
{% if latest_build.files.all|length > 0 %}
<div style="font-size: 12px" class="modal fade" id="files{{ forloop.counter }}" tabindex="-1" role="dialog"
<div class="modal fade f12" id="files{{ forloop.counter }}" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
@@ -149,34 +150,40 @@
</div>
</div>
{% endif %}
{% else %}
<li class="list-group-item py-1 text-secondary">
<span class="badge text-secondary p-0"><i class="fa fa-question"></i></span>
{{ builder.display_name }} <span class="f10">({{ builder.name }})</span>
</li>
{% endif %}
{% endwith %}
{% endfor %}
</ul>
<p class="text-secondary p-0 mb-0 f10 text-right"><i class="fa fa-question"></i> - No history in app's database</p>
</div>
<div class="card bg-light p-0 mt-2">
<div class="card-body bg-light p-2">
<h6 class="text-uppercase">Installations</h6>
<h6 class="text-uppercase">Installations (30 days)</h6>
<h1 class="display-5 mb-0">{{count.all}}</h1>
</div>
</div>
<div class="card bg-light p-0 mt-2">
<div class="card-body bg-light p-2">
<h6 class="text-uppercase">Requested Installations</h6>
<h6 class="text-uppercase">Requested Installations (30 days)</h6>
<h1 class="display-5 mb-0">{{ count.requested }}</h1>
</div>
</div>
{% if port.livecheck.result %}
<div class="rounded border p-2 mt-2">
<h5>Livecheck results</h5>
<p class="text-secondary" style="font-size: 14px">{{ port.livecheck.result }}</p>
<p style="font-size: 12px">livecheck ran at: <strong>{{ port.livecheck.updated_at|date:"y-m-d h:i" }}</strong></p>
<p class="text-secondary f14">{{ port.livecheck.result }}</p>
<p class="f12">livecheck ran at: <strong>{{ port.livecheck.updated_at|date:"y-m-d h:i" }}</strong></p>
</div>
{% elif port.livecheck.error %}
<div class="rounded border p-2">
<h5>Livecheck error</h5>
<p class="text-secondary" style="font-size: 14px">{{ port.livecheck.error }}</p>
<p style="font-size: 12px">livecheck ran at: <strong>{{ port.livecheck.updated_at|date:"y-m-d h:i" }}</strong></p>
<p class="text-secondary" class="f14">{{ port.livecheck.error }}</p>
<p class="f12">livecheck ran at: <strong>{{ port.livecheck.updated_at|date:"y-m-d h:i" }}</strong></p>
</div>
{% endif %}
</div>
@@ -27,8 +27,8 @@
<option value="{{ i }}" {% if days == i %}selected{% endif %}>{{ i }} days</option>
{% endfor %}
</select>
<lable for="days-ago">until</lable>
<select onchange="this.form.submit()" id="days-ago" name="days-ago" class="form-control ml-2">
<lable for="days_ago">until</lable>
<select onchange="this.form.submit()" id="days_ago" name="days_ago" class="form-control ml-2">
<option value="0" {% if days_ago == 0 %}selected{% endif %}>today</option>
{% for i in allowed_days|slice:"1:" %}
<option value="{{ i }}" {% if days_ago == i %}selected{% endif %}>{{ i }} days ago</option>
@@ -41,7 +41,7 @@
</h6>
<br>
{% if count.all > 0 %}
<h4 class="border-bottom">Statistics: <span style="font-size:12px"><button type="button" class="bg-light border-0 p-1" data-toggle="modal" data-target="#statsHelp">Learn More</button></span> </h4>
<h4 class="border-bottom">Statistics: <span class="f12"><button type="button" class="bg-light border-0 p-1" data-toggle="modal" data-target="#statsHelp">Learn More</button></span> </h4>
<table class="table table-striped border">
<tr>
<th scope="row">Total Installations</th>
@@ -89,7 +89,7 @@
</table>
<br><br>
<h4 class="border-bottom">Port installations by month <span style="font-size:12px"><button type="button" class="bg-light border-0 p-1" data-toggle="modal" data-target="#monthlyInstallationsHelp">Learn More</button></span> </h4>
<h4 class="border-bottom">Port installations by month <span class="f12"><button type="button" class="bg-light border-0 p-1" data-toggle="modal" data-target="#monthlyInstallationsHelp">Learn More</button></span></h4>
<div class="chart" id="month-chart"></div>
<br>
<div class="chart" id="version-month-chart"></div>
+1 -1
View File
@@ -35,7 +35,7 @@ def port_detail(request, name):
return render(request, 'port/exceptions/port_not_found.html', {'name': name})
this_builds = BuildHistory.objects.filter(port_name__iexact=name).order_by('-time_start').prefetch_related('files')
builders = Builder.objects.all().prefetch_related(Prefetch('builds', queryset=this_builds, to_attr='latest_builds')).annotate(version_array=StringToArray('display_name'),).order_by('-version_array')
builders = Builder.objects.all().prefetch_related(Prefetch('builds', queryset=this_builds, to_attr='latest_builds')).annotate(version_array=StringToArray('name'),).order_by('-version_array')
dependents = Dependency.objects.filter(dependencies__id=port.id).select_related('port_name').order_by(Lower('port_name__name'))
last_30_days = datetime.datetime.now(tz=datetime.timezone.utc)-datetime.timedelta(days=30)
+13 -1
View File
@@ -147,4 +147,16 @@ body{
.bg-el {
background-color: #FAFAFA !important;
font-size: 14px !important;
}
}
.f14 {
font-size: 14px !important;
}
.f12 {
font-size: 12px !important;
}
.f10 {
font-size: 10px !important;
}