Add badges to rule status
[flowspy] / templates / user_routes.html
index bc6adfb..984e513 100644 (file)
@@ -18,7 +18,7 @@ $(document).ready(function(){
         modal: true,
         autoOpen: false,
         buttons: {
-            '{% trans "Suspend" %}': function(){
+            '{% trans "Deactivate" %}': function(){
                 route = $('#route_to_delete').text();
                 route_url_id = '#del_route_' + route;
                 url = $(route_url_id).attr('href');
@@ -162,7 +162,8 @@ $(document).ready(function(){
        if (reg_exp == '') {
             reg_exp = '|'
         }
-       console.log(reg_exp.slice(0, -1))
+       
+       
     oTable.fnFilter(reg_exp.slice(0, -1), 4, true);
     
     
@@ -182,7 +183,6 @@ $(document).ready(function(){
             reg_exp = '|'
         }
         oTable.fnFilter(reg_exp.slice(0, -1), 4, regex=true);
-        console.log(reg_exp.slice(0, -1))
         return false;
     });
 
@@ -225,16 +225,17 @@ function delete_route(route){
 <div class='button_place' style="float:right">
        <button id="consolebutton" class="btn btn-inverse">
                <i class="icon-tasks icon-white" style="align:left;"></i>{% trans "Console" %}</button>
-               <a href="{% url add-route %}" id="routebutton" class="btn btn-inverse"><i class="icon-plus-sign icon-white"></i>{% trans "Add Rule" %}</a>
+               <a href="{% url add-route %}" id="routebutton" class="btn btn-primary"><i class="icon-plus-sign icon-white"></i>{% trans "Add Rule" %}</a>
 </div>
 </div>
 </div>
+<hr>
 <div class="row-fluid" style="padding-top:30px;">
 
 <div id='itoggle' class="span12" style="text-align:center;">
    <div class="btn-group" data-toggle="buttons-checkbox">
     <button type="button" class="btn btn-small" name="status_filter" value="ACTIVE" id="show_active">Active</button>
-    <button type="button" class="btn btn-small" name="status_filter" value="SUSPENDED" id="show_inactive">Suspended</button>
+    <button type="button" class="btn btn-small" name="status_filter" value="DEACTIVATED" id="show_inactive">Deactivated</button>
     <button type="button" class="btn btn-small" name="status_filter" value="ERROR" id="show_error">Error</button>
     <button type="button" class="btn btn-small" name="status_filter" value="PENDING" id="show_pending">Pending</button>
     </div>
@@ -263,43 +264,54 @@ function delete_route(route){
 
 <tr class="GradeC" >
        <td>{{ route.pk }}</td>
-       <td><span {% if route.comments %} class="commentclass" style="border-bottom:1px dotted red;" title="{{route.comments}}" {% endif %}>{{ route.name }}</span></td>
+       
+       <td {% if route.comments %}style="color: #0088CC;"{% endif %}>{% if route.comments %}<span rel="tooltip" data-placement="top" title="{{route.comments}}">{{ route.name }}</span>{% else %}{{ route.name }}{% endif %}</td>
+       
        <td>{{ route.get_match|safe|escape }}</td>
+       
        <td style="text-align: center;">{{route.get_then|safe|escape}}</td>
+       
        <td style="text-align: center; ">{% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}
-               <a href="#" rel="tooltip" 
+               {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}<span class="label">DEACTIVATED</span>{% else %}{% if route.status == 'OUTOFSYNC' %}<span class="label label-important">ERROR</span>{% else %}{{route.status}}{% endif %}{% endif %}{% else %}{% if route.status == 'ACTIVE' %}<span class="label label-success">{{route.status}}</span>{% else %}{% if route.status == 'PENDING' %}<span class="label label-info">{{route.status}}</span>{% else %}<span class="label label-important">{{route.status}}</span>{% endif %}{% endif %}{% endif %}</td>
+               
+       {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
+       
+       <td style="text-align: center;">{{ route.applier }}</td>
+       
+       <td style="text-align: center;" nowrap>
+               <span {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}{% else %}{% if route.days_to_expire %}
+               data-placement="top"
+               rel = 'tooltip'
+               style="border-bottom:1px dashed red;" 
+        title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}"
+               {% endif %}{% endif %}>{{ route.expires|date:"d M y" }}</span></td>
+               
+       <td style="text-align: center; {% if route.status == 'EXPIRED' %} color: #0088CC; {% endif %}">
+               {% if route.status == 'EXPIRED' %}
+               <span rel="tooltip"
                        {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}  
                        data-placement="top" 
                        title = "{% ifequal route.status 'INACTIVE' %}
-                                               {% trans 'Suspended by user' %}
+                                               {% trans 'Deactivated by user' %}
                                         {% else %}
                                                {% ifequal route.status 'ADMININACTIVE' %}
-                                                       {% trans 'Suspended by administrator' %}
+                                                       {% trans 'Deactivated by administrator' %}
                                                {% else %}
                                                        {% ifequal route.status 'EXPIRED' %}
-                                                               {% trans 'Suspended due to expiration' %}
+                                                               {% trans 'Deactivated due to expiration' %}
                                                        {% else %}
                                                                {% ifequal route.status 'OUTOFSYNC' %}
-                                                                       {% trans 'Syncronization error. Configuration in device deffers from rule' %}
+                                                                       {% trans 'Syncronization error. Configuration in device differs from rule' %}
                                                                {% endifequal %}
                                                        {% endifequal %}
                                                {% endifequal %}
                                         {% endifequal %}"
-                       {% endif %}>{% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}SUSPENDED{% else %}{% if route.status == 'OUTOFSYNC' %}ERROR{% else %}{{route.status}}{% endif %}{% endif %}</a>
-               {% else %}{{route.status}}{% endif %}</td>
-       {% comment %}<td style="text-align: center;">{{ route.response }}</td>{% endcomment %}
-       <td style="text-align: center;">{{ route.applier }}</td>
-       <td style="text-align: center;">
-               <span {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' or route.status == 'OUTOFSYNC'%}{% else %}{% if route.days_to_expire %}
-               class="expiresclass" 
-               style="border-bottom:2px dashed red;" 
-        title="Expires {% ifequal route.days_to_expire '0' %}today{% else%}in {{route.days_to_expire}} day{{ route.days_to_expire|pluralize }}{% endifequal %}"
-               {% endif %}{% endif %}>{{ route.expires }}</span></td>
-       <td style="text-align: center;">{% if route.status == 'EXPIRED' %}{% trans "Rule expired" %}{% else %}{% if route.status == 'ADMININACTIVE' %}{% trans "Suspended by administrator" %}{% else %}{% if route.status == 'INACTIVE' %}{% trans "Suspended by user" %}{% else %}{{ route.response }}{% if route.status == 'PENDING' %}<img src="/fodstatic/dots.gif">{% endif %}{% endif %}{% endif %}{% endif %}</td>
+                       {% endif %}>{% trans "Rule expired" %}</span>{% else %}{% if route.status == 'OUTOFSYNC' %}{% trans 'Syncronization error. Configuration in device differs from rule' %}{% else %}{% if route.status == 'ADMININACTIVE' %}{% trans "Deactivated by administrator" %}{% else %}{% if route.status == 'INACTIVE' %}{% trans "Deactivated by user" %}{% else %}{{ route.response }}{% if route.status == 'PENDING' %}<img src="/fodstatic/dots.gif">{% endif %}{% endif %}{% endif %}{% endif %}{% endif %}</td>
+                       
        <td style="text-align: center; width:180px;">
                {% ifequal route.status 'ACTIVE' %}
                <a href="{% url edit-route route.name %}" class="edit_button btn btn-small" id="edit_button_{{route.pk}}">{% trans "Edit" %}</a> 
-               <button class="del_button btn btn-danger btn-small" id="{{route.name}}" onclick="javascript:delete_route(this.id)">{% trans "Suspend" %}</button>
+               <button class="del_button btn btn-small" id="{{route.name}}" onclick="javascript:delete_route(this.id)">{% trans "Deactivate" %}</button>
                <a href="{% url delete-route route.name %}" style="display:none" id="del_route_{{route.name}}" class="btn btn btn-danger btn-small"></a>
                {% else %}
                {% if route.status == 'EXPIRED' or route.status == 'ADMININACTIVE' or route.status == 'INACTIVE' %}
@@ -322,9 +334,9 @@ function delete_route(route){
 {% endfor %}
 </tbody>
 </table>
-<div id="dialog" title="{% trans "Suspend Rule" %}">
-               <p>{% blocktrans %}You are about to suspend rule{% endblocktrans %} <strong><span id="route_to_delete"></span></strong></p>
-               <p>{% blocktrans %}Suspending the rule will automatically remove the configuration from the network and mark this rule as inactive.{% endblocktrans %}</p>
+<div id="dialog" title="{% trans "Deactivate Rule" %}">
+               <p>{% blocktrans %}You are about to deactivate rule{% endblocktrans %} <strong><span id="route_to_delete"></span></strong></p>
+               <p>{% blocktrans %}Deactivating the rule will automatically remove the configuration from the network and mark this rule as inactive.{% endblocktrans %}</p>
                <p>{% blocktrans %}Are you sure you want to proceed?{% endblocktrans %}</p>
 </div>
 <div id="console" title="{% trans "Console" %}">