/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pyserver/templates/scripts_info.html

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-04 18:30:43 UTC
  • mfrom: (346.1.39 pcitool)
  • Revision ID: csa@suren.me-20160304183043-mjf6xvyermjh5olg
Integrate last part of Python code from Vasiliy Chernov

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{% block content %}
 
2
 
 
3
<script>
 
4
   function runScript(name){
 
5
      var pathToGetProperty = "{{ url_for('process_json_command', command = 'run_script') }}"
 
6
      var completePath = pathToGetProperty + '?script_name=' + name +
 
7
                        '&value=' + $("#input_" + name).val()
 
8
      
 
9
      $.get(completePath, function(data, status){
 
10
         var stringData = ""
 
11
         if(typeof(data) === "object") {
 
12
            stringData = JSON.stringify(data)
 
13
         }
 
14
         else
 
15
            stringData = String(data)
 
16
         
 
17
         var blob = new Blob([stringData], {type: "text/plain;charset=utf-8"});
 
18
         saveAs(blob, "output_" + name);
 
19
      });
 
20
   }
 
21
</script>
 
22
 
 
23
<input type="file" id="file-input" />
 
24
 
 
25
<table class="infoTable">
 
26
   <tr class="infoTable">
 
27
      <td class="infoTable">Name</td>
 
28
      <td class="infoTable">Description</td>
 
29
   </tr>
 
30
   {% for script in scripts %}
 
31
      <tr class="infoTable">
 
32
         <td class="infoTable">{{ script.name }}</td>
 
33
         <td class="infoTable">
 
34
         {% if 'description' in script %}
 
35
             {{ script.description }}
 
36
         {% endif %}
 
37
         </td>
 
38
         <td class="infoTable" style="overflow: visible">
 
39
         {% if 'valid' in script and script['valid'] %}
 
40
                                    <input type='text' id="input_{{ script.name }}"/>
 
41
                  <input type="button" value="run"
 
42
                         onclick="runScript('{{ script.name }}')">
 
43
         {% endif %}
 
44
         </td>
 
45
      </tr>
 
46
   {% endfor %}
 
47
</table>
 
48
{% endblock %}
 
49