mirror of https://github.com/CIRCL/AIL-framework
chg: [UI settings] add ail modules svg + fix admin view
parent
6b5e833fc1
commit
02814e7f81
|
@ -50,6 +50,9 @@ class AILQueue:
|
||||||
subscribers[queue_name].add(module)
|
subscribers[queue_name].add(module)
|
||||||
self.subscribers_modules = subscribers
|
self.subscribers_modules = subscribers
|
||||||
|
|
||||||
|
def get_out_queues(self):
|
||||||
|
return list(self.subscribers_modules.keys())
|
||||||
|
|
||||||
def get_nb_messages(self):
|
def get_nb_messages(self):
|
||||||
return r_queues.llen(f'queue:{self.name}:in')
|
return r_queues.llen(f'queue:{self.name}:in')
|
||||||
|
|
||||||
|
@ -205,11 +208,12 @@ def save_queue_digraph():
|
||||||
digraph = get_queue_digraph()
|
digraph = get_queue_digraph()
|
||||||
dot_file = os.path.join(os.environ['AIL_HOME'], 'doc/ail_queues.dot')
|
dot_file = os.path.join(os.environ['AIL_HOME'], 'doc/ail_queues.dot')
|
||||||
svg_file = os.path.join(os.environ['AIL_HOME'], 'doc/ail_queues.svg')
|
svg_file = os.path.join(os.environ['AIL_HOME'], 'doc/ail_queues.svg')
|
||||||
|
svg_static = os.path.join(os.environ['AIL_HOME'], 'var/www/static/image/ail_queues.svg')
|
||||||
with open(dot_file, 'w') as f:
|
with open(dot_file, 'w') as f:
|
||||||
f.write(digraph)
|
f.write(digraph)
|
||||||
|
|
||||||
print('dot', '-Tsvg', dot_file, '-o', svg_file)
|
print('dot', '-Tsvg', dot_file, '-o', svg_file)
|
||||||
process = subprocess.run(['dot', '-Tsvg', dot_file, '-o', svg_file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
process = subprocess.run(['dot', '-Tsvg', dot_file, '-o', svg_file, '-o', svg_static], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
if process.returncode == 0:
|
if process.returncode == 0:
|
||||||
# modified_files = process.stdout
|
# modified_files = process.stdout
|
||||||
# print(process.stdout)
|
# print(process.stdout)
|
||||||
|
|
|
@ -85,6 +85,9 @@ class AbstractModule(ABC):
|
||||||
self.queue.send_message(message, queue_name)
|
self.queue.send_message(message, queue_name)
|
||||||
# add to new set_module
|
# add to new set_module
|
||||||
|
|
||||||
|
def get_available_queues(self):
|
||||||
|
return self.queue.get_out_queues()
|
||||||
|
|
||||||
def regex_search(self, regex, obj_id, content):
|
def regex_search(self, regex, obj_id, content):
|
||||||
return regex_helper.regex_search(self.r_cache_key, regex, obj_id, content, max_time=self.max_execution_time)
|
return regex_helper.regex_search(self.r_cache_key, regex, obj_id, content, max_time=self.max_execution_time)
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ def create_json_response(data, status_code):
|
||||||
def settings_page():
|
def settings_page():
|
||||||
git_metadata = git_status.get_git_metadata()
|
git_metadata = git_status.get_git_metadata()
|
||||||
ail_version = ail_updates.get_ail_version()
|
ail_version = ail_updates.get_ail_version()
|
||||||
#admin_level = current_user.is_in_role('admin')
|
admin_level = current_user.is_in_role('admin')
|
||||||
return render_template("settings_index.html", git_metadata=git_metadata,
|
return render_template("settings_index.html", git_metadata=git_metadata,
|
||||||
ail_version=ail_version)
|
ail_version=ail_version, admin_level=admin_level)
|
||||||
|
|
||||||
@settings_b.route("/settings/background_update/json", methods=['GET'])
|
@settings_b.route("/settings/background_update/json", methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -50,6 +50,12 @@ def settings_page():
|
||||||
def get_background_update_metadata_json():
|
def get_background_update_metadata_json():
|
||||||
return jsonify(ail_updates.get_update_background_metadata())
|
return jsonify(ail_updates.get_update_background_metadata())
|
||||||
|
|
||||||
|
@settings_b.route("/settings/modules", methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
@login_read_only
|
||||||
|
def settings_modules():
|
||||||
|
admin_level = current_user.is_in_role('admin')
|
||||||
|
return render_template("settings/modules.html", admin_level=admin_level)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,5 +103,17 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<h5 class="d-flex text-muted w-100" id="nav_doc">
|
||||||
|
<span>Doc</span>
|
||||||
|
</h5>
|
||||||
|
<ul class="nav flex-md-column flex-row navbar-nav justify-content-between w-100">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{url_for('settings_b.settings_modules')}}" id="modules">
|
||||||
|
<i class="fas fa-project-diagram"></i>
|
||||||
|
<span>Modules</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Server Management - AIL</title>
|
||||||
|
<link rel="icon" href="{{ url_for('static', filename='image/ail-icon.png') }}">
|
||||||
|
|
||||||
|
<!-- Core CSS -->
|
||||||
|
<link href="{{ url_for('static', filename='css/bootstrap4.min.css') }}" rel="stylesheet">
|
||||||
|
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- JS -->
|
||||||
|
<script src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/bootstrap4.min.js')}}"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
{% include 'nav_bar.html' %}
|
||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
{% include 'settings/menu_sidebar.html' %}
|
||||||
|
<div class="col-12 col-lg-10" id="core_content">
|
||||||
|
|
||||||
|
<div class="text-center my-4">
|
||||||
|
<h2><img src="{{ url_for('static', filename='image/ail-project.png')}}" alt="AIL" style="width:80px;"> Modules:</h2>
|
||||||
|
</div>
|
||||||
|
<object data="{{ url_for('static', filename='image/ail_queues.svg') }}" type="image/svg+xml" style="width:100%;"></object>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("#modules").addClass("active");
|
||||||
|
$("#nav_doc").removeClass("text-muted");
|
||||||
|
} );
|
||||||
|
|
||||||
|
function toggle_sidebar(){
|
||||||
|
if($('#nav_menu').is(':visible')){
|
||||||
|
$('#nav_menu').hide();
|
||||||
|
$('#side_menu').removeClass('border-right')
|
||||||
|
$('#side_menu').removeClass('col-lg-2')
|
||||||
|
$('#core_content').removeClass('col-lg-10')
|
||||||
|
}else{
|
||||||
|
$('#nav_menu').show();
|
||||||
|
$('#side_menu').addClass('border-right')
|
||||||
|
$('#side_menu').addClass('col-lg-2')
|
||||||
|
$('#core_content').addClass('col-lg-10')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in New Issue