|
9 | 9 | import mara_db.postgresql
|
10 | 10 | from mara_page import bootstrap, html, acl, _
|
11 | 11 | from . import views
|
12 |
| -from .. import pipelines |
| 12 | +from .. import config, pipelines |
13 | 13 |
|
14 | 14 |
|
15 | 15 | def card(node: pipelines.Node) -> str:
|
16 | 16 | """A card that shows the system stats, the time line and output for the last runs or a node"""
|
| 17 | + statistic_content = [] |
| 18 | + if config.display_system_statistics(): |
| 19 | + statistic_content.append( |
| 20 | + html.asynchronous_content(url=flask.url_for('mara_pipelines.system_stats', path=node.url_path(), run_id=None), |
| 21 | + div_id='system-stats')) |
| 22 | + |
17 | 23 | return bootstrap.card(
|
18 | 24 | id='last-runs-card',
|
19 | 25 | header_left=[
|
20 | 26 | 'Last runs ',
|
21 | 27 | _.div(style='display:inline-block;margin-left:20px;')[html.asynchronous_content(
|
22 | 28 | flask.url_for('mara_pipelines.last_runs_selector', path=node.url_path()))]],
|
23 |
| - body=[html.spinner_js_function(), |
24 |
| - html.asynchronous_content( |
25 |
| - url=flask.url_for('mara_pipelines.system_stats', path=node.url_path(), run_id=None), |
26 |
| - div_id='system-stats'), |
27 |
| - html.asynchronous_content( |
| 29 | + body=[html.spinner_js_function()] \ |
| 30 | + + statistic_content + \ |
| 31 | + [html.asynchronous_content( |
28 | 32 | url=flask.url_for('mara_pipelines.timeline_chart', path=node.url_path(), run_id=None),
|
29 | 33 | div_id='timeline-chart'),
|
30 | 34 | html.asynchronous_content(
|
@@ -123,6 +127,9 @@ def run_output(path: str, run_id: int, limit: bool):
|
123 | 127 | @views.blueprint.route('/system-stats/<int:run_id>', defaults={'path': ''})
|
124 | 128 | @acl.require_permission(views.acl_resource, do_abort=False)
|
125 | 129 | def system_stats(path: str, run_id: int):
|
| 130 | + if not config.display_system_statistics(): |
| 131 | + return '' |
| 132 | + |
126 | 133 | node, __ = pipelines.find_node(path.split('/'))
|
127 | 134 |
|
128 | 135 | run_id = run_id or _latest_run_id(node.path())
|
|
0 commit comments