{% 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='js/jquery/jqueryFileTree.js') }}" type="text/javascript" charset="utf-8"></script>
  <link href="{{ url_for('static', filename='css/jqueryTabs.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <script src="{{ url_for('static', filename='js/jquery/jqueryTabs.js') }}" type="text/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/ace/ace-uncompressed.js') }}" type="text/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/ace/theme-crimson_editor.js') }}" type="text/javascript" charset="utf-8"></script>
  <link href="{{ url_for('static', filename='css/colorbox.css', _external=False) }}" rel="stylesheet" type="text/css" media="screen" />
  <script src="{{ url_for('static', filename='js/jquery/jquery.colorbox-min.js') }}" type="text/javascript" charset="utf-8"></script>
  <script src="{{ url_for('static', filename='js/scripts/inspectInstance.js') }}" type="text/javascript" charset="utf-8"></script>
{% endblock %}
{% block body %}
<input type='hidden' name='root' id='root' value='{%if file_path != "" %}{{file_path}}{%endif%}' />
<h2>Instance inspection</h2><br/>
<div id="tabContaier">
    <ul>
      <li><a class="active" href="#tab1">Slapgrid Supervisor</a></li>
      <li><a href="#tab2">SLAP response</a></li>
      <li><a href="#tab3">Partitions Content</a></li>
    </ul><!-- //Tab buttons -->
    <div class="tabDetails">
    	<div id="tab1" class="tabContents">
	    <p>This tab show all process generated by slapgrid for your application. You can click on the process name to display log.</p>
	    {% 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 %}
	    <h2>No process to display, please run your instance</h2>
	    {%endif%}
        </div><!-- end tab1 -->
    	<div id="tab2" class="tabContents">
	    <p>Uses parameters below to run your application</p>
	    {% for item in slap_status %}
	    <h2>{{ item[0 ]}}</h2>
	    <textarea rows=5 readonly>{{ item[1] }}</textarea><br>
	    {% endfor %}
        </div><!-- end tab2 -->
    	<div id="tab3" class="tabContents">
	    <div id="fileTree" class="file_tree_tabs"></div>
        </div><!-- end tab3 -->
    </div>
</div>
<!-- This contains the hidden content for inline calls -->
<a class='inline' style='display:none' href="#inline_content">Inline HTML</a>
<div style='display:none'>
<div id='inline_content' style='padding:10px; background:#fff;'>

</div>
</div>
{% endblock %}
