12

1

I keep my case list open most of the time, and I can't tell from looking at it if the data are stale. Could you either add a timestamp so I know it's out of date, or better yet, have an option to have it refresh by ajax or some other unobtrusive method?

Fog Creek Case FC1888111

flag
Couldn't you write a one line bugmonkey script to do this? – Michael Pryor Apr 30 2010 at 14:55
+1 I use browser plugins to auto-refresh the case-list. It would be great if there was a "Keep up-to-date toggle, perhaps with an optional pulldown to set a timer between checks. It also just occurred to me that this could possibly be done as a BugMonkey script as a workaround – cdeszaq Sep 10 2010 at 13:22

2 Answers

5

You can approximate this functionality with a BugMonkey script, like

name:          Update List
description:   Add update functionality
author:        Daniel LeCheminant, Michel de Ruiter
version:       1.0.1.0

js:

$(function() {
  var storage = window.localStorage;
  if (!storage || $("#bugGrid").size() == 0)
    return;
  var getVal = function(key, def) {
    return (storage && storage[key]) || getCookie(key) || def;
  };
  var setVal = function(key, val) {
    storage ? storage[key] = val : setCookie(key, val);
  };
  var update = function() {
    if ($(".rCB:checked").length || $("#searchFor").val().length) {
      reset();
    } else {
      Info.show("Updating...")
      location = "?pg=pgList";
    }
  };
  var fixMins = function(sMins) {
    return Math.max(parseInt(sMins) || 5, 1);
  };
  var getMins = function() {
    return fixMins(getVal("cMinsRefresh", ""));
  };
  var timeout;
  var stop = function() {
    timeout = clearTimeout(timeout);
  };
  var reset = function(fStart) {
    if (timeout || fStart) {
      stop();
      timeout = setTimeout(update, getMins() * 60 * 1000);
    }
  };
  $(document).bind("click mousedown keydown", function() { reset(); });
  $(window).bind("scroll", function() { reset(); });
  var fAutoRefresh = getVal("fAutoRefresh", false) == "true";
  var span = $("<span class='update'>").insertAfter("#versionFooter .version:last");
  $('<input type="checkbox">')
  .attr("checked", fAutoRefresh ? "checked" : null)
  .click(function() {
    (fAutoRefresh = $(this).is(":checked")) ? reset(true) : stop();
    setVal("fAutoRefresh", fAutoRefresh);
  }).appendTo(span);
  span.append("Auto update every <input/> minutes")
  .find("input:last").val(getMins())
  .keyup(function() {
    setVal("cMinsRefresh", fixMins($(this).val()));
    reset();
  })
  .blur(function() {
    $(this).val(getMins());
  });
  reset(fAutoRefresh);
});


css:

span.update                                  { float: right; }
span.update > input[type='checkbox'] + input { width: 20px; text-align: right; }

... which will give you a little checkbox and input at the bottom of your filter:

The auto update checkbox

Some important notes/caveats:

  • It actually does do a page reload :-(
  • The update will behave exactly as if you clicked the "List Cases" link on FogBugz, so if you've changed your current filter in another window, you'll see that filter after the refresh.
  • The script tries to stay out of your way, so if won't ever update if you've checked some cases or entered some search terms in the search box.
  • If you click, type, or scroll the window, the timeout will be reset. (Again, the reduce the chances that the page will update when you're in the middle of doing something)
  • The refresh settings are per-browser, using local storage or cookies.
link|flag
Great script, we use it all the time. I turned it into a customization and separated the style into CSS. – Michel de Ruiter Apr 5 at 8:48
@Daniel this works for me, but please double check. – Michel de Ruiter Apr 5 at 8:48
2

We have a case open to consider this feature for a future release. Please up-vote this question to show your support for adding this feature.

link|flag
Really, instead of auto-refreshing (which I often find annoying), a notice that information on the list has changed, etc. would be nicer. – Kris K. Apr 27 2010 at 0:21
Growl, recently shown at MVCConf, might be a good way to do this – cdeszaq Jul 23 2010 at 15:25

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.