From 52af0031631c562106dfc568b3483d3a5ced05e3 Mon Sep 17 00:00:00 2001 From: Sascha Roloff Date: Tue, 20 May 2025 14:54:07 +0200 Subject: invocation server: move show_action macro into separate template file ... to allow reuse. --- .../templates/invocation.html | 90 +--------------------- doc/invocations-http-server/templates/macros.html | 89 +++++++++++++++++++++ 2 files changed, 90 insertions(+), 89 deletions(-) create mode 100644 doc/invocations-http-server/templates/macros.html (limited to 'doc/invocations-http-server/templates') diff --git a/doc/invocations-http-server/templates/invocation.html b/doc/invocations-http-server/templates/invocation.html index 2e2f0a26..c90d4272 100644 --- a/doc/invocations-http-server/templates/invocation.html +++ b/doc/invocations-http-server/templates/invocation.html @@ -3,95 +3,7 @@ Invocation {{invocation | e}} {% endblock %} -{% macro show_action(action, first = false) %} -
  • - {% if first %} -
    - {% else %} -
    - {% endif %} - - {{ action["name_prefix"] | e }} {{ action["name"] | e}} - {% if action["may_fail"] %} - {% if action["exit_code"] != 0 %} - failure: {{ action["may_fail"] }} - {% else %} - tainted ({{ action["may_fail"] }}) - {% endif %} - {% elif action["primary_output"] %} - {% if action["exit_code"] != 0 %} - failed to build: {{ action["primary_output"] | e }} - {% else %} - build: {{ action["primary_output"] | e }} - {% endif %} - {% endif %} - -
      - {% if action["stdout"] %} -
    • stdout: {{action["stdout"] | e }}
    • - {% endif %} - {% if action["stderr"] %} -
    • stderr: {{action["stderr"] | e }}
    • - {% endif %} - {% if action["cmd"] %} -
    • -
      - command - {{ action["cmd"] | e }} -
      -
    • - {% endif %} - {% if action["origins"] %} -
    • origins -
        - {% for origin in action["origins"] %} -
      • {{ origin | e }}
      • - {% endfor %} -
      -
    • - {% endif %} - {% if action["duration"] %} -
    • duration: {{ action["duration"] | e }}
    • - {% endif %} - {% if action["cached"] %} -
    • cached: {{ action["cached"] | e }}
    • - {% endif %} - {% if action["exit_code"] != 0 %} -
    • exit code: {{ action["exit_code"] }}
    • - {% endif %} - {% if action["output"] %} -
    • output -
        - {% for out in action["output"] %} - {% if action["artifacts"].get(out) %} -
      • - {{ out | e }} - [↓] -
      • - {% else %} -
      • {{ out | e }}
      • - {% endif %} - {% endfor %} -
      -
    • - {% endif %} - {% if action["output_dirs"] %} -
    • output directories -
        - {% for out in action["output_dirs"] %} - {% if action["artifacts"].get(out) %} -
      • {{ out | e }}
      • - {% else %} -
      • {{ out | e }}
      • - {% endif %} - {% endfor %} -
      -
    • - {% endif %} -
    -
    -
  • -{% endmacro %} +{% from 'macros.html' import show_action %} {% block content %}

    Invocation {{invocation | e}}

    diff --git a/doc/invocations-http-server/templates/macros.html b/doc/invocations-http-server/templates/macros.html new file mode 100644 index 00000000..898a422a --- /dev/null +++ b/doc/invocations-http-server/templates/macros.html @@ -0,0 +1,89 @@ +{% macro show_action(action, first = false) %} +
  • + {% if first %} +
    + {% else %} +
    + {% endif %} + + {{ action["name_prefix"] | e }} {{ action["name"] | e}} + {% if action["may_fail"] %} + {% if action["exit_code"] != 0 %} + failure: {{ action["may_fail"] }} + {% else %} + tainted ({{ action["may_fail"] }}) + {% endif %} + {% elif action["primary_output"] %} + {% if action["exit_code"] != 0 %} + failed to build: {{ action["primary_output"] | e }} + {% else %} + build: {{ action["primary_output"] | e }} + {% endif %} + {% endif %} + +
      + {% if action["stdout"] %} +
    • stdout: {{action["stdout"] | e }}
    • + {% endif %} + {% if action["stderr"] %} +
    • stderr: {{action["stderr"] | e }}
    • + {% endif %} + {% if action["cmd"] %} +
    • +
      + command + {{ action["cmd"] | e }} +
      +
    • + {% endif %} + {% if action["origins"] %} +
    • origins +
        + {% for origin in action["origins"] %} +
      • {{ origin | e }}
      • + {% endfor %} +
      +
    • + {% endif %} + {% if action["duration"] %} +
    • duration: {{ action["duration"] | e }}
    • + {% endif %} + {% if action["cached"] %} +
    • cached: {{ action["cached"] | e }}
    • + {% endif %} + {% if action["exit_code"] != 0 %} +
    • exit code: {{ action["exit_code"] }}
    • + {% endif %} + {% if action["output"] %} +
    • output +
        + {% for out in action["output"] %} + {% if action["artifacts"].get(out) %} +
      • + {{ out | e }} + [↓] +
      • + {% else %} +
      • {{ out | e }}
      • + {% endif %} + {% endfor %} +
      +
    • + {% endif %} + {% if action["output_dirs"] %} +
    • output directories +
        + {% for out in action["output_dirs"] %} + {% if action["artifacts"].get(out) %} +
      • {{ out | e }}
      • + {% else %} +
      • {{ out | e }}
      • + {% endif %} + {% endfor %} +
      +
    • + {% endif %} +
    +
    +
  • +{% endmacro %} -- cgit v1.2.3