Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 26, 2024
1 parent 7a279fc commit d30541e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
14 changes: 8 additions & 6 deletions sde_collections/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion sde_indexing_helper/static/css/affected_urls.css
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,4 @@ body {

.cross-mark, .tick-mark {
cursor: pointer; /* Show hand cursor */
}
}
16 changes: 8 additions & 8 deletions sde_indexing_helper/static/js/affected_urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function handleIncludeIndividualUrlClick() {
true
);


} else {
var url = $(this).attr("value");
console.log("url", url);
Expand All @@ -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
Expand All @@ -105,7 +105,7 @@ function handleIncludeIndividualUrlClick() {
}).catch(function(error) {
console.error("Error occurred:", error);
});

}

});
Expand Down Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -171,7 +171,7 @@ function handleIncludeIndividualUrlClick() {
}).catch(function(error) {
console.error("Error occurred:", error);
});

}

});
Expand Down Expand Up @@ -248,7 +248,7 @@ function deletePattern(
error: function (xhr, status, error) {
var errorMessage = xhr.responseText;
toastr.error(errorMessage);
},
},
});
}

Expand Down Expand Up @@ -290,4 +290,4 @@ function getCorrespondingExcludePattern(url) {
console.error("Error fetching exclude patterns:", error);
return null;
});
}
}
12 changes: 6 additions & 6 deletions sde_indexing_helper/templates/sde_collections/affected_urls.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ <h1 class="pageTitle">Affected URLs</h1>
<div class="candidateUrlContainer">

<h3 class="whiteText candidateTitle">
{{ url_count|intcomma }} affected URLs for {{ pattern_type | lower }} pattern:
{{ url_count|intcomma }} affected URLs for {{ pattern_type | lower }} pattern:
<span style="color: #65B1EF;">{{ pattern.match_pattern }}</span>
</h3>

<div class="container mt-4">
<!-- Table to display the URLs -->
<table id="affectedURLsTable" class="table" style="width:100%">
Expand All @@ -52,10 +52,10 @@ <h3 class="whiteText candidateTitle">
<td class="text-center">{{ forloop.counter }}</td>
<td>
<div class="url-cell"><span class="candidate_url nameStyling">{{ url.url }}</span>
<a target="_blank" href="{{ url.url }}" data-url="/api/candidate-urls/{{url.id}}/" class="url-link">
<i class="material-icons url-icon">open_in_new</i></a>
<a target="_blank" href="{{ url.url }}" data-url="/api/candidate-urls/{{url.id}}/" class="url-link">
<i class="material-icons url-icon">open_in_new</i></a>
</div>
</td>
</td>
<!-- <td class="col-3 text-center data-sort="0">
{% if pattern_type == "Exclude" %}
<a class="include-url-btn" data-url-id="{{ url.id }}" value = "{{url.url}}">
Expand Down Expand Up @@ -97,4 +97,4 @@ <h3 class="whiteText candidateTitle">
<script src="{% static 'js/affected_urls.js' %}"></script>
<script src="{% static 'js/core/bootstrap.min.js' %}"></script>

{% endblock javascripts %}
{% endblock javascripts %}

0 comments on commit d30541e

Please sign in to comment.