From d30541e0e2229a3f992d059a128147ccec596520 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 00:36:34 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- sde_collections/views.py | 14 ++++++++------ sde_indexing_helper/static/css/affected_urls.css | 2 +- sde_indexing_helper/static/js/affected_urls.js | 16 ++++++++-------- .../templates/sde_collections/affected_urls.html | 12 ++++++------ 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/sde_collections/views.py b/sde_collections/views.py index 44fc55cd..bdb4a77d 100644 --- a/sde_collections/views.py +++ b/sde_collections/views.py @@ -51,7 +51,7 @@ User = get_user_model() -from django.db.models import BooleanField, Case, Value, When, Q +from django.db.models import BooleanField, Case, Q, Value, When class CollectionListView(LoginRequiredMixin, ListView): @@ -227,6 +227,7 @@ def get_context_data(self, **kwargs): return context + class AffectedURLsListView(LoginRequiredMixin, ListView): """ Display a list of URLs affected by a match pattern @@ -238,21 +239,21 @@ class AffectedURLsListView(LoginRequiredMixin, ListView): def get_queryset(self): - if 'exclude-pattern' in self.request.path: + if "exclude-pattern" in self.request.path: self.pattern = ExcludePattern.objects.get(id=self.kwargs["id"]) self.pattern_type = "Exclude" - elif 'include-pattern' in self.request.path: + elif "include-pattern" in self.request.path: self.pattern = IncludePattern.objects.get(id=self.kwargs["id"]) self.pattern_type = "Include" - elif 'title-pattern' in self.request.path: + elif "title-pattern" in self.request.path: self.pattern = TitlePattern.objects.get(id=self.kwargs["id"]) self.pattern_type = "Title" - elif 'document-type-pattern' in self.request.path: + elif "document-type-pattern" in self.request.path: self.pattern = DocumentTypePattern.objects.get(id=self.kwargs["id"]) self.pattern_type = "Document Type" else: return super().get_queryset() - + queryset = self.pattern.matched_urls() return queryset @@ -265,6 +266,7 @@ def get_context_data(self, **kwargs): return context + class SdeDashboardView(LoginRequiredMixin, ListView): model = Collection template_name = "sde_collections/sde_dashboard.html" diff --git a/sde_indexing_helper/static/css/affected_urls.css b/sde_indexing_helper/static/css/affected_urls.css index 0345d56e..0c10cec0 100644 --- a/sde_indexing_helper/static/css/affected_urls.css +++ b/sde_indexing_helper/static/css/affected_urls.css @@ -483,4 +483,4 @@ body { .cross-mark, .tick-mark { cursor: pointer; /* Show hand cursor */ -} \ No newline at end of file +} diff --git a/sde_indexing_helper/static/js/affected_urls.js b/sde_indexing_helper/static/js/affected_urls.js index 8ee3acb2..b580f1bb 100644 --- a/sde_indexing_helper/static/js/affected_urls.js +++ b/sde_indexing_helper/static/js/affected_urls.js @@ -71,7 +71,7 @@ function handleIncludeIndividualUrlClick() { true ); - + } else { var url = $(this).attr("value"); console.log("url", url); @@ -83,7 +83,7 @@ function handleIncludeIndividualUrlClick() { currentURLtoDelete, (data_type = "Include Pattern") ); - + // Change back to cross mark i.classList.remove('tick-mark'); i.classList.add('cross-mark'); // Add the cross-mark class @@ -105,7 +105,7 @@ function handleIncludeIndividualUrlClick() { }).catch(function(error) { console.error("Error occurred:", error); }); - + } }); @@ -137,7 +137,7 @@ function handleIncludeIndividualUrlClick() { true ); - + } else { // Handle the functionality of including that URL again (maybe delete that exclude pattern which was just created) var url = $(this).attr("value"); @@ -150,7 +150,7 @@ function handleIncludeIndividualUrlClick() { currentURLtoDelete, (data_type = "Exclude Pattern") ); - + // Change back to cross mark i.classList.remove('tick-mark'); i.classList.add('cross-mark'); // Add the cross-mark class @@ -171,7 +171,7 @@ function handleIncludeIndividualUrlClick() { }).catch(function(error) { console.error("Error occurred:", error); }); - + } }); @@ -248,7 +248,7 @@ function deletePattern( error: function (xhr, status, error) { var errorMessage = xhr.responseText; toastr.error(errorMessage); - }, + }, }); } @@ -290,4 +290,4 @@ function getCorrespondingExcludePattern(url) { console.error("Error fetching exclude patterns:", error); return null; }); -} \ No newline at end of file +} diff --git a/sde_indexing_helper/templates/sde_collections/affected_urls.html b/sde_indexing_helper/templates/sde_collections/affected_urls.html index 9071ffa8..e6980c38 100644 --- a/sde_indexing_helper/templates/sde_collections/affected_urls.html +++ b/sde_indexing_helper/templates/sde_collections/affected_urls.html @@ -22,10 +22,10 @@

Affected URLs

- {{ url_count|intcomma }} affected URLs for {{ pattern_type | lower }} pattern: + {{ url_count|intcomma }} affected URLs for {{ pattern_type | lower }} pattern: {{ pattern.match_pattern }}

- +
@@ -52,10 +52,10 @@

+
{{ forloop.counter }} -