scripts_info.html 1.5 KB

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