chg: [correlation] add direct correlation stats

This commit is contained in:
Terrtia 2023-05-25 16:00:27 +02:00
parent c008366f02
commit ee951ca948
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
3 changed files with 21 additions and 1 deletions

View file

@ -356,6 +356,10 @@ def obj_correlations_objs_add_tags(obj_type, subtype, obj_id, tags, filter_types
add_obj_tags(obj1_type, subtype1, id1, tags) add_obj_tags(obj1_type, subtype1, id1, tags)
return objs return objs
def get_obj_nb_correlations(obj_type, subtype, obj_id, filter_types=[]):
obj = get_object(obj_type, subtype, obj_id)
return obj.get_nb_correlations(filter_types=filter_types)
################################################################################ ################################################################################
################################################################################ TODO ################################################################################ TODO
################################################################################ ################################################################################

View file

@ -125,7 +125,8 @@ def show_correlation():
"max_nodes": max_nodes, "mode": mode, "max_nodes": max_nodes, "mode": mode,
"filter": filter_types, "filter_str": ",".join(filter_types), "filter": filter_types, "filter_str": ",".join(filter_types),
"metadata": ail_objects.get_object_meta(obj_type, subtype, obj_id, "metadata": ail_objects.get_object_meta(obj_type, subtype, obj_id,
options={'tags'}, flask_context=True) options={'tags'}, flask_context=True),
"nb_correl": ail_objects.get_obj_nb_correlations(obj_type, subtype, obj_id)
} }
if subtype: if subtype:
dict_object["metadata"]['type_id'] = subtype dict_object["metadata"]['type_id'] = subtype

View file

@ -262,6 +262,21 @@
</p> </p>
</li> </li>
</ul> </ul>
<ul class="list-group">
<li class="list-group-item list-group-item-secondary"><i class="fas fa-project-diagram"></i> Direct Correlations</li>
<li class="list-group-item text-left">
{% for obj_type in dict_object['nb_correl'] %}
<div class="row">
<div class="col-8">
{{ obj_type }}
</div>
<div class="col-4">
<span class="badge badge-primary">{{ dict_object['nb_correl'][obj_type] }}</span>
</div>
</div>
{% endfor %}
</li>
</ul>
</div> </div>
</div> </div>