diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/typeaheads.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/typeaheads.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/typeaheads.py b/bitbake/lib/toaster/toastergui/typeaheads.py index 58c650f8fc..5aa0f8d889 100644 --- a/bitbake/lib/toaster/toastergui/typeaheads.py +++ b/bitbake/lib/toaster/toastergui/typeaheads.py | |||
@@ -100,6 +100,36 @@ class MachinesTypeAhead(ToasterTypeAhead): | |||
100 | return results | 100 | return results |
101 | 101 | ||
102 | 102 | ||
103 | class DistrosTypeAhead(ToasterTypeAhead): | ||
104 | """ Typeahead for all the distros available in the current project's | ||
105 | configuration """ | ||
106 | def __init__(self): | ||
107 | super(DistrosTypeAhead, self).__init__() | ||
108 | |||
109 | def apply_search(self, search_term, prj, request): | ||
110 | distros = prj.get_available_distros() | ||
111 | distros = distros.order_by("name") | ||
112 | |||
113 | primary_results = distros.filter(name__istartswith=search_term) | ||
114 | secondary_results = distros.filter(name__icontains=search_term).exclude(pk__in=primary_results) | ||
115 | tertiary_results = distros.filter(layer_version__layer__name__icontains=search_term).exclude(pk__in=primary_results).exclude(pk__in=secondary_results) | ||
116 | |||
117 | results = [] | ||
118 | |||
119 | for distro in list(primary_results) + list(secondary_results) + list(tertiary_results): | ||
120 | |||
121 | detail = "[ %s ]" % (distro.layer_version.layer.name) | ||
122 | needed_fields = { | ||
123 | 'id' : distro.pk, | ||
124 | 'name' : distro.name, | ||
125 | 'detail' : detail, | ||
126 | } | ||
127 | |||
128 | results.append(needed_fields) | ||
129 | |||
130 | return results | ||
131 | |||
132 | |||
103 | class RecipesTypeAhead(ToasterTypeAhead): | 133 | class RecipesTypeAhead(ToasterTypeAhead): |
104 | """ Typeahead for all the recipes available in the current project's | 134 | """ Typeahead for all the recipes available in the current project's |
105 | configuration """ | 135 | configuration """ |