-
Notifications
You must be signed in to change notification settings - Fork 551
Add additional filters to scanner query rules/results #23984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eviljeff
merged 8 commits into
mozilla:master
from
diox:scanners-query-results-more-filters
Oct 14, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
108f76d
Add additional filters to scanner query rules/results
diox 3f195e1
Test filters list
diox 9f5d441
More testing
diox d5affd2
Cleanup
diox 0738a15
Unused var
diox cf079a9
Missing </li>
diox 930bf98
Add no-op migration for files model change
diox 6fb86a1
Merge branch 'master' into scanners-query-results-more-filters
eviljeff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/olympia/amo/templates/admin/amo/numeric_range_filter.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <details data-filter-title="{{ title }}" open> | ||
| <summary>By {{ title }}</summary> | ||
| {% with choices.0 as all_choice %} | ||
| <form method="GET" action="."> | ||
| <div> | ||
| {# Use .params.lists to properly support multiple values - so that if a filter using this template is present multiple times on the page, its current values are all passed to the new page when submitting this form #} | ||
| {% for key, values in all_choice.params.lists %} | ||
| {% for value in values %} | ||
| <input type="hidden" name="{{ key }}" value="{{ value }}" /> | ||
| {% endfor %} | ||
| {% endfor %} | ||
| </div> | ||
| <ul> | ||
| <li {% if all_choice.selected %}class="selected"{% endif %}> | ||
| <a href="{{ all_choice.query_string }}">All</a> | ||
| </li> | ||
| <li> | ||
| {% for field in spec.form %} | ||
| {{ field.errors }} | ||
| {{ field.label_tag }} {{ field }} | ||
| {% endfor %} | ||
| </li> | ||
| <li> | ||
| <input type="submit" value="Submit" /> | ||
| </li> | ||
| </ul> | ||
| </form> | ||
| {% endwith %} | ||
| </details> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/olympia/files/migrations/0036_alter_file_datestatuschanged.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Generated by Django 4.2.24 on 2025-10-03 17:51 | ||
|
|
||
| from django.db import migrations, models | ||
| import django.utils.timezone | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('files', '0035_remove_file_reviewed'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name='file', | ||
| name='datestatuschanged', | ||
| field=models.DateTimeField(default=django.utils.timezone.now, null=True), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| from django.db import models | ||
| from django.dispatch import receiver | ||
| from django.urls import reverse | ||
| from django.utils import timezone | ||
| from django.utils.crypto import get_random_string | ||
| from django.utils.encoding import force_str | ||
| from django.utils.functional import cached_property | ||
|
|
@@ -112,7 +113,7 @@ class File(OnChangeMixin, ModelBase): | |
| status = models.PositiveSmallIntegerField( | ||
| choices=STATUS_CHOICES.items(), default=amo.STATUS_AWAITING_REVIEW | ||
| ) | ||
| datestatuschanged = models.DateTimeField(null=True, auto_now_add=True) | ||
| datestatuschanged = models.DateTimeField(null=True, default=timezone.now) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not saying this is a bad change to make ... but we could just special case |
||
| strict_compatibility = models.BooleanField(default=False) | ||
| approval_date = models.DateTimeField(null=True) | ||
| # Serial number of the certificate use for the signature. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing the label tags were empty (the label tag existed, but there was no text value). Date range filter fields get "To" and "From" labels; numeric range filter fields did not - though the placeholder texts did say "To" and "From".
Do you need to override
_get_form_fieldstoo?At that point, you probably want to inherit from DateRangeFilter, or a common ancestor - it's worth considering anyway as your
choicesseems to be a direct copy and paste.