used fixedName variable to transport db lookup optimization

This commit is contained in:
Jay Zarfoss 2019-11-20 09:44:31 -08:00
parent 93aca891b7
commit 00a0a27826
3 changed files with 5 additions and 2 deletions

View File

@ -393,6 +393,9 @@ def render(args):
Certificate.cn.ilike(term),
)
)
elif "fixedName" in terms:
# only what matches the fixed name directly if a fixedname is provided
query = query.filter(Certificate.name == terms[1])
else:
query = database.filter(query, Certificate, terms)

View File

@ -11,7 +11,7 @@ angular.module('lemur')
controller: 'CertificatesViewController'
})
.state('certificate', {
url: '/certificates/:name',
url: '/certificates/:fixedName', // use "fixedName" if in URL to indicate 'like' query can be avoided
templateUrl: '/angular/certificates/view/view.tpl.html',
controller: 'CertificatesViewController'
});

View File

@ -52,7 +52,7 @@
</td>
<td data-title="''" style="text-align: center; vertical-align: middle;">
<div class="btn-group pull-right" role="group" aria-label="...">
<a class="btn btn-sm btn-primary" ui-sref="certificate({name: certificate.name})">Permalink</a>
<a class="btn btn-sm btn-primary" ui-sref="certificate({fixedName: certificate.name})">Permalink</a>
<button ng-model="certificate.toggle" class="btn btn-sm btn-info" uib-btn-checkbox btn-checkbox-true="1"
btn-checkbox-false="0">More
</button>