This commit is contained in:
matthewalanpenning 2023-11-01 06:21:44 -04:00
parent a06e67f489
commit 058485d5b1
21 changed files with 167 additions and 510 deletions

View file

@ -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('<option value="' + data[index].id + '">' + data[index].name + '</option>');
// }
// })
//Populate the Role dropdown in the modal //Populate the Role dropdown in the modal
$.getJSON("../api/roles/list_roles", function (data) { $.getJSON("../api/roles/list_roles", function (data) {
data = data.data data = data.data

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -67,32 +67,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -679,33 +679,9 @@
function loadPageContent(){ function loadPageContent(){
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
}
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
//Load Instance Data and Configuration //Load Instance Data and Configuration
loadInstanceData() loadInstanceData()

View file

@ -96,32 +96,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
//Populate the modal Profile dropdown //Populate the modal Profile dropdown
$.getJSON("../api/profiles/list_profiles?id="+serverId+"&project="+project, function (data) { $.getJSON("../api/profiles/list_profiles?id="+serverId+"&project="+project, function (data) {

View file

@ -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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
}
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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
}
function updateAccount(){ function updateAccount(){
$.post("../api/users/update_user", { $.post("../api/users/update_user", {
id: "{{ page_user_id }}", id: "{{ page_user_id }}",

View file

@ -20,7 +20,7 @@
</li> </li>
<li id="serverNavbarSelect" class="nav-item" style="display: none;"> <li id="serverNavbarSelect" class="nav-item" style="display: none;">
<div class="input-group"> <div class="input-group">
<select class="form-select" id="serverListNav" style="width:150px;" onchange="changeServer(this.value)"> <select class="form-select" id="serverListNav" style="width:200px;" onchange="changeServer(this.value)">
</select> </select>
</div> </div>
</li> </li>

View file

@ -103,32 +103,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
//Get data using jquery call datatable within function, set data: data.ingress for one table and data.exgress for the other //Get data using jquery call datatable within function, set data: data.ingress for one table and data.exgress for the other
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -263,33 +263,9 @@
function loadPageContent(){ function loadPageContent(){
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
}
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
//Load Network State //Load Network State
loadNetworkState() loadNetworkState()

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -61,32 +61,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId+"&project="+project, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -244,7 +244,7 @@
{% block script %} {% block script %}
<script> <script>
var reloadTime = 10000; var reloadTime = 20000;
const queryString = window.location.search; const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const serverId = urlParams.get('id'); const serverId = urlParams.get('id');
@ -270,8 +270,18 @@
//Clear the automatic page reload //Clear the automatic page reload
clearTimeout(pageReloadTimeout); clearTimeout(pageReloadTimeout);
//Reload the datatables content //Reload various cards
$('#myDataTable').DataTable().ajax.reload(null, false); loadLxdInformation()
loadResourceInformation()
loadContainersInformation()
loadVirtualMachinesInformation()
loadClusterMembersInformation()
loadImagesInformation()
loadProfilesInformation()
loadNetworksInformation()
loadStoragePoolsInformation()
loadNetworkAclsInformation()
loadProjectsInformation()
//Set the automatic page reload //Set the automatic page reload
pageReloadTimeout = setTimeout(() => { reloadPageContent(); }, reloadTime); pageReloadTimeout = setTimeout(() => { reloadPageContent(); }, reloadTime);
@ -281,37 +291,40 @@
applySidebarStyles(); applySidebarStyles();
applySidebarLinks(); applySidebarLinks();
//Display the current project //Loaded from main.html template
$("#selectedProject").text(project); populateServerSelectDropdown()
populateProjectSelectDropdown()
//Populate various cards
loadLxdInformation()
loadResourceInformation()
loadContainersInformation()
loadVirtualMachinesInformation()
loadClusterMembersInformation()
loadImagesInformation()
loadProfilesInformation()
loadNetworksInformation()
loadStoragePoolsInformation()
loadNetworkAclsInformation()
loadProjectsInformation()
//Set hyperlink references for cards
$("#containersLink").attr("href", "instances?id="+serverId+"&project="+project)
$("#virtualMachinesLink").attr("href", "instances?id="+serverId+"&project="+project+"#virtual-machines")
$("#clusterMembersLink").attr("href", "cluster-members?id="+serverId+"&project="+project)
$("#imagesLink").attr("href", "images?id="+serverId+"&project="+project)
$("#profilesLink").attr("href", "profiles?id="+serverId+"&project="+project)
$("#networksLink").attr("href", "networks?id="+serverId+"&project="+project)
$("#storagePoolsLink").attr("href", "storage-pools?id="+serverId+"&project="+project)
$("#projectsLink").attr("href", "projects?id="+serverId+"&project="+project)
$("#networkAclsLink").attr("href", "network-acls?id="+serverId+"&project="+project)
//Set reload page content
pageReloadTimeout = setTimeout(() => { reloadPageContent(); }, reloadTime);
//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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
} }
})
//Populate the Project dropdown
$.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) {
data = data.metadata
$("#totalProjects").text(data.length);
for (var index = 0; index < data.length; index++) {
optionText = data[index].replace('/1.0/projects/','');
if (optionText == project)
$('#projectListNav').append('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
function loadLxdInformation() {
//LXD Info //LXD Info
$.getJSON("../api/server/get_server_info?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/server/get_server_info?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata.environment; data = data.metadata.environment;
@ -333,7 +346,9 @@
}); });
}); });
}
function loadResourceInformation() {
//Resource Info //Resource Info
$.getJSON("../api/server/get_server_resources?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/server/get_server_resources?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata; data = data.metadata;
@ -401,7 +416,9 @@
}); });
}); });
}
function loadContainersInformation(){
//Load Containers Info //Load Containers Info
$.getJSON("../api/instances/list_instances?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&filter=container'+'&recursion=1', function (data) { $.getJSON("../api/instances/list_instances?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&filter=container'+'&recursion=1', function (data) {
data = data.metadata; data = data.metadata;
@ -427,7 +444,9 @@
$("#containerPercentage").text(containerPercentage + '% of containers are running') $("#containerPercentage").text(containerPercentage + '% of containers are running')
}); });
}
function loadVirtualMachinesInformation(){
// Load Virtual Machine Info // Load Virtual Machine Info
$.getJSON("../api/instances/list_instances?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&filter=virtual-machine'+'&recursion=1', function (data) { $.getJSON("../api/instances/list_instances?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&filter=virtual-machine'+'&recursion=1', function (data) {
data = data.metadata; data = data.metadata;
@ -453,8 +472,10 @@
$("#virtualMachinePercentage").text(virtualMachinePercentage + '% of virtual machines are running') $("#virtualMachinePercentage").text(virtualMachinePercentage + '% of virtual machines are running')
}); });
}
//Load Cluster Memebers Info function loadClusterMembersInformation() {
//Load Cluster Members Info
$.getJSON("../api/cluster-members/list_cluster_members?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&recursion=1', function (data) { $.getJSON("../api/cluster-members/list_cluster_members?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&recursion=1', function (data) {
data = data.metadata; data = data.metadata;
@ -483,53 +504,57 @@
$("#clusterPercentage").text(clusterPercentage + '% of cluster members are online') $("#clusterPercentage").text(clusterPercentage + '% of cluster members are online')
}); });
}
function loadImagesInformation() {
//Load Images Info //Load Images Info
$.getJSON("../api/images/list_images?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/images/list_images?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata data = data.metadata
$("#totalImages").text(data.length); $("#totalImages").text(data.length);
}); });
}
function loadProfilesInformation() {
//Load Profiles Info //Load Profiles Info
$.getJSON("../api/profiles/list_profiles?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/profiles/list_profiles?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata data = data.metadata
$("#totalProfiles").text(data.length); $("#totalProfiles").text(data.length);
}); });
}
function loadNetworksInformation(){
//Load Network Info //Load Network Info
$.getJSON("../api/networks/list_networks?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/networks/list_networks?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata data = data.metadata
$("#totalNetworks").text(data.length); $("#totalNetworks").text(data.length);
}); });
}
function loadStoragePoolsInformation(){
//Load Storage Pools Info //Load Storage Pools Info
$.getJSON("../api/storage-pools/list_storage_pools?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/storage-pools/list_storage_pools?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata data = data.metadata
$("#totalStoragePools").text(data.length); $("#totalStoragePools").text(data.length);
}); });
}
function loadNetworkAclsInformation() {
//Load Network ACLs Info //Load Network ACLs Info
$.getJSON("../api/network-acls/list_network_acls?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) { $.getJSON("../api/network-acls/list_network_acls?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
data = data.metadata data = data.metadata
$("#totalNetworkAcls").text(data.length); $("#totalNetworkAcls").text(data.length);
}); });
//Set hyperlink references for cards
$("#containersLink").attr("href", "instances?id="+serverId+"&project="+project)
$("#virtualMachinesLink").attr("href", "instances?id="+serverId+"&project="+project+"#virtual-machines")
$("#clusterMembersLink").attr("href", "cluster-members?id="+serverId+"&project="+project)
$("#imagesLink").attr("href", "images?id="+serverId+"&project="+project)
$("#profilesLink").attr("href", "profiles?id="+serverId+"&project="+project)
$("#networksLink").attr("href", "networks?id="+serverId+"&project="+project)
$("#storagePoolsLink").attr("href", "storage-pools?id="+serverId+"&project="+project)
$("#projectsLink").attr("href", "projects?id="+serverId+"&project="+project)
$("#networkAclsLink").attr("href", "network-acls?id="+serverId+"&project="+project)
//Set reload page content
pageReloadTimeout = setTimeout(() => { reloadPageContent(); }, reloadTime);
} }
function loadProjectsInformation() {
//Populate the Project dropdown
$.getJSON("../api/projects/list_projects?id="+serverId+"&project="+project, function (data) {
data = data.metadata
$("#totalProjects").text(data.length);
})
}
$(document).ready(function(){ $(document).ready(function(){
//If serverId is missing redirect to servers page //If serverId is missing redirect to servers page

View file

@ -64,32 +64,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -65,32 +65,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({

View file

@ -73,32 +73,9 @@
//Display the current project //Display the current project
$("#selectedProject").text(project); $("#selectedProject").text(project);
//Populate the Server dropdown //Loaded from main.html template
$.getJSON("../api/servers/list_servers?id="+serverId, function (data) { populateServerSelectDropdown()
data = data.data populateProjectSelectDropdown()
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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
else
$('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
}
})
//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('<option value="' + optionText + '" selected="selected">' + optionText + '</option>');
else
$('#projectListNav').append('<option value="' + optionText + '">' + optionText + '</option>');
}
})
// Configure Datatable // Configure Datatable
$('#myDataTable').DataTable({ $('#myDataTable').DataTable({