Skip to content

Commit

Permalink
Merge pull request #224 from IABTechLab/ajy-UID2-2896-Support-special…
Browse files Browse the repository at this point in the history
…-characters-in-search

Support special characters in search
  • Loading branch information
alex-yau-ttd authored Feb 28, 2024
2 parents 765ade0 + ab379e8 commit 8a9101f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
25 changes: 17 additions & 8 deletions webroot/adm/client-key.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,36 @@ <h3>Output</h3>
$(document).ready(function () {

$('#searchSiteId').on('click', function () {
if(!$('#searchBySiteId').val()) {
var siteId = encodeURIComponent($('#searchBySiteId').val());
if (!siteId) {
$('#errorOutput').html("Required Parameter: site_id")
return;
}
doApiCall('GET', '/api/client/list/' + $('#searchBySiteId').val(), '#standardOutput', '#errorOutput');
var url = `/api/client/list/${siteId}`;

doApiCall('GET', url, '#standardOutput', '#errorOutput');
});

$('#searchKeyId').on('click', function () {
if(!$('#searchByKeyId').val()) {
var keyId = encodeURIComponent($('#searchByKeyId').val());
if (!keyId) {
$('#errorOutput').html("Required Parameter: key_id")
return;
}
doApiCall('GET', '/api/client/keyId?keyId=' + $('#searchByKeyId').val(), '#standardOutput', '#errorOutput');
var url = `/api/client/keyId?keyId=${keyId}`;

doApiCall('GET', url, '#standardOutput', '#errorOutput');
});

$('#searchContact').on('click', function () {
if(!$('#searchByContact').val()) {
var contact = encodeURIComponent($('#searchByContact').val());
if (!contact) {
$('#errorOutput').html("Required Parameter: contact")
return;
}
doApiCall('GET', '/api/client/contact?contact=' + $('#searchByContact').val(), '#standardOutput', '#errorOutput');
var url = `/api/client/contact?contact=${contact}`;

doApiCall('GET', url, '#standardOutput', '#errorOutput');
});

$('#doMeta').on('click', function () {
Expand Down Expand Up @@ -173,7 +182,7 @@ <h3>Output</h3>
});

$('#doDisable').on('click', function () {
const clientContact = $('#clientContact').val();
const clientContact = encodeURIComponent($('#clientContact').val());
var encodedClientContact = encodeURIComponent(clientContact);
var url = '/api/client/disable?contact=' + encodedClientContact;

Expand All @@ -186,7 +195,7 @@ <h3>Output</h3>
});

$('#doEnable').on('click', function () {
const clientContact = $('#clientContact').val();
const clientContact = encodeURIComponent($('#clientContact').val());
var encodedClientContact = encodeURIComponent(clientContact);
var url = '/api/client/enable?contact=' + encodedClientContact;

Expand Down
2 changes: 1 addition & 1 deletion webroot/adm/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>Output</h3>
<script language="JavaScript">
$(document).ready(function () {
$('#doSearch').on('click', function () {
var keyString = $('#key').val();
var keyString = encodeURIComponent($('#key').val());
const url = '/api/search';

doApiCallWithBody('POST', url, keyString, '#standardOutput', '#errorOutput');
Expand Down
7 changes: 5 additions & 2 deletions webroot/adm/site.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ <h3>Output</h3>
$(document).ready(function () {

$('#searchList').on('click', function () {
if(!$('#searchSiteId').val()) {
var siteId = encodeURIComponent($('#searchSiteId').val());
if (!siteId) {
$('#errorOutput').html("Required Parameters: site_id")
return;
}
doApiCall('GET', '/api/site/' + $('#searchSiteId').val(), '#standardOutput', '#errorOutput');
var url = `/api/site/${siteId}`;

doApiCall('GET', url, '#standardOutput', '#errorOutput');
});

$('#doList').on('click', function () {
Expand Down

0 comments on commit 8a9101f

Please sign in to comment.