Sha256: 6f754750ee9f25443332559bf14ce7f14fbb0a58e2e4717b110e31ccc94b7ab7

Contents?: true

Size: 1.57 KB

Versions: 24

Compression:

Stored size: 1.57 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);
        }
    };

    $('form.service-action').live('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

24 entries across 24 versions & 1 rubygems

Version Path
runit-man-1.7.2 public/js/runit-man.js
runit-man-1.7.1 public/js/runit-man.js
runit-man-1.7.0 public/js/runit-man.js
runit-man-1.6.4 public/js/runit-man.js
runit-man-1.6.3 public/js/runit-man.js
runit-man-1.6.2 public/js/runit-man.js
runit-man-1.6.1 public/js/runit-man.js
runit-man-1.6.0 public/js/runit-man.js
runit-man-1.5.4 public/js/runit-man.js
runit-man-1.5.3 public/js/runit-man.js
runit-man-1.5.2 public/js/runit-man.js
runit-man-1.5.1 public/js/runit-man.js
runit-man-1.5.0 public/js/runit-man.js
runit-man-1.4.9 public/js/runit-man.js
runit-man-1.4.8 public/js/runit-man.js
runit-man-1.4.7 public/js/runit-man.js
runit-man-1.4.6 public/js/runit-man.js
runit-man-1.4.5 public/js/runit-man.js
runit-man-1.4.4 public/js/runit-man.js
runit-man-1.4.3 public/js/runit-man.js