Pause the autorefresh via Javascript

Hello

I would like to pause the automatic refresh of a specific page (only) via some Javascript code because the plugin I am writing would have it’s own refresh.

I tried “Countdown.Pause()”; but without success so far.

Does anybody know how to proceed ?

./validate.php

Component Version
LibreNMS 1.38-64-gf1e3d63
DB Schema 247
PHP 7.0.27
MySQL 5.5.56-MariaDB
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

[OK] Composer Version: 1.6.4
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[FAIL] Discovery has not completed in the last 24 hours.
[FIX] Check the cron job to make sure it is running and using discovery-wrapper.py
[WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices.

Thanx and Bye

You set $no_refresh = true; in the php of the page to disable the refresh.

Hello laf

Thanx for the help but it doesn’t seems to do the trick. As I am in a plugin, I would think that the variable is not directly visible to make it. Any idea ?

Bye for now,

Here is a code snippet :

<?php

namespace LibreNMS\Plugins;

class SupportIT
{
        public function menu()
        {
                echo '<li><a href="plugin/p=SupportIT">SupportIT Port Management</a></li>';
        }//end menu()

        public function device_overview_container($device_id) {
                //echo('<div class="container-fluid"><div class="row"> <div class="col-md-12"> <div class="panel panel-default panel-condensed"> <div class="panel-heading"><strong>'.get_class().' Plugin </strong> </div>');
                //echo('  Example plugin in "Device - Overview" tab <br>');
                //echo('</div></div></div></div>');
        }

        public function port_container($device, $port) {
		// Let’s check if we have an access switch
                if  (preg_match('#^S5720-56C-PWR-EI-AC#', $device['sysDescr'] ) )
                {
                     $no_refresh = true;
                     echo ('<form class="form-horizontal" action="" method="post">');

Etc etc etc …

I doubt it will work in the Plugins (which will most likely go within a future release).

Ok.

Thanx for feedback.
Bye

Hello

Auto-feedback with a dirty but functionnal solution until a better one comes :

    public function port_container($device, $port) {
            global $no_refresh;
            if  (preg_match('#^S5720-56C-PWR-EI-AC#', $device['sysDescr'] ) )
            {
                    $no_refresh = true;
// etc etc etc 

Bye for now

1 Like