api: add hostname search for list_devices function (#10652)

* api: add domain type for list_devices function

api: add domain type query for list_devices

undo librenms-docker specification.

* api: list_devices change domain query by hostname. fix to search pattern in hostname

* Update Devices.md
This commit is contained in:
Garel Leo
2019-10-20 17:18:10 +02:00
committed by Tony Murray
parent e40a336315
commit 7bebd6ba4a
2 changed files with 3 additions and 0 deletions

View File

@@ -927,6 +927,7 @@ Input:
- ipv4: search by IPv4 address
- ipv6: search by IPv6 address (compressed or uncompressed)
- location: search by location
- hostname: search by hostname
- query: If searching by, then this will be used as the input.
Example:

View File

@@ -300,6 +300,8 @@ function list_devices(\Illuminate\Http\Request $request)
$sql = "`d`.`ignore`='0' AND `d`.`disabled`='0'";
} elseif ($type == 'location') {
$sql = "`locations`.`location` LIKE '%".$query."%'";
} elseif ($type == 'hostname') {
$sql = "`d`.`hostname` LIKE '%".$query."%'";
} elseif ($type == 'ignored') {
$sql = "`d`.`ignore`='1' AND `d`.`disabled`='0'";
} elseif ($type == 'up') {