View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 538 | RackTables | default | public | 2012-03-02 11:05 | 2012-10-20 12:57 |
| Reporter | racktabler | Assigned To | infrastation | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | closed | Resolution | won't fix | ||
| Product Version | 0.19.11 | ||||
| Summary | 538: return allocated ip adresses in search result | ||||
| Description | Patch for returning ipv4 allocations if search for partial ip addresses e.g. "10.200" returns all allocated addresses containing this term. | ||||
| Tags | No tags attached. | ||||
| Attached Files | RT-ipv4allocationsearch.diff (2,075 bytes)
--- database.php.orig 2012-03-02 11:41:31.246420443 +0100
+++ database.php 2012-03-02 11:46:06.924372580 +0100
@@ -1827,6 +1827,25 @@
return $ret;
}
+function getIPv4AllocationSearchResult ($terms)
+{
+ $query = "select inet_ntoa(ip) as ip, name from IPv4Allocation where ";
+ $or = '';
+ $qparams = array();
+ foreach (explode (' ', $terms) as $term)
+ {
+ $query .= $or . "name like ? or inet_ntoa(ip) like ?";
+ $or = ' or ';
+ $qparams[] = "%${term}%";
+ $qparams[] = "%${term}%";
+ }
+ $result = usePreparedSelectBlade ($query, $qparams);
+ $ret = array();
+ while ($row = $result->fetch (PDO::FETCH_ASSOC))
+ $ret[$row['ip']] = $row;
+ return $ret;
+}
+
function getIPv6AddressSearchResult ($terms)
{
$query = "select ip, name from IPv6Address where ";
--- interface.php.orig 2012-03-02 11:41:45.009375719 +0100
+++ interface.php 2012-03-02 11:33:31.668379287 +0100
@@ -3507,6 +3507,7 @@
if ($record['net_id'] !== NULL)
echo "<script language='Javascript'>document.location='index.php?page=ipv6net&tab=default&id=${record['net_id']}&hl_ipv6_addr=${v6_ip_dq}';//</script>";
break;
+ case 'ipv4allocation':
case 'ipv4addressbydescr':
$parentnet = getIPv4AddressNetworkId ($record['ip']);
if ($parentnet !== NULL)
@@ -3667,6 +3668,7 @@
echo '</table>';
finishPortlet();
break;
+ case 'ipv4allocation':
case 'ipv4addressbydescr':
startPortlet ('IPv4 addresses');
echo '<table border=0 cellpadding=5 cellspacing=0 align=center class=cooltable>';
--- functions.php.orig 2012-03-02 11:41:56.995373419 +0100
+++ functions.php 2012-03-02 11:43:36.045373368 +0100
@@ -4238,6 +4238,7 @@
{
$summary['object'] = getObjectSearchResults ($terms);
$summary['ipv4addressbydescr'] = getIPv4AddressSearchResult ($terms);
+ $summary['ipv4allocation'] = getIPv4AllocationSearchResult ($terms);
$summary['ipv6addressbydescr'] = getIPv6AddressSearchResult ($terms);
$summary['ipv4network'] = getIPv4PrefixSearchResult ($terms);
$summary['ipv6network'] = getIPv6PrefixSearchResult ($terms);
| ||||
| This change seems to duplicate what is already available by means of getObjectIfacesSearchResults(). Could you test release 0.20.1 to see if any change is required? | |
| I tested it with 0.20.1 DEMO but the search term of "10.200" doesn't return anything. Did you mean 0.20.2? | |
|
It does return results for "eth0", which seemed to be the desired effect to me. Returning IP addresses which partially matched the search query seems wrong to me, because a better mean to access this information exists, that is, the network trees. What is your use case for this? |
|
|
I get "Nothing found for '10.200'". Sometimes it is faster to just search for e.g 10.200.1 to get all used ip's then click and scroll to it. Is there a way to make an full-text search over almost anything? So it would return even Objects, ... with the search term in its comment. I think this patch was just a kind of workaround for an full-text search. |
|
|
You are exactly right, a "10.200" search does not return any records, and I tend to view this as the intended behaviour as long as the search function interface is as straightforward as it is. That is, listing all matched results at once is likely to provide too many results for such searches. Such partial matches should be handled by a more advanced user interface like live suggestions and collapsible lists. This is not something I can currently afford implementing, and the other two active developers are not interested either. Closing this request is the most transparent thing I can do, excuse me. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-03-02 11:05 | racktabler | New Issue | |
| 2012-03-02 11:05 | racktabler | File Added: RT-ipv4allocationsearch.diff | |
| 2012-10-08 14:07 | infrastation | Assigned To | => infrastation |
| 2012-10-08 14:07 | infrastation | Status | new => assigned |
| 2012-10-09 17:38 | infrastation | Target Version | => 0.20.2 |
| 2012-10-18 12:50 | infrastation | Note Added: 0000891 | |
| 2012-10-18 12:50 | infrastation | Status | assigned => feedback |
| 2012-10-18 13:37 | racktabler | Note Added: 0000893 | |
| 2012-10-18 13:37 | racktabler | Status | feedback => assigned |
| 2012-10-18 15:09 | infrastation | Note Added: 0000899 | |
| 2012-10-18 15:33 | racktabler | Note Added: 0000901 | |
| 2012-10-20 12:57 | infrastation | Note Added: 0000927 | |
| 2012-10-20 12:57 | infrastation | Status | assigned => closed |
| 2012-10-20 12:57 | infrastation | Resolution | open => won't fix |
| 2012-10-20 12:57 | infrastation | Target Version | 0.20.2 => |