feat: Ability to do global search by tag

This commit is contained in:
Sergey Tokarenko 2022-01-04 01:28:10 +02:00
parent 79bebf7c9b
commit d5bdc3f567
2 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,9 @@ from utilities.utils import count_related
from virtualization.filtersets import ClusterFilterSet, VirtualMachineFilterSet
from virtualization.models import Cluster, VirtualMachine
from virtualization.tables import ClusterTable, VirtualMachineTable
from extras.filtersets import TagFilterSet
from extras.models import Tag
from extras.tables import TagTable
SEARCH_MAX_RESULTS = 15
SEARCH_TYPES = OrderedDict((
@ -177,4 +180,11 @@ SEARCH_TYPES = OrderedDict((
'table': TenantTable,
'url': 'tenancy:tenant_list',
}),
# Other
('tag', {
'queryset': Tag.objects.prefetch_related('prefix'),
'filterset': TagFilterSet,
'table': TagTable,
'url': 'extras:tag_list',
}),
))

View File

@ -33,6 +33,9 @@ OBJ_TYPE_CHOICES = (
('cluster', 'Clusters'),
('virtualmachine', 'Virtual Machines'),
)),
('Other', (
('tag', 'Tags'),
)),
)