Skip to content

Commit

Permalink
Merge pull request #906 from zefciu/RALPH-1709
Browse files Browse the repository at this point in the history
  • Loading branch information
xor-xor committed Jun 2, 2014
2 parents 12a0505 + bbe628a commit 103a061
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ralph/cmdb/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CIChangeSearchForm(forms.Form):
type = forms.ChoiceField(choices=[['', '------']] + db.CI_CHANGE_TYPES())
priority = forms.ChoiceField(
choices=[['', '------']] + db.CI_CHANGE_PRIORITY_TYPES())
uid = forms.CharField(label='CI name', max_length=100)
uid = forms.CharField(label='CI name or uid', max_length=100)


class CIReportsParamsForm(forms.Form):
Expand Down
8 changes: 7 additions & 1 deletion src/ralph/cmdb/templates/cmdb/report_changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ <h3>{{ title }}</h3>
">{{ d.status }}</span>
{{ d.resolvet_date|date:"d.m.y H:i"|default:"" }}
</td>
<td><a href='/cmdb/ci/view/{{ d.ci.id }}' target='_noblank'>{{ d.ci.name }}</a></td>
<td>
<ul>
{% for ci in d.cis.all %}
<li><a href='/cmdb/ci/view/{{ ci.id }}' target='_noblank'>{{ ci.name }}</a></li>
{% endfor %}
</ul>
</td>
<td><a href="{{ jira_url }}/{{ d.jira_id }}">{{ d.jira_id }}</a> - {{ d.summary }}</td>
<td>{{ d.assignee }}</td>
<td style="width: 26%">{{ d.description|linebreaks }}</td>
Expand Down
6 changes: 3 additions & 3 deletions src/ralph/cmdb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def add_filter(request, **kwargs):
filters |= Q(**{k: v})
if request.get('ci'):
ci = CI.objects.select_related('id').filter(
name=request.get('ci')
Q(name=request.get('ci')) | Q(uid=request.get('ci'))
)
if ci:
filters &= Q(cis=ci[0])
Expand Down Expand Up @@ -88,8 +88,8 @@ def table_colums():
),
_(
'Ci',
field='ci',
sort_expression='ci',
field='cis',
sort_expression='cis',
bob_tag=True,
),
_(
Expand Down
5 changes: 4 additions & 1 deletion src/ralph/cmdb/views_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ def get(self, *args, **kwargs):
priority__icontains=values.get('priority')
)
if values.get('uid'):
changes = changes.filter(Q(ci__name__icontains=values.get('uid')))
changes = changes.filter(
Q(ci__name__icontains=values.get('uid')) |
Q(ci__uid__icontains=values.get('uid'))
)
changes = changes.order_by('-time')
self.data_table_query(changes)
return super(Changes, self).get(*args)
Expand Down

0 comments on commit 103a061

Please sign in to comment.