diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-03-04 19:30:43 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-03-04 19:30:43 +0100 |
commit | c8b64cf87a3ff10abac92835c07b1dd76319f185 (patch) | |
tree | 0a86fd68612ab35cccec3567015c60633cb526f8 /pyserver/templates | |
parent | c38706b3c8bbaec638cc49745fd71dfb14df37e5 (diff) | |
parent | 327b71b05b60a03e56fad618b51fbccd06c3776d (diff) | |
download | pcitool-c8b64cf87a3ff10abac92835c07b1dd76319f185.tar.gz pcitool-c8b64cf87a3ff10abac92835c07b1dd76319f185.tar.bz2 pcitool-c8b64cf87a3ff10abac92835c07b1dd76319f185.tar.xz pcitool-c8b64cf87a3ff10abac92835c07b1dd76319f185.zip |
Integrate last part of Python code from Vasiliy Chernov
Diffstat (limited to 'pyserver/templates')
-rw-r--r-- | pyserver/templates/base.html | 62 | ||||
-rw-r--r-- | pyserver/templates/scripts_info.html | 49 |
2 files changed, 92 insertions, 19 deletions
diff --git a/pyserver/templates/base.html b/pyserver/templates/base.html index a2df1e9..d83309b 100644 --- a/pyserver/templates/base.html +++ b/pyserver/templates/base.html @@ -6,8 +6,12 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='codebase/dhtmlx.css') }}"/> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='base.css') }}"/> - <script type=text/javascript src="{{ url_for('static', filename='jquery-2.2.1.js') }}"></script> - <script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script> + <script type="text/javascript" src="{{ url_for('static', filename='FileSaver.js') }}"></script> + <script type="text/javascript" src="{{ url_for('static', filename='jquery-2.2.1.js') }}"></script> + <script type="text/javascript" src="{{ url_for('static', filename='jquery-ui.js') }}"></script> + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='jquery-ui.css') }}"/> + <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='theme.css') }}"/> + <script src="{{ url_for('static', filename='codebase/dhtmlx.js') }}"></script> <script src="{{ url_for('static', filename='check_err.js') }}"></script> <script> var propsTree @@ -75,8 +79,10 @@ var pathToGetRegister = "{{ url_for('get_register_info') }}" var completePath = pathToGetRegister + '?bank=' + bank + '&name=' + name - - $("#reg_info_place").load(completePath) + + $("#reg_info_place").load(completePath, 0, function() { + $('.infoTable').DataTable() + alert("aaa")}) } function setRegisterField(id, bank, name) { @@ -151,6 +157,13 @@ createRegistersList() } </script> + <script> + $(function() { + $( "#tabs" ).tabs(); + + $("#script_info_place").load("{{ url_for('get_scripts_list') }}") + }); + </script> </head> <body onload="doOnLoad()"> {% block info %} @@ -159,36 +172,47 @@ </div> {% endblock %} - <div class="tabs"> - <input type="radio" name="current" checked="checked" id="props_id"/> - <label for="props_id">Properties</label> - <input type="radio" name="current" id="labels_id"/> - <label for="labels_id">Registers</label> - <div> + <div id="tabs" style="overflow:auto"> + <ul> + <li><a href="#fragment-1">Properties</a></li> + <li><a href="#fragment-2">Registers</a></li> + <li><a href="#fragment-3">Scripts</a></li> + </ul> + <div id="fragment-1"> <table> <tr> <td valign="top"> <div id="treeboxbox_tree" class = "tree"></div> </td> - <td valign="top" id="prop_info_place" /> + <td valign="top" id="prop_info_place"/> </tr> - </table> + </table> + </div> + <div id="fragment-2"> + <div> + <table> + <tr> + <td valign="top"> + <div id="treeboxbox_tree2" class="tree"></div> + </td> + <td valign="top" id="reg_info_place"/> + </tr> + </table> + </div> </div> - <div> + <div id="fragment-3"> <table> <tr> - <td valign="top"> - <div id="treeboxbox_tree2" class="tree"></div> - </td> - <td valign="top" id="reg_info_place" /> + <td valign="top" id="script_info_place"> </tr> </table> </div> </div> + {% block content %} {% endblock %} - <div class="block1" > + <div class="block1" > <a href="{{ url_for('process_json_command', command='help') }}">Json API usage</a> - </div> + </div> </body> </html> diff --git a/pyserver/templates/scripts_info.html b/pyserver/templates/scripts_info.html new file mode 100644 index 0000000..4708638 --- /dev/null +++ b/pyserver/templates/scripts_info.html @@ -0,0 +1,49 @@ +{% block content %} + +<script> + function runScript(name){ + var pathToGetProperty = "{{ url_for('process_json_command', command = 'run_script') }}" + var completePath = pathToGetProperty + '?script_name=' + name + + '&value=' + $("#input_" + name).val() + + $.get(completePath, function(data, status){ + var stringData = "" + if(typeof(data) === "object") { + stringData = JSON.stringify(data) + } + else + stringData = String(data) + + var blob = new Blob([stringData], {type: "text/plain;charset=utf-8"}); + saveAs(blob, "output_" + name); + }); + } +</script> + +<input type="file" id="file-input" /> + +<table class="infoTable"> + <tr class="infoTable"> + <td class="infoTable">Name</td> + <td class="infoTable">Description</td> + </tr> + {% for script in scripts %} + <tr class="infoTable"> + <td class="infoTable">{{ script.name }}</td> + <td class="infoTable"> + {% if 'description' in script %} + {{ script.description }} + {% endif %} + </td> + <td class="infoTable" style="overflow: visible"> + {% if 'valid' in script and script['valid'] %} + <input type='text' id="input_{{ script.name }}"/> + <input type="button" value="run" + onclick="runScript('{{ script.name }}')"> + {% endif %} + </td> + </tr> + {% endfor %} +</table> +{% endblock %} + |