|
@@ -244,7 +244,7 @@
|
|
|
{% block script %}
|
|
|
|
|
|
<script>
|
|
|
- var reloadTime = 10000;
|
|
|
+ var reloadTime = 20000;
|
|
|
const queryString = window.location.search;
|
|
|
const urlParams = new URLSearchParams(queryString);
|
|
|
const serverId = urlParams.get('id');
|
|
@@ -270,8 +270,18 @@
|
|
|
//Clear the automatic page reload
|
|
|
clearTimeout(pageReloadTimeout);
|
|
|
|
|
|
- //Reload the datatables content
|
|
|
- $('#myDataTable').DataTable().ajax.reload(null, false);
|
|
|
+ //Reload various cards
|
|
|
+ loadLxdInformation()
|
|
|
+ loadResourceInformation()
|
|
|
+ loadContainersInformation()
|
|
|
+ loadVirtualMachinesInformation()
|
|
|
+ loadClusterMembersInformation()
|
|
|
+ loadImagesInformation()
|
|
|
+ loadProfilesInformation()
|
|
|
+ loadNetworksInformation()
|
|
|
+ loadStoragePoolsInformation()
|
|
|
+ loadNetworkAclsInformation()
|
|
|
+ loadProjectsInformation()
|
|
|
|
|
|
//Set the automatic page reload
|
|
|
pageReloadTimeout = setTimeout(() => { reloadPageContent(); }, reloadTime);
|
|
@@ -281,37 +291,40 @@
|
|
|
applySidebarStyles();
|
|
|
applySidebarLinks();
|
|
|
|
|
|
- //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('<option value="' + data[index].id + '" selected="selected">' + optionText + '</option>');
|
|
|
- else
|
|
|
- $('#serverListNav').append('<option value="' + data[index].id + '">' + optionText + '</option>');
|
|
|
- }
|
|
|
- })
|
|
|
+ //Loaded from main.html template
|
|
|
+ populateServerSelectDropdown()
|
|
|
+ populateProjectSelectDropdown()
|
|
|
+
|
|
|
+ //Populate various cards
|
|
|
+ loadLxdInformation()
|
|
|
+ loadResourceInformation()
|
|
|
+ loadContainersInformation()
|
|
|
+ loadVirtualMachinesInformation()
|
|
|
+ loadClusterMembersInformation()
|
|
|
+ loadImagesInformation()
|
|
|
+ loadProfilesInformation()
|
|
|
+ loadNetworksInformation()
|
|
|
+ loadStoragePoolsInformation()
|
|
|
+ loadNetworkAclsInformation()
|
|
|
+ loadProjectsInformation()
|
|
|
|
|
|
- //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>');
|
|
|
- }
|
|
|
- })
|
|
|
+ //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 loadLxdInformation() {
|
|
|
//LXD Info
|
|
|
$.getJSON("../api/server/get_server_info?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata.environment;
|
|
@@ -333,7 +346,9 @@
|
|
|
});
|
|
|
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadResourceInformation() {
|
|
|
//Resource Info
|
|
|
$.getJSON("../api/server/get_server_resources?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata;
|
|
@@ -401,7 +416,9 @@
|
|
|
});
|
|
|
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadContainersInformation(){
|
|
|
//Load Containers Info
|
|
|
$.getJSON("../api/instances/list_instances?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&filter=container'+'&recursion=1', function (data) {
|
|
|
data = data.metadata;
|
|
@@ -427,7 +444,9 @@
|
|
|
$("#containerPercentage").text(containerPercentage + '% of containers are running')
|
|
|
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadVirtualMachinesInformation(){
|
|
|
// Load Virtual Machine Info
|
|
|
$.getJSON("../api/instances/list_instances?id="+encodeURI(serverId)+'&project='+encodeURI(project)+'&filter=virtual-machine'+'&recursion=1', function (data) {
|
|
|
data = data.metadata;
|
|
@@ -453,8 +472,10 @@
|
|
|
$("#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) {
|
|
|
data = data.metadata;
|
|
|
|
|
@@ -483,52 +504,56 @@
|
|
|
|
|
|
$("#clusterPercentage").text(clusterPercentage + '% of cluster members are online')
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadImagesInformation() {
|
|
|
//Load Images Info
|
|
|
$.getJSON("../api/images/list_images?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata
|
|
|
$("#totalImages").text(data.length);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadProfilesInformation() {
|
|
|
//Load Profiles Info
|
|
|
$.getJSON("../api/profiles/list_profiles?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata
|
|
|
$("#totalProfiles").text(data.length);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadNetworksInformation(){
|
|
|
//Load Network Info
|
|
|
$.getJSON("../api/networks/list_networks?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata
|
|
|
$("#totalNetworks").text(data.length);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadStoragePoolsInformation(){
|
|
|
//Load Storage Pools Info
|
|
|
$.getJSON("../api/storage-pools/list_storage_pools?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata
|
|
|
$("#totalStoragePools").text(data.length);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
+ function loadNetworkAclsInformation() {
|
|
|
//Load Network ACLs Info
|
|
|
$.getJSON("../api/network-acls/list_network_acls?id="+encodeURI(serverId)+'&project='+encodeURI(project), function (data) {
|
|
|
data = data.metadata
|
|
|
$("#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(){
|
|
|
|