diff options
author | Neil Williams <neil.williams@linaro.org> | 2018-06-27 08:58:46 +0100 |
---|---|---|
committer | Senthil Kumaran Shanmugasundaram <senthil.kumaran@linaro.org> | 2018-06-27 09:50:35 +0000 |
commit | b667d371ce59d5f94b2ce48fc9a17b998b51f8d5 (patch) | |
tree | 734cf669c74dfb5b696fb6e3d9e528b76cf5a8d8 /lava_scheduler_app/templates/lava_scheduler_app | |
parent | e005377e32af559e8d81f4263d13f3a4d030ae49 (diff) |
LAVA-1367 - drop pretty printing of device dictionary
Second guessing the jinja2 templating causes artifacts when a
device dictionary reuses a variable to avoid duplication.
Simplify the output to provide the raw Jinja2 and the rendered
YAML.
Change-Id: I926150a0d8afdac456021d8009c3e5d9bac7afa1
Diffstat (limited to 'lava_scheduler_app/templates/lava_scheduler_app')
-rw-r--r-- | lava_scheduler_app/templates/lava_scheduler_app/devicedictionary.html | 102 |
1 files changed, 49 insertions, 53 deletions
diff --git a/lava_scheduler_app/templates/lava_scheduler_app/devicedictionary.html b/lava_scheduler_app/templates/lava_scheduler_app/devicedictionary.html index 5cf243fd6..eee1f7da0 100644 --- a/lava_scheduler_app/templates/lava_scheduler_app/devicedictionary.html +++ b/lava_scheduler_app/templates/lava_scheduler_app/devicedictionary.html @@ -1,5 +1,18 @@ {% extends "layouts/content.html" %} {% load utils %} +{% block styles %} +<style> +.noselect { + -webkit-touch-callout: none; /* iOS Safari */ + -webkit-user-select: none; /* Chrome/Safari/Opera */ + -khtml-user-select: none; /* Konqueror */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* Internet Explorer/Edge */ + user-select: none; /* Non-prefixed version, currently + not supported by any browser */ +} +</style> +{% endblock %} {% block content %} {% if device.device_type.owners_only %} @@ -11,7 +24,6 @@ {% endif %} <h2>Device Dictionary for {{ device.hostname }} - <a class="btn btn-xs btn-info" href="{% url 'lava.scheduler.device.dictionary.plain' device.hostname %}" title="Download full device configuration (YAML). @@ -45,62 +57,46 @@ i.e., its equivalent to get-pipeline-device-config in lava-tool."> </div> </div> +<ul class="nav nav-tabs"> + <li class="active"><a href="#jinja" data-toggle="tab">Raw Jinja</a></li> + <li><a href="#yaml" data-toggle="tab">Rendered YAML</a></li> +</ul> +<div class="tab-content"> + <div class="tab-pane active" id="jinja"> +<h4 class="modal-header">Jinja2</h4> -<div class="container-fluid"> -{% if dictionary %} -<div class="row"> - <h4 class="modal-header">Commands</h4> - <dl class="dl-horizontal"> - {% for key, value in dictionary.items %} - <dt>{{ key }}</dt> -{% if value|is_list_type %} - <dd> -{% for line in value %} - <pre>{{ line }}</pre> +{% with dictionary|split_definition as definition_data %} +{% for line in definition_data %} + <div class="row"> + <div class="col-md-1 noselect" id="defline{{ forloop.counter }}"> + <a href="#defline{{ forloop.counter }}">{{ forloop.counter }}</a> + </div> + <div class="col-md-8"> + <span style="font-family: monospace; white-space: pre;">{{ line.rstrip|replace_python_unicode }}</span> + </div> + </div> {% endfor %} - </dd> -{% else %} - <dd><pre>{{ value }}</pre></dd> -{% endif %} - {% endfor %} - </dl> -</div> -{% endif %} +{% endwith %} -{% if connections %} -<div class="row"> - <h4 class="modal-header">Connections</h4> - <dl class="dl-horizontal"> - {% for key, value in connections.items %} - <dt>{{ key }}</dt> - <dd><pre>{{ value }}</pre></dd> - {% endfor %} - </dl> -</div> -{% endif %} + </div> + <div class="tab-pane" id="yaml"> +<h4 class="modal-header">YAML</h4> -{% if extra %} -<div class="row"> - <h4 class="modal-header">Other parameters</h4> - <dl class="dl-horizontal"> - {% for key, value in extra.items %} - <dt>{{ key }}</dt> - <dd><pre>{{ value }}</pre></dd> - {% endfor %} - </dl> -</div> -{% endif %} +{% with device_yaml|split_definition as definition_data %} +{% for line in definition_data %} + <div class="row"> + <div class="col-md-1 noselect" id="defline{{ forloop.counter }}"> + <a href="#defline{{ forloop.counter }}">{{ forloop.counter }}</a> + </div> + <div class="col-md-8"> + <span style="font-family: monospace; white-space: pre;">{{ line.rstrip|replace_python_unicode }}</span> + </div> + </div> +{% endfor %} +{% endwith %} -{% if vland %} -<div class="row"> - <h4 class="modal-header">Networking parameters</h4> - <dl class="dl-horizontal"> - {% for key, value in vland.items %} - <dt>{{ key }}</dt> - <dd><pre>{{ value }}</pre></dd> - {% endfor %} - </dl> -</div> -{% endif %} + </div> </div> + + {% endblock %} |