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
8 http://www.apache.org/licenses/LICENSE-2.0
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.
17 {% extends
"base.html" %}
19 {% load staticfiles %}
22 {% block head_block %}
24 <link rel=
"stylesheet" href=
"/static/node_modules/datatables.net-bs/css/dataTables.bootstrap.min.css">
26 {% block title_header_big %}
29 {% block left_sidebar %}
31 {% include 'osm/osm_project_left_sidebar.html' %}
36 {% block breadcrumb_body %}
38 <li><a href=
"{% url "vims:list
" %}">VIMS
</a></li>
41 {% block content_body %}
43 {% include 'modal/vim_details.html' %}
46 <div class=
"col-md-12">
49 <div class=
"box-header with-border">
50 <h3 class=
"box-title">Registered VIM
</h3>
51 <div class=
"box-tools">
52 <a href='{% url
"vims:create" %}'
class=
"btn btn-block btn-primary btn-sm"><i
53 class=
"fa fa-plus"></i><span> New VIM
</span></a>
56 <div class=
"box-body">
57 <table id=
"vims_table" class=
"table table-bordered table-striped">
63 <th>Operational State
</th>
79 {% block resource_block %}
81 <script src=
"/static/node_modules/datatables.net/js/jquery.dataTables.min.js"></script>
82 <script src=
"/static/node_modules/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
84 $(document).ready( function () {
85 var table = $('#vims_table').DataTable({
89 "dataSrc": function (json) {
90 return json['datacenters'];
94 console.log(
"no auth");
95 moveToLogin(window.location.pathname);
98 "error": function (hxr, error, thrown) {
107 "render": function (data, type, row) {
113 "render": function (data, type, row) {
119 "render": function (data, type, row) {
120 return row[
"vim_type"];
125 "render": function (data, type, row) {
126 return row[
"_admin"]['operationalState'];
131 "render": function (data, type, row) {
132 return row[
"_admin"]['description'] || '';
137 "render": function (data, type, row) {
138 return '
<div class=
"btn-group"><button type=
"button" class=
"btn btn-default" ' +
139 '
onclick=
"location.href=\'/vims/'+row['_id']+'\'" data-toggle=
"tooltip" data-placement=
"top" data-container=
"body" title=
"Show Info">' +
140 '
<i class=
"fa fa-info"></i>' +
142 '
<button type=
"button" class=
"btn btn-default"' +
143 '
onclick=
"javascript:deleteVim(\''+row['_id']+'\', \''+ row["name
"] +'\')" data-toggle=
"tooltip" data-placement=
"top" data-container=
"body" title=
"Delete">' +
144 '
<i class=
"far fa-trash-alt" ></i></button></div>';
152 setInterval(function () {
159 function deleteVim(vim_id, vim_name) {
160 var url =
"/vims/"+vim_id+
"/delete";
161 bootbox.confirm(
"Are you sure want to delete " + vim_name +
"?", function (result) {
163 var dialog = bootbox.dialog({
164 message: '
<div class=
"text-center"><i class=
"fa fa-spin fa-spinner"></i> Loading...
</div>',
171 contentType:
"application/json;charset=utf-8",
172 success: function (result) {
173 if (result['error'] == true) {
174 dialog.modal('hide');
175 bootbox.alert(
"An error occurred.");
178 dialog.modal('hide');
182 error: function (error) {
183 dialog.modal('hide');
184 bootbox.alert(
"An error occurred.");