diff --git a/lxconsole/templates/access-controls.html b/lxconsole/templates/access-controls.html index a55d99c..b970e1b 100644 --- a/lxconsole/templates/access-controls.html +++ b/lxconsole/templates/access-controls.html @@ -139,14 +139,6 @@ } }) - // //Populate the Server dropdown in the modal - // $.getJSON("../api/servers/list_servers", function (data) { - // data = data.data - // for (var index = 0; index < data.length; index++) { - // $('#serverInput').append(''); - // } - // }) - //Populate the Role dropdown in the modal $.getJSON("../api/roles/list_roles", function (data) { data = data.data diff --git a/lxconsole/templates/certificates.html b/lxconsole/templates/certificates.html index d318787..0bf1b25 100644 --- a/lxconsole/templates/certificates.html +++ b/lxconsole/templates/certificates.html @@ -65,33 +65,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + // Configure Datatable $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/cluster-groups.html b/lxconsole/templates/cluster-groups.html index fc18089..cd1bef3 100644 --- a/lxconsole/templates/cluster-groups.html +++ b/lxconsole/templates/cluster-groups.html @@ -65,33 +65,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + // Configure Datatable $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/cluster-members.html b/lxconsole/templates/cluster-members.html index 91ae516..6b07737 100644 --- a/lxconsole/templates/cluster-members.html +++ b/lxconsole/templates/cluster-members.html @@ -67,32 +67,9 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() // Configure Datatable $('#myDataTable').DataTable({ diff --git a/lxconsole/templates/images.html b/lxconsole/templates/images.html index cb6cbb1..1626628 100644 --- a/lxconsole/templates/images.html +++ b/lxconsole/templates/images.html @@ -65,33 +65,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + // Configure Datatable $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/instance.html b/lxconsole/templates/instance.html index 47e3364..28340e5 100644 --- a/lxconsole/templates/instance.html +++ b/lxconsole/templates/instance.html @@ -679,34 +679,10 @@ function loadPageContent(){ - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId){ - $('#serverListNav').append(''); - } - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + //Load Instance Data and Configuration loadInstanceData() diff --git a/lxconsole/templates/instances.html b/lxconsole/templates/instances.html index 795dd76..9767c04 100644 --- a/lxconsole/templates/instances.html +++ b/lxconsole/templates/instances.html @@ -96,33 +96,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + //Populate the modal Profile dropdown $.getJSON("../api/profiles/list_profiles?id="+serverId+"&project="+project, function (data) { data = data.metadata diff --git a/lxconsole/templates/main.html b/lxconsole/templates/main.html index c0018ae..093bf84 100644 --- a/lxconsole/templates/main.html +++ b/lxconsole/templates/main.html @@ -99,6 +99,39 @@ }); } + function populateServerSelectDropdown() { + //Populate the Server dropdown + $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { + data = data.data + for (var index = 0; index < data.length; index++) { + if (data[index].name == '') + optionText = data[index].addr + else + optionText = data[index].name + ' (' + data[index].addr + ')' + if (data[index].id == serverId) + $('#serverListNav').append(''); + else + $('#serverListNav').append(''); + } + }) + } + + function populateProjectSelectDropdown() { + //Populate the Project dropdown + $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { + data = data.metadata + for (var index = 0; index < data.length; index++) { + optionText = data[index].replace('/1.0/projects/',''); + if (optionText == project) + $('#projectListNav').append(''); + else + $('#projectListNav').append(''); + } + }) + } + + + function updateAccount(){ $.post("../api/users/update_user", { id: "{{ page_user_id }}", diff --git a/lxconsole/templates/navbar.html b/lxconsole/templates/navbar.html index 0c947dc..89e8366 100644 --- a/lxconsole/templates/navbar.html +++ b/lxconsole/templates/navbar.html @@ -20,7 +20,7 @@
diff --git a/lxconsole/templates/network-acl.html b/lxconsole/templates/network-acl.html index 038f3be..7711407 100644 --- a/lxconsole/templates/network-acl.html +++ b/lxconsole/templates/network-acl.html @@ -103,33 +103,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + //Get data using jquery call datatable within function, set data: data.ingress for one table and data.exgress for the other $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/network-acls.html b/lxconsole/templates/network-acls.html index 6ce0dcd..ce6f1d6 100644 --- a/lxconsole/templates/network-acls.html +++ b/lxconsole/templates/network-acls.html @@ -65,33 +65,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + // Configure Datatable $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/network-zones.html b/lxconsole/templates/network-zones.html index e2f1679..70c630e 100644 --- a/lxconsole/templates/network-zones.html +++ b/lxconsole/templates/network-zones.html @@ -65,33 +65,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + // Configure Datatable $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/network.html b/lxconsole/templates/network.html index 1ad6d4b..452c423 100644 --- a/lxconsole/templates/network.html +++ b/lxconsole/templates/network.html @@ -263,34 +263,10 @@ function loadPageContent(){ - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId){ - $('#serverListNav').append(''); - } - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + //Load Network State loadNetworkState() diff --git a/lxconsole/templates/networks.html b/lxconsole/templates/networks.html index e506685..9b5bf8a 100644 --- a/lxconsole/templates/networks.html +++ b/lxconsole/templates/networks.html @@ -65,33 +65,10 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) - + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() + // Configure Datatable $('#myDataTable').DataTable({ ajax: { diff --git a/lxconsole/templates/operations.html b/lxconsole/templates/operations.html index 753c5b8..a4868d9 100644 --- a/lxconsole/templates/operations.html +++ b/lxconsole/templates/operations.html @@ -61,32 +61,9 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() // Configure Datatable $('#myDataTable').DataTable({ diff --git a/lxconsole/templates/profiles.html b/lxconsole/templates/profiles.html index d9100be..018a519 100644 --- a/lxconsole/templates/profiles.html +++ b/lxconsole/templates/profiles.html @@ -65,32 +65,9 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() // Configure Datatable $('#myDataTable').DataTable({ diff --git a/lxconsole/templates/projects.html b/lxconsole/templates/projects.html index 423ba85..cf58dca 100644 --- a/lxconsole/templates/projects.html +++ b/lxconsole/templates/projects.html @@ -65,32 +65,9 @@ //Display the current project $("#selectedProject").text(project); - //Populate the Server dropdown - $.getJSON("../api/servers/list_servers?id="+serverId+"&project="+project, function (data) { - data = data.data - for (var index = 0; index < data.length; index++) { - if (data[index].name == '') - optionText = data[index].addr - else - optionText = data[index].name - if (data[index].id == serverId) - $('#serverListNav').append(''); - else - $('#serverListNav').append(''); - } - }) - - //Populate the Project dropdown - $.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) { - data = data.metadata - for (var index = 0; index < data.length; index++) { - optionText = data[index].replace('/1.0/projects/',''); - if (optionText == project) - $('#projectListNav').append(''); - else - $('#projectListNav').append(''); - } - }) + //Loaded from main.html template + populateServerSelectDropdown() + populateProjectSelectDropdown() // Configure Datatable $('#myDataTable').DataTable({ diff --git a/lxconsole/templates/server.html b/lxconsole/templates/server.html index d8cedcf..76b228f 100644 --- a/lxconsole/templates/server.html +++ b/lxconsole/templates/server.html @@ -244,7 +244,7 @@ {% block script %}