-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #644 from nautobot/drift-manager/pr
Cookie updated by NetworkToCode Cookie Drift Manager Tool
- Loading branch information
Showing
15 changed files
with
737 additions
and
614 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
This file contains 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 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 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 @@ | ||
Rebaked from the cookie `nautobot-app-v2.4.1`. |
This file contains 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,39 +1,35 @@ | ||
"""Filtering logic for Sync and SyncLogEntry records.""" | ||
|
||
import django_filters | ||
from django.db.models import Q | ||
from nautobot.apps.filters import BaseFilterSet | ||
from nautobot.apps.filters import BaseFilterSet, SearchFilter | ||
|
||
from .models import Sync, SyncLogEntry | ||
from nautobot_ssot import models | ||
|
||
|
||
class SyncFilterSet(BaseFilterSet): | ||
"""Filter capabilities for SyncOverview instances.""" | ||
class SyncFilterSet(BaseFilterSet): # pylint: disable=too-many-ancestors | ||
"""Filter for Sync.""" | ||
|
||
class Meta: | ||
"""Metaclass attributes of SyncFilter.""" | ||
"""Meta attributes for filter.""" | ||
|
||
model = Sync | ||
fields = ["dry_run", "job_result"] | ||
model = models.Sync | ||
|
||
# add any fields from the model that you would like to filter your searches by using those | ||
fields = ["dry_run", "job_result"] # pylint: disable=nb-use-fields-all | ||
|
||
class SyncLogEntryFilterSet(BaseFilterSet): | ||
|
||
class SyncLogEntryFilterSet(BaseFilterSet): # pylint: disable=too-many-ancestors | ||
"""Filter capabilities for SyncLogEntry instances.""" | ||
|
||
q = django_filters.CharFilter(method="search", label="Search") | ||
q = SearchFilter( | ||
filter_predicates={ | ||
"diff": "icontains", | ||
"message": "icontains", | ||
"object_repr": "icontains", | ||
} | ||
) | ||
|
||
class Meta: | ||
"""Metaclass attributes of SyncLogEntryFilter.""" | ||
|
||
model = SyncLogEntry | ||
fields = ["sync", "action", "status", "synced_object_type"] | ||
|
||
def search(self, queryset, _name, value): | ||
"""String search of SyncLogEntry records.""" | ||
if not value.strip(): | ||
return queryset | ||
return queryset.filter( | ||
Q(diff__icontains=value) # pylint: disable=unsupported-binary-operation | ||
| Q(message__icontains=value) | ||
| Q(object_repr__icontains=value) | ||
) | ||
model = models.SyncLogEntry | ||
fields = ["sync", "action", "status", "synced_object_type"] # pylint: disable=nb-use-fields-all |
This file contains 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.