Skip to content

Commit dabae97

Browse files
committed
feature: set enabled=True for initial grouped errors visit
1 parent eb4f98b commit dabae97

5 files changed

Lines changed: 30 additions & 9 deletions

File tree

cdip_admin/integrations/templates/integrations/bridge_integration_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h2 class="align-bottom">Bridge Integrations</h2>
2222

2323
{% if error_count > 0 %}
2424
<div class="alert alert-warning mt-2">
25-
<strong>{{ error_count }}</strong> of {{ total_count }} configurations have errors
25+
<strong>{{ error_count }}</strong> of {{ total_count }} enabled configurations have errors
2626
</div>
2727
{% endif %}
2828

cdip_admin/integrations/templates/integrations/inbound_integration_configuration_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h2>Inbound Integrations</h2>
2121

2222
{% if error_count > 0 %}
2323
<div class="alert alert-warning mt-2 d-flex justify-content-between align-items-center">
24-
<span><strong>{{ error_count }}</strong> of {{ total_count }} configurations have errors</span>
24+
<span><strong>{{ error_count }}</strong> of {{ total_count }} enabled configurations have errors</span>
2525
<a href="{% url 'inbound_integration_errors' %}{% if request.GET.urlencode %}?{{ request.GET.urlencode }}{% endif %}" class="btn btn-sm btn-warning">View grouped errors</a>
2626
</div>
2727
{% endif %}

cdip_admin/integrations/templates/integrations/inbound_integration_errors.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,19 @@ <h2 class="mb-0 mr-3">Inbound Integration Errors</h2>
108108
});
109109
if (!el.value) ts.clear();
110110
});
111+
112+
var hlParams = new URLSearchParams(location.search);
113+
if (hlParams.get('_hl') === 'enabled') {
114+
hlParams.delete('_hl');
115+
history.replaceState(null, '', location.pathname + '?' + hlParams.toString());
116+
var enabledEl = document.querySelector('#inbound-filter-form select[name="enabled"]');
117+
var wrapper = enabledEl && enabledEl.parentElement;
118+
if (wrapper) {
119+
wrapper.style.transition = 'box-shadow 1s';
120+
wrapper.style.boxShadow = '0 0 0 3px #28a745';
121+
setTimeout(function() { wrapper.style.boxShadow = ''; }, 1200);
122+
}
123+
}
111124
})();
112125
</script>
113126
{% endif %}

cdip_admin/integrations/templates/integrations/outbound_integration_configuration_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h2>Outbound Integrations</h2>
2323

2424
{% if error_count > 0 %}
2525
<div class="alert alert-warning mt-2">
26-
<strong>{{ error_count }}</strong> of {{ total_count }} configurations have errors
26+
<strong>{{ error_count }}</strong> of {{ total_count }} enabled configurations have errors
2727
</div>
2828
{% endif %}
2929

cdip_admin/integrations/views.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,8 +1196,8 @@ def get_context_data(self, **kwargs):
11961196
base_url = reverse("inbound_integration_configuration_list")
11971197
context["base_url"] = base_url
11981198
qs = self.filterset.qs
1199-
context["error_count"] = qs.filter(state__has_key='error').count()
1200-
context["total_count"] = qs.count()
1199+
context["error_count"] = qs.filter(state__has_key='error', enabled=True).count()
1200+
context["total_count"] = qs.filter(enabled=True).count()
12011201
return context
12021202

12031203
def get_queryset(self):
@@ -1218,6 +1218,14 @@ def get_queryset(self):
12181218
class InboundIntegrationErrorsView(LoginRequiredMixin, TemplateView):
12191219
template_name = "integrations/inbound_integration_errors.html"
12201220

1221+
def get(self, request, *args, **kwargs):
1222+
if 'enabled' not in request.GET:
1223+
params = request.GET.copy()
1224+
params['enabled'] = 'true'
1225+
params['_hl'] = 'enabled'
1226+
return redirect(request.path + '?' + params.urlencode())
1227+
return super().get(request, *args, **kwargs)
1228+
12211229
def get_context_data(self, **kwargs):
12221230
context = super().get_context_data(**kwargs)
12231231
qs = InboundIntegrationConfiguration.objects.get_queryset()
@@ -1533,8 +1541,8 @@ def get_context_data(self, **kwargs):
15331541
base_url = reverse("outbound_integration_configuration_list")
15341542
context["base_url"] = base_url
15351543
qs = self.filterset.qs
1536-
context["error_count"] = qs.filter(state__has_key='error').count()
1537-
context["total_count"] = qs.count()
1544+
context["error_count"] = qs.filter(state__has_key='error', enabled=True).count()
1545+
context["total_count"] = qs.filter(enabled=True).count()
15381546
return context
15391547

15401548
def get_queryset(self):
@@ -1573,8 +1581,8 @@ def get_context_data(self, **kwargs):
15731581
context = super().get_context_data(**kwargs)
15741582
context["base_url"] = reverse("bridge_integration_list")
15751583
qs = self.filterset.qs
1576-
context["error_count"] = qs.filter(state__has_key='error').count()
1577-
context["total_count"] = qs.count()
1584+
context["error_count"] = qs.filter(state__has_key='error', enabled=True).count()
1585+
context["total_count"] = qs.filter(enabled=True).count()
15781586
return context
15791587

15801588
def get_queryset(self):

0 commit comments

Comments
 (0)