View Issue Details

IDProjectCategoryView StatusLast Update
1773RackTablesIPv4/IPv6/SLBpublic2017-06-16 16:45
ReporterfstuckAssigned Toinfrastation 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.20.11 
Target Version0.20.14Fixed in Version0.20.14 
Summary1773: Functionality to search for IPv4 Blocks by comment (Patch enclosed)
DescriptionRackTables search allows searching by a comment in many types of resources, but not IPv4 Blocks. Here's a patch to resolve that!
Steps To Reproduce* Search for something in an IPv4's comment field.

Results: n/a!

* Apply patch
* Search for something in an IPv4's comment field.

Results: works!

Testing: needed?
Additional InformationThis was modeled after the getObjectAttrsSearchResults function

This doesn't return the comment field as part of the search results; I think this is actually OK, as comment fields can be *huge.*

In the database.php file
Original Search by IPv4 only searches name:
function getIPv4PrefixSearchResult ($terms)
{
        $byname = getSearchResultByField
        (
                'IPv4Network',
                array ('id'),
                'name',
                $terms,
                'ip'
        );
        $ret = array();
        foreach ($byname as $row)
                $ret[$row['id']] = spotEntity ('ipv4net', $row['id']);
        return $ret;
}

New Search by IPv4 searches name and comment:
function getIPv4PrefixSearchResult ($terms)
{
        $ret = array();
        foreach (array ('name', 'comment') as $column)
        {
                $tmp = getSearchResultByField
                (
                        'IPv4Network',
                        array ('id'),
                        $column,
                        $terms,
                        'ip'
                );
                foreach ($tmp as $row)
                {
                    $ret[$row['id']] = spotEntity ('ipv4net', $row['id']);
                }
        }
        return $ret;
}
TagsNo tags attached.

Activities

infrastation

infrastation

2017-06-16 16:45

administrator   ~0003635

Thank you, this change will be available in 0.20.14.

Issue History

Date Modified Username Field Change
2017-06-16 00:59 fstuck New Issue
2017-06-16 00:59 fstuck Status new => assigned
2017-06-16 00:59 fstuck Assigned To => andriyanov
2017-06-16 16:45 infrastation Assigned To andriyanov => infrastation
2017-06-16 16:45 infrastation Status assigned => closed
2017-06-16 16:45 infrastation Resolution open => fixed
2017-06-16 16:45 infrastation Fixed in Version => 0.20.14
2017-06-16 16:45 infrastation Target Version => 0.20.14
2017-06-16 16:45 infrastation Note Added: 0003635