summaryrefslogtreecommitdiff
path: root/python/gras
diff options
context:
space:
mode:
authorJosh Blum2013-03-28 22:02:41 -0500
committerJosh Blum2013-03-28 22:02:41 -0500
commitfd5e1bdc2331f4dd8dc5a07d4b0b9a568fa8d8ff (patch)
tree1f96b262e95f9b4af2ac411111ff1e9a4fcf7252 /python/gras
parentd00575db6dbe8ec4a0df411a8bfe18922138db6e (diff)
downloadsandhi-fd5e1bdc2331f4dd8dc5a07d4b0b9a568fa8d8ff.tar.gz
sandhi-fd5e1bdc2331f4dd8dc5a07d4b0b9a568fa8d8ff.tar.bz2
sandhi-fd5e1bdc2331f4dd8dc5a07d4b0b9a568fa8d8ff.zip
gras: work on passing only active blocks into the request
Diffstat (limited to 'python/gras')
-rw-r--r--python/gras/query/chart_factory.js14
-rw-r--r--python/gras/query/main.js2
2 files changed, 16 insertions, 0 deletions
diff --git a/python/gras/query/chart_factory.js b/python/gras/query/chart_factory.js
index 3cce4d6..bd51c53 100644
--- a/python/gras/query/chart_factory.js
+++ b/python/gras/query/chart_factory.js
@@ -12,6 +12,20 @@ var gras_chart_get_registry = function()
}
/***********************************************************************
+ * get blocks that need active querying
+ **********************************************************************/
+function gras_chart_factory_active_blocks(registry)
+{
+ if (!('active_charts' in registry)) return "";
+ var block_ids = new Array();
+ $.each(registry.active_charts, function(index, chart_info)
+ {
+ $.merge(block_ids, chart_info.args.block_ids);
+ });
+ return $.unique(block_ids);
+}
+
+/***********************************************************************
* update after new query event
**********************************************************************/
function gras_chart_factory_update(registry, point)
diff --git a/python/gras/query/main.js b/python/gras/query/main.js
index 8255f97..ff05b15 100644
--- a/python/gras/query/main.js
+++ b/python/gras/query/main.js
@@ -26,6 +26,8 @@ var gras_query_stats = function(registry)
async: true,
url: "/stats.json",
dataType: "json",
+ traditional: true, //needed to parse data
+ data: {block:gras_chart_factory_active_blocks(registry)},
success: function(response)
{
registry.online = true;