Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add endpoints to render certificate scopes #756

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added more links, made headings more consistent, markdown more embedd…
…able

Signed-off-by: Matthias Büchse <matthias.buechse@cloudandheat.com>
  • Loading branch information
mbuechse committed Sep 20, 2024
commit 2a112db7eaaf4bddff2cfdabeb3ed4113fbb8b77
3 changes: 2 additions & 1 deletion compliance-monitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,10 @@ def render_view(view, view_type, base_url='/', title=None, **kwargs):
stage1 = stage2 = view[view_type]
if view_type is ViewType.page:
stage1 = view[ViewType.fragment]
def scope_url(uuid): return f"{base_url}page/scope/{uuid}" # noqa: E306,E704
def detail_url(subject, scope): return f"{base_url}page/detail/{subject}/{scope}" # noqa: E306,E704
def report_url(report): return f"{base_url}reports/{report}" # noqa: E306,E704
fragment = templates_map[stage1].render(detail_url=detail_url, report_url=report_url, **kwargs)
fragment = templates_map[stage1].render(detail_url=detail_url, report_url=report_url, scope_url=scope_url, **kwargs)
if view_type != ViewType.markdown and stage1.endswith('.md'):
fragment = markdown(fragment, extensions=['extra'])
if stage1 != stage2:
Expand Down
11 changes: 7 additions & 4 deletions compliance-monitor/templates/details.md.j2
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{% for subject, subject_result in results.items() -%}
# {{ subject }}
{# # {{ subject }} -#}
{% for scopeuuid, scope_result in subject_result.items() -%}
{% if not scope_result.relevant -%}
## {{ scope_result.name }}

- [spec overview]({{ scope_url(scopeuuid) }})

{% if not scope_result.relevant -%}

No recent test results available.

{% endif -%}
{% for version in scope_result.relevant -%}
{%- set version_result = scope_result.versions[version] -%}
## {{ scope_result.name }} {{ version }} ({{ version_result.validity }}): {{ version_result.result | verdict }}
### {{ version }} ({{ version_result.validity }}): {{ version_result.result | verdict }}
{% for target, target_result in version_result.targets.items() -%}
### Target {{ target }}: {{ target_result.result | verdict }}
#### Target {{ target }}: {{ target_result.result | verdict }}

| testcase id | result | description |
|---|---|---|
Expand Down
4 changes: 3 additions & 1 deletion compliance-monitor/templates/overview.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
<meta charset="utf-8">
<title>{{ title or 'SCS compliance overview' }}</title>
</head>
<body>{{fragment}}</body>
<body>
{% if title %}<h1>{{title}}</h1>
{% endif %}{{fragment}}</body>
</html>
2 changes: 1 addition & 1 deletion compliance-monitor/templates/overview.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ we could of course iterate over results etc., but hardcode the table (except the
for the time being to have the highest degree of control
-#}
{% set iaas = '50393e6f-2ae1-4c5c-a62c-3b75f2abef3f' -%}
| Name | Description | Operator | SCS-compatible IaaS | HealthMon |
| Name | Description | Operator | [SCS-compatible IaaS]({{ scope_url(iaas) }}) | HealthMon |
|-------|--------------|-----------|----------------------|:----------:|
| [gx-scs](https://github.com/SovereignCloudStack/docs/blob/main/community/cloud-resources/plusserver-gx-scs.md) | Dev environment provided for SCS & GAIA-X context | plusserver GmbH |
{#- #} [{{ results | passed('gx-scs', iaas) or '–' }}]({{ detail_url('gx-scs', iaas) }}) {# -#}
Expand Down
2 changes: 0 additions & 2 deletions compliance-monitor/templates/scope.md.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# {{spec.name}}

| Scope versions -> | {% for name in relevant %} {{name}} |{% endfor %}
| :----------------- | {% for name in relevant %} :-- |{% endfor %}
| State | {% for name in relevant %} {{spec.versions[name].validity | capitalize}} |{% endfor %}
Expand Down