{% extends "layout.html" %}
{% block title %}Instance inspection{% endblock %}
{% block head %}
  {{ super() }}
  <link href="{{ url_for('static', filename='css/jqueryFileTree.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <script src="{{ url_for('static', filename='jquery/jqueryFileTree.js') }}" type="text/javascript" charset="utf-8"></script>
  {%if file_path != "" %}
  <script type="text/javascript" charset="utf-8">
    $(document).ready( function() {
      $('#fileTree').fileTree({ root: "{{file_path}}", script: $SCRIPT_ROOT + "/readFolder", folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: false }, function(file) { 
			alert(file);
		});
    });
  </script>
  {%endif%}
{% endblock %}
{% block body %}
<h2>Instance inspection</h2><br/>
<h2>Supervisor:</h2>
{% if supervisor != [] %}
<table cellpadding="0" cellspacing="0" width="100%">
  <tr>
	  <th>Partition and Process name</th><th>Status</th><th>Process PID </th><th> UpTime</th><th></th>
  </tr>
{% for item in supervisor %}
  <tr>
	  <td><b><a href="{{ url_for('tailProcess', process=item[0]) }}">{{ item[0]}}</a></b></td>
	  <td align="center"><a href="{{ url_for('startStopProccess', process=item[0], action=item[1]) }}">{{ item[1]}}</a></td>
	  <td align="center">{{ item[3]}}</td><td>{{ item[5]}}</td>
	  <td align="center"><a href="{{ url_for('startStopProccess', process=item[0], action='RESTART') }}">Restart</a></td>
  </tr>
{% endfor %}
</table>
{% else %}
<h3>Please run the software instance before displaying process</h3>
{%endif%}
<br/>
<h2>SLAP:</h2>
{% for item in slap_status %}
<b>{{ item[0 ]}}</b><br>
<textarea cols=103 rows=5 readonly>{{ item[1] }}</textarea><br>
{% endfor %}
<h2>File content:</h2>
<div id="fileTree" class="file_tree"></div>
{% endblock %}
