diff options
author | Vasilii Chernov <vchernov@inr.ru> | 2016-02-22 12:21:04 +0100 |
---|---|---|
committer | Vasilii Chernov <vchernov@inr.ru> | 2016-02-22 12:21:04 +0100 |
commit | 2c2a714e0615d6aff3773fabfd3b93e8672a40a1 (patch) | |
tree | e482ce7d9c6de21dac5999fb2af2cab30208ec32 /pywrap/templates | |
parent | b16fd97ffcaf9e7bd3fd52e505adbed2ffd0c768 (diff) | |
download | pcitool-2c2a714e0615d6aff3773fabfd3b93e8672a40a1.tar.gz pcitool-2c2a714e0615d6aff3773fabfd3b93e8672a40a1.tar.bz2 pcitool-2c2a714e0615d6aff3773fabfd3b93e8672a40a1.tar.xz pcitool-2c2a714e0615d6aff3773fabfd3b93e8672a40a1.zip |
Add device html server
Diffstat (limited to 'pywrap/templates')
-rw-r--r-- | pywrap/templates/base.html | 15 | ||||
-rw-r--r-- | pywrap/templates/property_info.html | 91 | ||||
-rw-r--r-- | pywrap/templates/register_info.html | 106 | ||||
-rw-r--r-- | pywrap/templates/registers_list.html | 26 |
4 files changed, 238 insertions, 0 deletions
diff --git a/pywrap/templates/base.html b/pywrap/templates/base.html new file mode 100644 index 0000000..e62dbdf --- /dev/null +++ b/pywrap/templates/base.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>{% block title %}Device {{ device }}{% endblock %}</title> +{% block info %} + <h1>Device {{ device }} model={{ model }} control page </h1> +{% endblock %} + +{% block content %} +{% endblock %} + +<ul> + <li><a href="{{ url_for('get_registers_list') }}">Registers list</li> + <li><a href="{{ url_for('get_property_list') }}">Property info</li> + <li><a href="{{ url_for('greet') }}">Main page</li> +</ul> + diff --git a/pywrap/templates/property_info.html b/pywrap/templates/property_info.html new file mode 100644 index 0000000..912d3d5 --- /dev/null +++ b/pywrap/templates/property_info.html @@ -0,0 +1,91 @@ +{% extends "base.html" %} +{% block title %}Property list{% endblock %} +{% block info %} +<h1>List of properties in branch {{ branch }}</h1> +{% endblock %} + +{% block content %} + + <script> + function set_property() + { + var value = document.getElementById("set_val_box").value; + window.location.href = "{{ url_for('set_property') }}?prop={{ branch }}&"+ + 'val='+value; + }; + </script> + +<table border="1" style="width:100%"> + <tr> + <th>Name</th> + <th>Description</th> + </tr> + {% for property in properties %} + <tr> + {% if ('childs' in property.flags) or (properties|length != 1) %} + <td><a href="{{ url_for('get_property_list', branch = property.path) }}">"{{ property.name }}"</td> + {% if 'description' in property %} + <script> + function set_property() + { + var value = document.getElementById("set_val_box").value; + window.location.href = "{{ url_for('set_property') }}?prop={{ branch }}&"+ + 'val='+value; + }; + </script> + <td>{{ property.description }}</td> + {% else %} + <td></td> + {% endif %} + {% else %} + <td>{{ property.name }}"</td> + <td> + <table border="1" style="width:100%"> + {% if 'description' in property %} + <tr> + <th> Description </th> + <td> {{ property.description }} </td> + </tr> + {% endif %} + <tr> + <th> Current value </th> + <td> {{ value }} </td> + </tr> + {% if 'W' in property.mode %} + <tr> + <th> Set value</th> + <td> + <input type="text" name="set_val_box" id="set_val_box" value="" /> + <input type="button" value="set" onclick="set_property()"> + </td> + </tr> + {% endif %} + <tr> + <th>Mode</th> + <td> + <ul> + {% for m in property.mode %} + <li>{{ m }}</li> + {% endfor %} + </ul> + </td> + </tr> + <tr> + <th>Type</th> + <td> {{ property.type }} </td> + </tr> + <tr> + <th>Unit</th> + <td> {{ property.unit }} </td> + </tr> + <tr> + <th>Path</th> + <td> {{ property.path }} </td> + </tr> + </table> + </td> + {% endif %} + </tr> + {% endfor %} + </table> +{% endblock %} diff --git a/pywrap/templates/register_info.html b/pywrap/templates/register_info.html new file mode 100644 index 0000000..a7f11dc --- /dev/null +++ b/pywrap/templates/register_info.html @@ -0,0 +1,106 @@ +{% extends "base.html" %} +{% block title %}Register info{% endblock %} +{% block info %} +<h1>Register '{{ register.name }}' info</h1> +{% endblock %} + +{% block content %} + <script> + function write_register() + { + var value = document.getElementById("set_val_box").value; + window.location.href = "{{ url_for('write_register') }}?name={{ register.name }}&"+ + 'bank={{ register.bank }}&val='+value; + }; + </script> + + <table border="1" style="width:100%"> + {% if 'description' in register %} + <tr> + <th> Description </th> + <td> {{ register.description }} </td> + </tr> + {% endif %} + <tr> + <th> Current value </th> + <td> {{ value }} </td> + </tr> + {% if 'W' in register.mode %} + <tr> + <th> Set value</th> + <td> + <input type="text" name="set_val_box" id="set_val_box" value="" /> + <input type="button" value="set" onclick="write_register()"> + </td> + </tr> + {% endif %} + <tr> + <th>Bank</th> + <td>{{ register.bank }}</td> + </tr> + <tr> + <th>Default value</th> + <td>{{ register.defvalue }}</td> + </tr> + <tr> + <th>Mode</th> + <td> + <ul> + {% for m in register.mode %} + <li>{{ m }}</li> + {% endfor %} + </ul> + </td> + </tr> + {% if 'range' in register %} + <tr> + <th> + Range + </th> + <td> + <table> + <tr> + <th> min </th> + <td> {{ register.range.min }} </td> + </tr> + <tr> + <th> max </th> + <td> {{ register.range.max }} </td> + </tr> + </table> + </td> + </tr> + {% endif %} + {% if 'values' in register %} + {% for v in register['values'] %} + <tr> + {% if 'name' in v %} + <th> {{v.name}} </th> + {% endif %} + <td> + <table> + {% if 'description' in v %} + <tr> + <th> description </th> + <td> {{ v.description }} </td> + </tr> + {% endif %} + <tr> + <th> min </th> + <td> {{ v.min }} </td> + </tr> + <tr> + <th> max </th> + <td> {{ v.max }} </td> + </tr> + <tr> + <th> value </th> + <td> {{ v.value }} </td> + </tr> + </table> + </td> + </tr> + {% endfor %} + {% endif %} + </table> +{% endblock %} diff --git a/pywrap/templates/registers_list.html b/pywrap/templates/registers_list.html new file mode 100644 index 0000000..199475b --- /dev/null +++ b/pywrap/templates/registers_list.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% block title %}Registers list{% endblock %} +{% block info %} +<h1>List of aviable registers</h1> +{% endblock %} + +{% block content %} +<table border="1" style="width:100%"> + <tr> + <th>Name</th> + <th>Description</th> + </tr> +{% for register in registers %} + <tr> + <td><a href="{{ url_for('get_register_info', bank=register.bank, name=register.name) }}">{{ register.name }}</td> + {% if 'description' in register %} + <td>{{ register.description }}</td> + {% else %} + <td></td> + {% endif %} + </tr> +{% endfor %} +</table> +{% endblock %} + + |