Sha256: 97ffd16fffd9bebc2a3ba51d976df0a2e972afec4129a6ad26944a7ce5500cc0

Contents?: true

Size: 1.54 KB

Versions: 12

Compression:

Stored size: 1.54 KB

Contents

(function($)
{
    var REFRESH_SERVICES_TIMEOUT = 5000;

    $.ajaxSetup({
        error: function(e, req, options, error)
        {
            $('#url').text(settings.url);
            $('#error').show();
        }
    });

    var needRefreshServices;
    var refreshServices = function()
    {
        refreshServices.timer = null;
        $.ajax({
            url: '/services',
            cache: false,
            error: function()
            {
                $('#url').text('/services');
                $('#error').show();
            },
            success: function(html)
            {
                $('#error').hide();
                $('#services').html(html);
            },
            complete: function()
            {
                needRefreshServices(false);
            }
        });
    };

    needRefreshServices = function(now)
    {
        if (refreshServices.timer != null)
        {
            clearTimeout(refreshServices.timer);
            refreshServices.timer = null;
        }
        if (now)
        {
            refreshServices();
        }
        else
        {
            refreshServices.timer = setTimeout(refreshServices, REFRESH_SERVICES_TIMEOUT);
        }
    };

    $('#services').delegate('form.service-action,form.service-signal', 'submit', function()
    {
        $.post($(this).attr('action'), function(data)
        {
            needRefreshServices(true);
        });
        return false;
    });

    $('#service-refresh-interval').text(REFRESH_SERVICES_TIMEOUT / 1000);

    needRefreshServices(true);
})(jQuery);

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
runit-man-1.9.7 public/js/runit-man.js
runit-man-1.9.6 public/js/runit-man.js
runit-man-1.9.5 public/js/runit-man.js
runit-man-1.9.4 public/js/runit-man.js
runit-man-1.9.2 public/js/runit-man.js
runit-man-1.9.1 public/js/runit-man.js
runit-man-1.9.0 public/js/runit-man.js
runit-man-1.8.4 public/js/runit-man.js
runit-man-1.8.3 public/js/runit-man.js
runit-man-1.8.2 public/js/runit-man.js
runit-man-1.8.1 public/js/runit-man.js
runit-man-1.8.0 public/js/runit-man.js