Merge pull request #2873 from zarfide/permalinkOptimization_jzarfoss

used fixedName variable to transport db lookup optimization
This commit is contained in:
Jay Zarfoss 2019-11-20 10:40:34 -08:00 committed by GitHub
commit 805d6942ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -393,6 +393,9 @@ def render(args):
Certificate.cn.ilike(term), 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: else:
query = database.filter(query, Certificate, terms) query = database.filter(query, Certificate, terms)

View File

@ -11,7 +11,7 @@ angular.module('lemur')
controller: 'CertificatesViewController' controller: 'CertificatesViewController'
}) })
.state('certificate', { .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', templateUrl: '/angular/certificates/view/view.tpl.html',
controller: 'CertificatesViewController' controller: 'CertificatesViewController'
}); });

View File

@ -52,7 +52,7 @@
</td> </td>
<td data-title="''" style="text-align: center; vertical-align: middle;"> <td data-title="''" style="text-align: center; vertical-align: middle;">
<div class="btn-group pull-right" role="group" aria-label="..."> <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" <button ng-model="certificate.toggle" class="btn btn-sm btn-info" uib-btn-checkbox btn-checkbox-true="1"
btn-checkbox-false="0">More btn-checkbox-false="0">More
</button> </button>