mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
[fix: [UI-hash] fix graph node zoom
This commit is contained in:
parent
03a37af5cf
commit
009f87ee10
2 changed files with 25 additions and 11 deletions
|
@ -102,12 +102,19 @@ def save_hash(decoder_name, message, date, decoded):
|
||||||
# create hash metadata
|
# create hash metadata
|
||||||
serv_metadata.sadd('hash_'+ decoder_name +'_all_type', type)
|
serv_metadata.sadd('hash_'+ decoder_name +'_all_type', type)
|
||||||
|
|
||||||
|
# first time we see this hash today
|
||||||
|
if serv_metadata.zscore('hash_date:'+date_key, hash) is None:
|
||||||
|
serv_metadata.zincrby('hash_type:'+type, date_key, 1)
|
||||||
|
|
||||||
|
# first time we see this hash encoding today
|
||||||
|
if serv_metadata.zscore(decoder_name+'_date:'+date_key, hash) is None:
|
||||||
|
serv_metadata.zincrby(decoder_name+'_type:'+type, date_key, 1)
|
||||||
|
|
||||||
save_hash_on_disk(decoded, type, hash, json_data)
|
save_hash_on_disk(decoded, type, hash, json_data)
|
||||||
print('found {} '.format(type))
|
print('found {} '.format(type))
|
||||||
|
|
||||||
serv_metadata.hincrby('metadata_hash:'+hash, decoder_name+'_decoder', 1)
|
serv_metadata.hincrby('metadata_hash:'+hash, decoder_name+'_decoder', 1)
|
||||||
|
|
||||||
serv_metadata.zincrby('hash_type:'+type, date_key, 1)
|
|
||||||
serv_metadata.zincrby(decoder_name+'_type:'+type, date_key, 1)
|
serv_metadata.zincrby(decoder_name+'_type:'+type, date_key, 1)
|
||||||
|
|
||||||
serv_metadata.zincrby('nb_seen_hash:'+hash, message, 1)# hash - paste map
|
serv_metadata.zincrby('nb_seen_hash:'+hash, message, 1)# hash - paste map
|
||||||
|
|
|
@ -191,8 +191,8 @@
|
||||||
<i id="flash-tld" class="glyphicon glyphicon-flash " flash-tld=""></i> Graph
|
<i id="flash-tld" class="glyphicon glyphicon-flash " flash-tld=""></i> Graph
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body" style="text-align:center;">
|
<div class="panel-body" style="text-align:center;">
|
||||||
<button class="btn btn-primary" onclick="redraw_graph();">
|
<button class="btn btn-primary" onclick="resize_graph();">
|
||||||
<span class="glyphicon glyphicon-refresh"></span> Redraw Graph</div>
|
<span class="glyphicon glyphicon-refresh"></span> Resize Graph</div>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -251,9 +251,9 @@
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function redraw_graph() {
|
function resize_graph() {
|
||||||
container_graph.attr("transform", "translate(40,0)")
|
zoom.translateTo(svg_node, 200, 200);
|
||||||
.attr("transform", "scale(2)");
|
zoom.scaleTo(svg_node, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -301,7 +301,11 @@ var width = 400,
|
||||||
|
|
||||||
var link;
|
var link;
|
||||||
|
|
||||||
var transform = d3.zoomIdentity;
|
var zoom = d3.zoom()
|
||||||
|
.scaleExtent([.2, 10])
|
||||||
|
.on("zoom", zoomed);
|
||||||
|
|
||||||
|
//var transform = d3.zoomIdentity;
|
||||||
|
|
||||||
var color = d3.scaleOrdinal(d3.schemeCategory10);
|
var color = d3.scaleOrdinal(d3.schemeCategory10);
|
||||||
|
|
||||||
|
@ -322,9 +326,9 @@ var svg_node = d3.select("#graph").append("svg")
|
||||||
.call(d3.zoom().scaleExtent([1, 8]).on("zoom", zoomed))
|
.call(d3.zoom().scaleExtent([1, 8]).on("zoom", zoomed))
|
||||||
.on("dblclick.zoom", null)
|
.on("dblclick.zoom", null)
|
||||||
|
|
||||||
var container_graph = svg_node.append("g")
|
var container_graph = svg_node.append("g");
|
||||||
.attr("transform", "translate(40,0)")
|
//.attr("transform", "translate(40,0)")
|
||||||
.attr("transform", "scale(2)");
|
//.attr("transform", "scale(2)");
|
||||||
|
|
||||||
function create_graph(url){
|
function create_graph(url){
|
||||||
|
|
||||||
|
@ -372,6 +376,9 @@ d3.json(url)
|
||||||
return d.icon
|
return d.icon
|
||||||
} });
|
} });
|
||||||
|
|
||||||
|
zoom.translateTo(svg_node, 200, 200);
|
||||||
|
zoom.scaleTo(svg_node, 2);
|
||||||
|
|
||||||
/* node.append("text")
|
/* node.append("text")
|
||||||
.attr("dy", 3)
|
.attr("dy", 3)
|
||||||
.attr("dx", 7)
|
.attr("dx", 7)
|
||||||
|
@ -403,7 +410,7 @@ d3.json(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
function zoomed() {
|
function zoomed() {
|
||||||
container_graph.attr("transform", d3.event.transform);
|
container_graph.attr("transform", d3.event.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
function doubleclick (d) {
|
function doubleclick (d) {
|
||||||
|
|
Loading…
Reference in a new issue