Search devices using display field as well (#14714)

This commit is contained in:
Gilles Depeyrot
2022-12-09 17:25:42 +01:00
committed by GitHub
parent 3a035257b5
commit ceb8a02a99
2 changed files with 5 additions and 5 deletions

View File

@@ -67,7 +67,7 @@ class DeviceController extends TableController
protected function searchFields($request)
{
return ['sysName', 'hostname', 'hardware', 'os', 'locations.location'];
return ['sysName', 'hostname', 'display', 'hardware', 'os', 'locations.location'];
}
protected function sortFields($request)

View File

@@ -133,8 +133,8 @@ if ($format == 'graph') {
}
if (! empty($vars['searchquery'])) {
$where .= ' AND (sysName LIKE ? OR hostname LIKE ? OR hardware LIKE ? OR os LIKE ? OR location LIKE ?)';
$sql_param += array_fill(count($param), 5, '%' . $vars['searchquery'] . '%');
$where .= ' AND (sysName LIKE ? OR hostname LIKE ? OR display LIKE ? OR hardware LIKE ? OR os LIKE ? OR location LIKE ?)';
$sql_param += array_fill(count($param), 6, '%' . $vars['searchquery'] . '%');
}
if (! empty($vars['os'])) {
$where .= ' AND os = ?';
@@ -344,7 +344,7 @@ if ($format == 'graph') {
},
post: function () {
return {
format: ' <?php echo $vars['format']; ?>',
format: '<?php echo $vars['format']; ?>',
searchPhrase: '<?php echo htmlspecialchars($vars['searchquery'] ?? ''); ?>',
os: '<?php echo $vars['os'] ?? ''; ?>',
version: '<?php echo $vars['version'] ?? ''; ?>',
@@ -372,7 +372,7 @@ if ($format == 'graph') {
"<form method='post' action='' class='form-inline devices-search-header' role='form'>" +
"<?php echo addslashes(csrf_field()) ?>"+
"<div class='form-group'>" +
"<input type='text' name='searchquery' id='searchquery' value=''<?php echo $vars['searchquery'] ?? ''; ?>'' class='form-control' placeholder='Search'>" +
"<input type='text' name='searchquery' id='searchquery' value='<?php echo $vars['searchquery'] ?? ''; ?>' class='form-control' placeholder='Search'>" +
"</div>" +
"<div class='form-group'><?php echo $state_selection ?></div>" +
"<div class='form-group'><select name='os' id='os' class='form-control'></select></div>" +