SLA and Service Directory code added
[unfold.git] / sla / templates / slice-tab-sla.html
1
2 <div class="col-md-2">
3 </div>
4
5  <div class="col-md-8">
6    <div class="row" id="agreements">
7     <table class="table dataTable" id="sla_table" >
8         <thead>
9         <tr class="header">
10             <th colspan="2">Provider</th>
11             <!-- <th>Testbed</th>
12             <th>Slice_Id</th>
13             <th>Agreement</th>
14             <th>Metric</th>
15             <th>Violations</th>
16             <th>Result</th> -->
17         </tr>
18         </thead>
19         <tbody>
20         
21        <tr class="header">
22                 <td><span class="glyphicon glyphicon-chevron-down"></span></td>
23                 <td>iMinds</td>
24        </tr>
25        
26        
27         {% for a in agreements %}
28
29
30 <!-- Modal - columns selector -->
31 <div class="modal fade" id="agreementModal{{a.agreement_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
32                         
33 <style type="text/css" scoped>
34         .modal-lg {
35           width: 50%;
36         }
37 </style>
38                         
39         <div class="modal-dialog modal-lg">
40                 <div class="modal-content">
41                         <div class="modal-header">
42                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
43                                 <h4 class="modal-title" id="myModalAgreement">Agreement details</h4>
44                         </div>
45                         <div class="modal-body">
46
47                  <dt>Agreement Id</dt>
48                  <dd>{{ a.agreement_id|default:"&nbsp;" }}</dd>
49                  <dt>Provider</dt>
50                  <dd>{{ a.context.provider|default:"&nbsp;" }}</dd>
51                  <dt>Consumer</dt>
52                  <dd>{{ a.context.consumer|default:"&nbsp;" }}</dd>
53                  <dt>Service</dt>
54                  <dd>Testbed guarantees 0.99 Uptime rate for 0.99 rate of the resources during the sliver lifetime</dd>
55                  <dt>Testbed</dt>
56                  <dd>{{ a.context.testbed_formatted }}</dd>
57                  <dt>Accepted on:</dt>
58                  <dd>{{ a.context.expirationtime|default:"&nbsp;" }}</dd>
59                         </div>
60                         <div class="modal-footer">
61                                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
62                         </div>
63                 </div>
64         </div>
65 </div>
66        
67        <tr>
68                 {% if a.guaranteestatus == "VIOLATED" %}
69                 <td class="glyphicon glyphicon-remove-sign" style="color:red;"></td>
70                 {% else %}
71                 <td class="glyphicon glyphicon-ok-sign" style="color:green;"></td>
72                 {% endif %}
73                 <td>{{ a.context.template_id }}</td>
74             <td>{{ a.context.expirationtime }}</td>
75             <td>
76                 {% with a.agreement_id as key %}
77                 {% if enforcements.key == false %}
78                   Disabled
79                 {% else %}
80                   Enabled
81                 {% endif %}
82                 {% endwith %}
83             </td>
84             <!-- <td>{{slicename}}</td> -->
85             <td>
86                 <!-- <a class="agreement-detail" href="{% url "agreement_details" a.agreement_id %}" data-toggle="modal" data-target="#agreementModal">View Agreement</a> -->
87                 <!-- <a class="agreement-detail" href="#" data-agreement="{{ a.agreement_id }}">View Agreement</a> -->
88                 <a class="agreement-detail" data-toggle="modal" data-target="#agreementModal{{a.agreement_id}}">View Agreement</a>
89             </td>
90
91             {% for tname,t in a.guaranteeterms.items %}
92             <td> {{ t.servicelevelobjective.kpiname }}</td>
93             <td>
94                 {% if t.status == "VIOLATED" %}
95
96                   <!-- <a class="violation-detail" href="{% url "agreement_term_violations" a.agreement_id t.name %}" data-toggle="modal" data-target="#violationModal">View Violations</a>
97                   <a class="violation-detail" href="#"
98                                         data-agreement="{{ a.agreement_id }}" 
99                                         data-violation="{{ t.name }}">View Violations</a> -->
100                   <a class="violation-detail" href="#" data-agreement="{{ a.agreement_id }}" data-violation="{{ t.name }}">View Violations</a>
101
102                 {% endif %}
103             </td>
104             <td id="status" style="display:none;">
105                 {{ a.statusclass }}
106             </td>
107             {% endfor %}
108         </tr>
109         
110         {% empty %}
111         {% endfor %}
112         </tbody>
113
114 </table>
115 </div>
116 </div>
117 <!-- <div class="row" style="float:right;">
118     <button id="showEvaluations" type="button" class="btn btn-default"  onclick="displayDate()"><span class="glyphicon"></span>Show Evaluations</button>
119 </div> -->
120
121 <script>
122 $(document).ready(function() {
123         $('a.violation-detail').click(function () {
124                 var a = $(this).data('agreement');
125                 var v = $(this).data('violation');
126                 $("#sla").load('/sla/agreements/' + a + '/guarantees/' + v + '/violations', {'slicename': '{{ slicename }}'});
127         });
128         
129         // $('a.agreement-detail').click(function () {
130         //      var a = $(this).data('agreement');
131         //      $("#sla").load('/sla/agreements/' + a + '/detail');
132         // });
133
134         $('tr.header').click(function(){
135                 $(this).nextUntil('tr.header').toggle('fast');
136                 $('.header .glyphicon').toggleClass('glyphicon-chevron-down glyphicon-chevron-right');
137         });
138 });
139
140 </script>