diff options
Diffstat (limited to 'web/js/nms-data.js')
| -rw-r--r-- | web/js/nms-data.js | 32 | 
1 files changed, 31 insertions, 1 deletions
| diff --git a/web/js/nms-data.js b/web/js/nms-data.js index 5a219e8..37cc11c 100644 --- a/web/js/nms-data.js +++ b/web/js/nms-data.js @@ -36,6 +36,7 @@ var nmsData = nmsData || {  		newSource:0,  		oldSource:0  	}, +	_pulseBeat: 0,  	/*  	 * The last time stamp of any data received, regardless of source.  	 * @@ -119,11 +120,39 @@ nmsData.registerSource = function(name, target) {  	} else {  		this.stats.oldSource++;  	} -  	this.stats.pollSets++;  };  /* + * Show sign-of-life to the user. + * + * Now that we don't show the date field constantly it is nice to indicate + * to the user that things are still running in some discreet manner. + * + * The actual html might not be the best choice, but I think the general + * idea of some sort of heartbeat is needed. + */ +nmsData._pulse = function() { +	if (nmsData._pulseElement == undefined) { +		try { +			nmsData._pulseElement = document.getElementById("heartbeat"); +		} catch(e) { +			nmsData._pulseElement = null; +		} +	} +	if (nmsData._pulseElement == null) +		return; +	if (nmsData._pulseBeat > 20) { +		if (nmsData._pulseElement.classList.contains("pulse-on")) { +			nmsData._pulseElement.classList.remove("pulse-on"); +		} else { +			nmsData._pulseElement.classList.add("pulse-on"); +		} +		nmsData._pulseBeat = 0; +	} +	nmsData._pulseBeat++; +} +/*   * Add a handler (callback) for a source, using an id.   *   * This is idempotent: if the id is the same, it will just overwrite the @@ -271,6 +300,7 @@ nmsData._genericUpdater = function(name, cacheok) {  				}  				nmsData.stats.identicalFetches++;  			} +			nmsData._pulse();  		},  		complete: function(jqXHR, textStatus) {  			nmsData.stats.outstandingAjaxRequests--; | 
