aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/templates/status/container_log.html.j2
blob: 454dee7268685006a7b8ddffcfee4c9d5b23dd27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{% extends "base.html.j2" %}
{% block title %}Container {{ container.name }} from pod {{ pod_name }} logs{% endblock %}
{% block content %}
    <section class="section">
      <div class="container">
        <nav class="breadcrumb" aria-label="breadcrumbs">
          <ul>
            <li><a href="./index.html">Summary</a></li>
            <li><a href="./pod-{{ pod_name }}.html" title="{{ pod_name }}">Pod {{pod_name }}</a></li>
            <li class="is-active"><a href="#" aria-current="page">Container {{ container.name }} logs</a></li>
          </ul>
        </nav>
      </div>
    </section>
    <section class="section">
    <div class="container">
      <h1 class="title is-1">
        Results
      </h1>
      <p class="subtitle">
        By type
      </p>
      <div class="tabs is-centered">
        <ul>
          <li id="logs_toggle"><a onclick="toggleVisibility('logs')">Logs</a></li>
          {% if old_logs %}
          <li id="old_logs_toggle"><a onclick="toggleVisibility('old_logs')">Previous Logs</a></li>
          {% endif %}
          {% if log_files %}
          {% for file in log_files %}
          <li id="{{ file.split('.')[0].split('/')[-1] }}_toggle"><a onclick="toggleVisibility('{{ file.split('.')[0].split('/')[-1] }}')">{{ file }}</a></li>
          {% endfor %}
          {% endif %}
        </ul>
      </div>
    <section class="section">
      <div id="logs" class="container">
        <div class="columns is-mobile is-centered">
          <div class="column is-half">
            <a class="button is-link is-fullwidth" href="./pod-{{ pod_name }}-{{ container.name }}.log">raw version</a>
          </div>
        </div>
        <pre>
          <code>{{ logs }}</code>
        <pre>
      </div>
      {% if old_logs %}
      <div id="old_logs" class="container">
        <div class="columns is-mobile is-centered">
            <div class="column is-half">
              <a class="button is-link is-fullwidth" href="./pod-{{ pod_name }}-{{ container.name }}.old.log">raw version</a>
            </div>
        </div>
        <pre>
          <code>{{ old_logs }}</code>
        <pre>
      </div>
      {% endif %}
      {% if log_files %}
      {% for file in log_files %}
      <div id="{{ file.split('.')[0].split('/')[-1] }}" class="container">
        <div class="columns is-mobile is-centered">
          <div class="column is-half">
            <a class="button is-link is-fullwidth" href="./pod-{{ pod_name }}-{{ container.name }}-{{ file.split('.')[0].split('/')[-1] }}.log">raw version</a>
          </div>
        </div>
        <pre>
          <code>{{ log_files[file] }}</code>
        <pre>
      </div>
      {% endfor %}
      {% endif %}
    </section>
{% endblock %}

{% block more_head %}
    <script language="JavaScript">
      function toggleVisibility(id) {
        document.getElementById('logs').style.display = 'none';
        {% if old_logs %}
        document.getElementById('old_logs').style.display = 'none';
        {% endif %}
        {% if log_files %}
        {% for file in log_files %}
        document.getElementById('{{ file.split('.')[0].split('/')[-1] }}').style.display = 'none';
        {% endfor %}
        {% endif %}
        document.getElementById(id).style.display = 'inline';
        document.getElementById('logs_toggle').classList.remove("is-active");
        {% if old_logs %}
        document.getElementById('old_logs_toggle').classList.remove("is-active");
        {% endif %}
        {% if log_files %}
        {% for file in log_files %}
        document.getElementById('{{ file.split('.')[0].split('/')[-1] }}_toggle').classList.remove("is-active");
        {% endfor %}
        {% endif %}
        document.getElementById(id + '_toggle').classList.add("is-active");
      }
      document.addEventListener('readystatechange', () => {
        if (document.readyState == 'complete') toggleVisibility('logs');
      });
    </script>
{% endblock %}