List all elements at Firewall rules

firewall

(Michael Träumner) #1

Hi to all,
If I want to create a firewall rule and for example want to choose the source I get 10 of 39 results, but there is no option to show the other ones. If you know what are you searching for it’s no problem you can find, but you can’t have a list with all rules. A button for next page would be nice.


(Giacomo Sanchietti) #2

Sadly, this was a design choice.

Changing the behavior of the page is not trivial.
But you can have a look at the relevant part of code: https://github.com/NethServer/nethserver-firewall-base/tree/master/root/usr/share/nethesis/NethServer/Module


(Michael Träumner) #3

Hi @giacomo,
thanks for your answer. I think the easiest way is to increase the value of shown results to 1000 at the file PickObject.php. I hope nobody has more results :stuck_out_tongue_winking_eye:

  $T = array($view, 'translate');
            $s = \NethServer\Tool\FirewallObjectsFinder::search($this->getPlatform(), $this->getRequest()->getParameter('q'), $where, $T);
            $i = 0;
            /* @var $result \NethServer\Tool\FirewallObject */
            $partial = 1000;
            foreach ($s as $result) {
                $results[] = array($result->getValue(), $result->getTitle());
                if (++ $i >= $partial) {
                    $view['ResultsCount'] = $view->translate('Show_x_outof_y_label', array('partial' => $partial, 'total' => count($s)));
                    break;
                }
            }
            $view['ResultDatasource'] = $results;
            if ( ! isset($view['ResultsCount'])) {
                $view['ResultsCount'] = '';
            }
            if( ! $this->parameters['q']) {
               $view->getCommandList()->show();

I’m not a developer but in my opinion It should be the following variable

$partial = 1000;


(Giacomo Sanchietti) #4

That’s ok for me, but I don’t know if it’s workable on large installations.

@davide_marini @filippo_carletti what do you think?


(Davide Marini) #5

Hi all,
I just tried it in a quite large installation (about 300 entries among hosts, CIDR …) and it seemed to work flawlessy.
May be 1000 entries could be too much (I don’t have an installation with so many defined objects to check now).
Probably just increasing from 10 to 100 (or maybe 200) objects should improve dramatically the usage of this component avoiding to go always in the firewall objects section to know what object to use.