diff options
author | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-21 13:14:51 +0200 |
---|---|---|
committer | Alejandro Sirgo Rica <asirgo@soleta.eu> | 2024-06-25 13:53:04 +0200 |
commit | 0ed9ecdae9a7e4c7fbb30af30ef4310cd45f2143 (patch) | |
tree | 0abf1330b55891c18ba62c39a39977cfc0566ab3 /ogcp/templates/actions | |
parent | af8236b18948b083c408df39306fc36bc26b51b7 (diff) |
ogcp: add support to view script output
Add view at /action/script/output to visualize the result of
/shell/run for multiple clients.
Use shell/output to request the execution data of the selected clients.
Each client element has execution timestamip (UTC), client ip, cmd,
return code and stdout of the executed command.
Diffstat (limited to 'ogcp/templates/actions')
-rw-r--r-- | ogcp/templates/actions/script_output.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ogcp/templates/actions/script_output.html b/ogcp/templates/actions/script_output.html new file mode 100644 index 0000000..c7ffdcb --- /dev/null +++ b/ogcp/templates/actions/script_output.html @@ -0,0 +1,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 %} + +<h1 class="m-5"> + {{ _('Script output') }} +</h1> + +{{ 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><samp>{{ client['output'] }}</samp></p> + </div> + </div> + </div> + {% endfor %} +</div> + +{% endblock %} |