fix missing license headers
[osm/LW-UI.git] / sdnctrlhandler / template / sdn_list.html
1 <!--
2 Copyright 2019 EveryUP srl
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 -->
16
17 {% extends "base.html" %}
18 {% load get %}
19 {% load staticfiles %}
20
21
22 {% block head_block %}
23 {{ block.super }}
24 <link rel="stylesheet" href="/static/node_modules/datatables.net-bs/css/dataTables.bootstrap.min.css">
25
26 {% endblock %}
27 {% block title_header_big %}
28 {{ block.super }}
29 {% endblock %}
30 {% block left_sidebar %}
31 {% include 'osm/osm_project_left_sidebar.html' %}
32 {% endblock %}
33
34
35 {% block breadcrumb_body %}
36 {{ block.super }}
37 <li><a href="{% url 'sdns:list' %}">SDN Controllers</a></li>
38 {% endblock %}
39
40 {% block content_body %}
41 {{ block.super }}
42 {% include 'modal/sdn_details.html' %}
43 {% csrf_token %}
44 <div class="row">
45 <div class="col-md-12">
46
47 <div class="box">
48 <div class="box-header with-border">
49 <h3 class="box-title">Registered SDN Controllers</h3>
50 <div class="box-tools">
51 <a href='{% url "sdns:create" %}' class="btn btn-block btn-primary btn-sm"><i
52 class="fa fa-plus"></i><span> New SDN Controller</span></a>
53 </div>
54 </div>
55 <div class="box-body">
56 <table id="sdns_table" class="table table-bordered table-striped">
57 <thead>
58 <tr>
59 <th>Name</th>
60 <th>Identifier</th>
61 <th>Type</th>
62 <th>Operational State</th>
63 <th>IP</th>
64 <th>Port</th>
65 <th>Actions</th>
66
67 </tr>
68 </thead>
69 <tbody>
70
71 </tbody>
72 </table>
73 </div>
74 </div>
75 </div>
76
77 </div>
78 {% endblock %}
79
80 {% block resource_block %}
81 {{ block.super }}
82 <!-- moment JS -->
83 <script src="/static/node_modules/moment/moment.js"></script>
84 <script src="/static/node_modules/datatables.net/js/jquery.dataTables.min.js"></script>
85 <script src="/static/node_modules/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
86 <script src="/static/src/sdnctrlhandler/sdn_list.js"></script>
87
88 <script>
89 $(document).ready( function () {
90 var table = $('#sdns_table').DataTable({
91 responsive: true,
92 "ajax": {
93 "url": "/sdn/list",
94 "dataSrc": function (json) {
95 console.log(json)
96 return json['sdns'];
97 },
98 statusCode: {
99 401: function () {
100 console.log("no auth");
101 moveToLogin(window.location.pathname);
102 }
103 },
104 "error": function (hxr, error, thrown) {
105 console.log(hxr)
106 console.log(thrown)
107 console.log(error);
108 }
109
110 },
111 "columns": [
112 {
113 "render": function (data, type, row) {
114 return row["name"];
115 },
116 "targets": 0
117 },
118 {
119 "render": function (data, type, row) {
120 return row['_id'];
121 },
122 "targets": 1
123 },
124 {
125 "render": function (data, type, row) {
126 return row["type"];
127 },
128 "targets": 2
129 },
130 {
131 "render": function (data, type, row) {
132 return row["_admin"]["operationalState"];
133 },
134 "targets": 3
135 },
136 {
137 "render": function (data, type, row) {
138 return row["ip"];
139 },
140 "targets": 4
141 },
142 {
143 "render": function (data, type, row) {
144 return row["port"];
145 },
146 "targets": 5
147 },
148 {
149 "render": function (data, type, row) {
150 return '<div class="btn-group">' +
151 '<button type="button" class="btn btn-default" ' +
152 'onclick="javascript:showSDN( \''+row['_id'] + '\', \''+row['name'] +'\')" data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i class="fa fa-info"></i>' +
153 '</button>' +
154 '<button type="button" class="btn btn-default"' +
155 'onclick="javascript:deleteSDN(\''+row['_id']+'\', \''+ row["name"] +'\')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete">' +
156 '<i class="far fa-trash-alt" ></i></button></div>';
157 },
158 "targets": 6,
159 "orderable": false
160 }
161 ]
162 });
163
164 setInterval(function () {
165 table.ajax.reload();
166 }, 10000);
167 });
168 </script>
169 {% endblock %}
170
171 {% block footer %}
172 {% include "footer.html" %}
173 {% endblock %}