Adds support for filtering by UI. Closes #702. (#706)

This commit is contained in:
kevgliss 2017-03-03 15:07:26 -08:00 committed by GitHub
parent fc957b63ff
commit 310e1d4501
2 changed files with 6 additions and 1 deletions

View File

@ -9,7 +9,7 @@ import arrow
from datetime import timedelta from datetime import timedelta
from flask import current_app from flask import current_app
from sqlalchemy import func, or_, not_, cast, Boolean from sqlalchemy import func, or_, not_, cast, Boolean, Integer
from cryptography import x509 from cryptography import x509
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
@ -299,6 +299,8 @@ def render(args):
Certificate.domains.any(Domain.name.ilike('%{0}%'.format(terms[1]))) Certificate.domains.any(Domain.name.ilike('%{0}%'.format(terms[1])))
) )
) )
elif 'id' in terms:
query = query.filter(Certificate.id == cast(terms[1], Integer))
else: else:
query = database.filter(query, Certificate, terms) query = database.filter(query, Certificate, terms)

View File

@ -24,6 +24,9 @@
<table ng-table="certificateTable" class="table" show-filter="showFilter" template-pagination="angular/pager.html"> <table ng-table="certificateTable" class="table" show-filter="showFilter" template-pagination="angular/pager.html">
<tbody> <tbody>
<tr ng-class="{'even-row': $even }" ng-repeat-start="certificate in $data track by $index"> <tr ng-class="{'even-row': $even }" ng-repeat-start="certificate in $data track by $index">
<td data-title="'Id'" filter="{'id': 'text'}">
{{ certificate.id }}
</td>
<td data-title="'Name'" sortable="'name'" filter="{ 'name': 'text' }"> <td data-title="'Name'" sortable="'name'" filter="{ 'name': 'text' }">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li>{{ certificate.name }}</li> <li>{{ certificate.name }}</li>