From ee951ca9486e9ac9e6c08385d94c8cea1e0389c7 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Thu, 25 May 2023 16:00:27 +0200 Subject: [PATCH] chg: [correlation] add direct correlation stats --- bin/lib/objects/ail_objects.py | 4 ++++ var/www/blueprints/correlation.py | 3 ++- .../templates/correlation/show_correlation.html | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/bin/lib/objects/ail_objects.py b/bin/lib/objects/ail_objects.py index d52a0bbd..6886d6fc 100755 --- a/bin/lib/objects/ail_objects.py +++ b/bin/lib/objects/ail_objects.py @@ -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) 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 ################################################################################ diff --git a/var/www/blueprints/correlation.py b/var/www/blueprints/correlation.py index 35263974..e0eed996 100644 --- a/var/www/blueprints/correlation.py +++ b/var/www/blueprints/correlation.py @@ -125,7 +125,8 @@ def show_correlation(): "max_nodes": max_nodes, "mode": mode, "filter": filter_types, "filter_str": ",".join(filter_types), "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: dict_object["metadata"]['type_id'] = subtype diff --git a/var/www/templates/correlation/show_correlation.html b/var/www/templates/correlation/show_correlation.html index 8342e8b6..1329e2a5 100644 --- a/var/www/templates/correlation/show_correlation.html +++ b/var/www/templates/correlation/show_correlation.html @@ -262,6 +262,21 @@

+