{%- import "macros/svgs.jinja" as svg -%} {%- set jupyter_name = "Jupyter4NFDI" -%} {#- Get all systems configured for this hub, sort them by weight and assign status ids -#} {#- Jupyter should always be first -#} {%- set incident_services = custom_config.get("incidentCheck", {}).get("services", {}) -%} {%- set systems_default_order = [["JUPYTER", incident_services.get("JUPYTER", 40)]] -%} {%- for system in custom_config.get("systems", {}) | sort(attribute='weight') -%} {%- set system = system.upper().replace("-", '') -%} {%- set status_id = incident_services.get(system, 0) -%} {%- do systems_default_order.append([system, status_id]) -%} {%- endfor -%} {%- macro random_int(len) -%} {%- for _ in range(len) -%} {{ range(10) | random }} {%- endfor -%} {%- endmacro -%} {%- macro number_of_users(system) -%} {%- if system == "jupyter" -%} {%- set system_svg = svg.users_svg -%} {%- set url_suffix = "" -%} {%- elif system == "jsccloud"%} {%- set system_svg = svg.servers_svg -%} {%- set url_suffix = "var-system=JSC-Cloud" -%} {%- else -%} {%- set system_svg = svg.servers_svg -%} {%- set url_suffix = "var-system=" + system.upper() -%} {%- endif -%} 0 {{ system_svg | safe }} {%- endmacro -%} {%- macro ampel(system, system_id) -%} {%- set system_lower = system.lower() %}
{%- if system == "JUPYTER" -%} {{ jupyter_name }} {%- elif system == "JSCCLOUD" -%} JSC-Cloud {%- else -%} {{ system }} {%- endif -%} {{ number_of_users(system_lower) }}
{%- endmacro -%} {%- macro create_carousel_systems(start_index, length) -%} {%- set end_index = start_index + length -%} {%- for system_config in systems_default_order %} {%- if loop.index0 >= start_index and loop.index0 < end_index %} {{ ampel(system_config[0], system_config[1]) }} {%- endif -%} {%- endfor -%} {%- endmacro -%} {%- block footer -%} {%- endblock -%} {%- block script -%} {%- endblock -%}