function refresh(asqPanelContainer) {
  var requestUrl;
  var overlay = asqPanelContainer.find('.asq-overlay');
  var body = asqPanelContainer.find('.panel-body');
  var intId;

  // get the panel's asq id, which will help us send an HTTP refresh request:
  var asqId = asqPanelContainer.find('.panel').attr('data-asq_id');

  // get the panel's last_run_value for comparison:
  var lastUpdated = asqPanelContainer.find('.hidden_last_run').html();

  // if the url doesn't have 'asq' in it, then I'm probably on the index page.
  if (document.URL.search('asq') === -1) {
    requestUrl = '/asqs/partial/' + asqId;
  // conversely, if 'asqs' is in the url, then I'm probs on the asqs#show page.
  } else {
    requestUrl = '/asqs/' + asqId;
  }

  overlay.fadeTo(500, 1);
  body.fadeTo(1500, 0.2);

  // hit the asq/ajax endpoint to get its last_run time and compare
  intId = setInterval(function asqRefreshLoop() {
    $.ajax({url: '/asqs/ajax/' + asqId + '/refresh_in_progress', dataType: 'json', success: function processAjaxRepsonse(result) {
      if (result.refresh_in_progress === false) {
        clearInterval(intId);
        // at this point, hit the request_url and grab the updated panel:
        $.ajax({url: requestUrl, success: function replacePanel(refreshedPanel) {
          asqPanelContainer.html($(refreshedPanel).find('.panel-container').html());
          asqPanelContainer.find('.panel-body').css('opacity', '0.2').fadeTo(400, 1);
          asqPanelContainer.find('.asq-overlay').show().fadeOut(700);
        }});
      }
    }});
  }, 1000);
}
// used to refresh asq panels with updated information.
used to refresh asq panels with updated information.
used to refresh asq panels with updated information .
function refresh(asqPanelContainer) {
  var requestUrl;
  var overlay = asqPanelContainer.find('.asq-overlay');
  var body = asqPanelContainer.find('.panel-body');
  var intId;
  var asqId = asqPanelContainer.find('.panel').attr('data-asq_id');
  var lastUpdated = asqPanelContainer.find('.hidden_last_run').html();
  if (document.URL.search('asq') === -1) {
    requestUrl = '/asqs/partial/' + asqId;
  } else {
    requestUrl = '/asqs/' + asqId;
  }
  overlay.fadeTo(500, 1);
  body.fadeTo(1500, 0.2);
  intId = setInterval(function asqRefreshLoop() {
    $.ajax({url: '/asqs/ajax/' + asqId + '/refresh_in_progress', dataType: 'json', success: function processAjaxRepsonse(result) {
      if (result.refresh_in_progress === false) {
        clearInterval(intId);
        $.ajax({url: requestUrl, success: function replacePanel(refreshedPanel) {
          asqPanelContainer.html($(refreshedPanel).find('.panel-container').html());
          asqPanelContainer.find('.panel-body').css('opacity', '0.2').fadeTo(400, 1);
          asqPanelContainer.find('.asq-overlay').show().fadeOut(700);
        }});
      }
    }});
  }, 1000);
}
function refresh ( asqPanelContainer ) { var requestUrl ; var overlay = asqPanelContainer . find ( '.asq-overlay' ) ; var body = asqPanelContainer . find ( '.panel-body' ) ; var intId ; var asqId = asqPanelContainer . find ( '.panel' ) . attr ( 'data-asq_id' ) ; var lastUpdated = asqPanelContainer . find ( '.hidden_last_run' ) . html ( ) ; if ( document . URL . search ( 'asq' ) === - 1 ) { requestUrl = '/asqs/partial/' + asqId ; } else { requestUrl = '/asqs/' + asqId ; } overlay . fadeTo ( 500 , 1 ) ; body . fadeTo ( 1500 , 0.2 ) ; intId = setInterval ( function asqRefreshLoop ( ) { $ . ajax ( { url : '/asqs/ajax/' + asqId + '/refresh_in_progress' , dataType : 'json' , success : function processAjaxRepsonse ( result ) { if ( result . refresh_in_progress === false ) { clearInterval ( intId ) ; $ . ajax ( { url : requestUrl , success : function replacePanel ( refreshedPanel ) { asqPanelContainer . html ( $ ( refreshedPanel ) . find ( '.panel-container' ) . html ( ) ) ; asqPanelContainer . find ( '.panel-body' ) . css ( 'opacity' , '0.2' ) . fadeTo ( 400 , 1 ) ; asqPanelContainer . find ( '.asq-overlay' ) . show ( ) . fadeOut ( 700 ) ; } } ) ; } } } ) ; } , 1000 ) ; }
used to refresh asq panels with updated information.
used to refresh asq panels with updated information .
// get the panel's asq id, which will help us send an HTTP refresh request: // get the panel's last_run_value for comparison: // if the url doesn't have 'asq' in it, then I'm probably on the index page. // conversely, if 'asqs' is in the url, then I'm probs on the asqs#show page. // hit the asq/ajax endpoint to get its last_run time and compare // at this point, hit the request_url and grab the updated panel: