Web UI - Search Bar Always Expanded

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
treesquid
Posts: 5
Joined: Wed Jul 10, 2019 12:10 pm

Web UI - Search Bar Always Expanded

Post by treesquid »

How would i be able to make it so that the search bar is always expanded, which would then not require me to click on the magnifying glass icon every time?
xisearchbar.png
You do not have the required permissions to view the files attached to this post.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Web UI - Search Bar Always Expanded

Post by benjaminsmith »

Hello @treesquid,

A couple of options for making this happen. You can either use the Custome Includes component to modifying the UI by adding your own CSS and Javascript or you could directly modify the PHP file and remove the hide class. However, this would be overwritten when you upgrade Nagios XI.

1. To learn more about the Customs Includes component, please see the following documentation:

Nagios XI - Using The Custom Includes Component

2. To modify the top-bar, you would edit the /usr/local/nagiosxi/html/includes/header.inc.php file, and go to line 139:

Code: Select all

  <div class="header-right search">
        <div class="search-field hide">
            <form method="post" target="maincontentframe" action="<?php echo get_base_url(); ?>includes/components/xicore/status.php?show=services">
                <input type="hidden" name="navbarsearch" value="1"/>
                <input type="text" class="search-query form-control" name="search" id="navbarSearchBox" value="" placeholder="<?php echo _('Search...'); ?>"/>
            </form>
        </div>
        <a href="#" id="open-search" title="<?php echo _('Search'); ?>"><i class="fa fa-search"></i></a>
    </div>
Here you can remove the hide class from search-field and the <i> tag if desired.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
treesquid
Posts: 5
Joined: Wed Jul 10, 2019 12:10 pm

Re: Web UI - Search Bar Always Expanded

Post by treesquid »

Thanks for the info Benjamin, i appreciate the info on how to do it either temporary or permanent (won't change with version update) so that i can make the temp fix now, and when i have time later i can implement the permanent solution.

Would it be possible to modify the hierarchy of the search drop-down results so that if there are results for services, host, hostgroups, etc found it will always display the hostgroup results at the top of the list? I notice there that hostgroup will always show at the bottom currently.
searchbardropdown.png
You do not have the required permissions to view the files attached to this post.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Web UI - Search Bar Always Expanded

Post by cdienger »

This can be done by editing /usr/local/nagiosxi/html/suggest.php. Starting around line is the suggest_multi() function which has a section to display services, hosts, servicegroups, and hostsgroup. These can be arranged in the order you'd like to see. To move Hostgroups to the top I moved this code:

Code: Select all

// Hostgroups
    $args = array(
        "hostgroup_name" => "lk:" . $query . ";alias=lk:" . $query,
        "brevity" => 1,
        "is_active" => 1,
        'orderby' => 'hostgroup_name:a',
        'records' => 10,
    );

    $res1 = get_hostgroup_objects_xml_output($args);
    $xres1 = simplexml_load_string($res1);

    if ($xres1) {
        foreach ($xres1->hostgroup as $obj) {
            $names[] = (object) array('url' => get_base_url().'/includes/components/xicore/status.php?show=hostgroups&hostgroup='.urlencode(strval($obj->hostgroup_name)),
                                      'value' => strval($obj->hostgroup_name),
                                      'category' => _('Hostgroup'),
                                      'label' => (stripos(strval($obj->hostgroup_name),$query) !== false) ? strval($obj->hostgroup_name) : _('[A] '). strval($obj->alias));
        }
    }

Above the "// Services line".
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked