<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title"> {{ actor.name }}
        <div style="float: right">
            <button type="button" class="btn btn-default btn-xs" title="Register formulas" onclick="register_formulas()">
                <span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span>
            </button>
        </div>
        </h3>
    </div>
    <div class="panel-body">
        <table class="table">
            <tbody>
                <tr>
                  <td class="mon_details_row_name"> Name </td>
                  <td>{{ actor.name }}</td>
                </tr>
                <tr>
                  <td class="mon_details_row_name"> IP address </td>
                  <td>{{ actor.ip_addr }}:{{ actor.port }}</td>
                </tr>
                <tr>
                  <td class="mon_details_row_name"> Target </td>
                  <td>{{ actor.formulas }}</td>
                </tr>
                <tr>
                    <td class="mon_details_row_name"> Status </td>
                    <td>
                        {% if actor.status|stringformat:"s" == "ONLINE" %}
                            <span class="label label-default">
                        {% elif actor.status|stringformat:"s" == "OFFLINE" %}
                            <span class="label label-danger">
                        {% elif actor.status|stringformat:"s" == "CONNECTED" %}
                            <span class="label label-success">
                        {% endif %}
                        {{ actor.status }}</span>
                    </td>
                </tr>
            </tbody>
          </table>
    </div>
</div>


<script type="application/javascript">

function register_formulas() {
    $.ajax({
        dataType: 'text',
        type:'POST',
        url: '{% url 'register_actor_formulas' actor.name %}',
        data: {
            actor_name: "{{ actor.name }}"
        },
        success: function(response){
            location.reload();
        }
    });
}
</script>
