several changes on auth flow
[osm/LW-UI.git] / static / src / sdnctrlhandler / sdn_list.js
1 function deleteSDN(sdn_uuid) {
2 bootbox.confirm("Are you sure want to delete?", function (result) {
3 if (result) {
4 location.href = '/projects/sdn/' + sdn_uuid + '/delete'
5 }
6 })
7 }
8
9 function showSDN(sdn_uuid) {
10 var dialog = bootbox.dialog({
11 message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Loading...</div>',
12 closeButton: true
13 });
14
15 $.ajax({
16 url: '/projects/sdn/' + sdn_uuid ,
17 //url: '/sdn/' + sdn_uuid,
18 type: 'GET',
19 dataType: "json",
20 contentType: "application/json;charset=utf-8",
21 success: function (result) {
22 //$('#modal_show_vim_body').empty();
23 var sdn = result.sdn;
24 if (sdn) {
25 $('#modal_show_sdn_body').find('span').text('-');
26 for (var k in sdn) {
27 $('#' + k).text(sdn[k])
28 }
29 if (sdn['_admin']) {
30 for (var i in sdn['_admin']) {
31 if (i === 'modified' || i === 'created') {
32 //$('#' + i).text(new Date(sdn['_admin'][i]* 1000).toUTCString());
33 $('#' + i).text(moment(sdn['_admin'][i] * 1000).format('DD/MM/YY hh:mm:ss'));
34 }
35 else if (i === 'deployed') {
36 $('#' + i).text(JSON.stringify(sdn['_admin'][i]))
37 }
38 else
39 $('#' + i).text(sdn['_admin'][i])
40 }
41 }
42 dialog.modal('hide');
43 $('#modal_show_sdn').modal('show');
44 }
45 else {
46 dialog.modal('hide');
47 bootbox.alert("An error occurred while retrieving the SDN controller info.");
48 }
49
50 },
51 error: function (result) {
52 dialog.modal('hide');
53 bootbox.alert("An error occurred while retrieving the SDN controller info.");
54 }
55 });
56
57 }