Improve rendering efficiency for build detail page (#4416)

- Remove pre-calculated context data (which is not used)
This commit is contained in:
Oliver 2023-02-25 18:58:59 +11:00 committed by GitHub
parent 5037e427b6
commit b6b701b077
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -67,7 +67,7 @@
<td>{% trans "Completed" %}</td>
<td>{% progress_bar build.completed build.quantity id='build-completed-2' max_width='150px' %}</td>
</tr>
{% if build.active and build.has_untracked_bom_items %}
{% if build.active and has_untracked_bom_items %}
<tr>
<td><span class='fas fa-list'></span></td>
<td>{% trans "Allocated Parts" %}</td>
@ -179,7 +179,7 @@
<h4>{% trans "Allocate Stock to Build" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.build.add and build.active and build.has_untracked_bom_items %}
{% if roles.build.add and build.active and has_untracked_bom_items %}
<button class='btn btn-danger' type='button' id='btn-unallocate' title='{% trans "Unallocate stock" %}'>
<span class='fas fa-minus-circle'></span> {% trans "Unallocate Stock" %}
</button>
@ -199,7 +199,7 @@
</div>
</div>
<div class='panel-content'>
{% if build.has_untracked_bom_items %}
{% if has_untracked_bom_items %}
{% if build.active %}
{% if build.are_untracked_parts_allocated %}
<div class='alert alert-block alert-success'>
@ -431,7 +431,7 @@ onPanelLoad('outputs', function() {
{% endif %}
});
{% if build.active and build.has_untracked_bom_items %}
{% if build.active and has_untracked_bom_items %}
function loadUntrackedStockTable() {

View File

@ -34,15 +34,11 @@ class BuildDetail(InvenTreeRoleMixin, InvenTreePluginViewMixin, DetailView):
build = self.get_object()
ctx['bom_price'] = build.part.get_price_info(build.quantity, buy=False)
ctx['BuildStatus'] = BuildStatus
ctx['sub_build_count'] = build.sub_build_count()
part = build.part
bom_items = build.bom_items
ctx['part'] = part
ctx['bom_items'] = bom_items
ctx['has_tracked_bom_items'] = build.has_tracked_bom_items()
ctx['has_untracked_bom_items'] = build.has_untracked_bom_items()