summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/actions/script_output.html
blob: efbccf40902ed7ddeadcfd5a8cd6f9981bff6ab3 (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
{% extends 'commands.html' %}
{% import "bootstrap/wtf.html" as wtf %}
{% import "macros.html" as macros %}

{% set sidebar_state = 'disabled' %}
{% set btn_back = true %}

{% block nav_client %} active {% endblock %}
{% block nav_script_output %} active {% endblock %}
{% block content %}

<h2 class="mx-5 subhead-heading">
    {{ _('Script output') }}
</h2>

{{ macros.cmd_selected_clients(selected_clients) }}

<br>

<style>
.card-header {
  padding: 0;
  margin-bottom: 0;
  border: 0;
}

.btn-link {
  padding: 0;
  border: 0;
}

.card-header button {
  width: 100%;
  text-align: center;
}

.bg-failed {
    background-color: rgba(255,0,0,0.2);
}

.bg-ok {
    background-color: rgba(0,255,0,0.2);
}
</style>

<div class="accordion" id="shellAccordion">
    {% for client in client_data %}
    <div class="card">
        <div class="card-header" id="heading_1">
            <h2 class="mb-0">
                <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapse_{{ loop.index }}" aria-expanded="true" aria-controls="collapse_{{ loop.index }}">
                    <table class="table table-bordered mb-0">
                        <thead class="thead">
                            <tr>
                                <th class="col-2">{{ client['tstamp'] }}</th>
                                <th class="col-2"><b>{{ client['addr'] }}</b></th>
                                <th>{{ client['cmd'] }}</th>
                                <th class="col-2 {% if client['retcode'] == 0 %}bg-ok{% else %}bg-failed{% endif %}">return: {{ client['retcode'] }}</th>
                            </tr>
                        </thead>
                    </table>
                </button>
            </h2>
        </div>
        <div id="collapse_{{ loop.index }}" class="collapse" aria-labelledby="heading_{{ loop.index }}">
            <div class="card-body">
                <p><pre>{{ client['output'] }}</pre></p>
            </div>
        </div>
    </div>
    {% endfor %}
</div>

{% endblock %}