Skip to content

Conversation

seokho-son
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 24, 2025 16:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR changes the statistics card to display regions instead of MCIs, updating both the icon and functionality to show unique regions from VMs and Kubernetes clusters.

  • Replaces MCI count with region count calculation in the dashboard statistics
  • Updates the HTML to use a globe icon and "Regions in Use" label instead of server icon and "Total MCIs"
  • Implements logic to extract and count unique regions from both VM and K8s cluster data sources

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
dashboard.js Adds region counting logic that extracts unique regions from VMs and K8s clusters, replacing the previous MCI count display
dashboard.html Updates the statistics card to show region information with a globe icon and appropriate onclick handler

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +1346 to +1381
vmData.forEach(vm => {
let region = null;

// Extract region information - try multiple sources
if (vm.region && vm.region.Region) {
region = vm.region.Region;
} else if (vm.location && vm.location.region) {
region = vm.location.region;
} else if (vm.connectionConfig && vm.connectionConfig.regionZoneInfo && vm.connectionConfig.regionZoneInfo.region) {
region = vm.connectionConfig.regionZoneInfo.region;
} else if (vm.regionZoneInfoList && vm.regionZoneInfoList.length > 0 && vm.regionZoneInfoList[0].regionName) {
region = vm.regionZoneInfoList[0].regionName;
}

if (region) {
regions.add(region);
}
});

// Add regions from K8s clusters
k8sData.forEach(cluster => {
let region = null;

// Extract region information from cluster
if (cluster.region && cluster.region.Region) {
region = cluster.region.Region;
} else if (cluster.location && cluster.location.region) {
region = cluster.location.region;
} else if (cluster.connectionConfig && cluster.connectionConfig.regionZoneInfo && cluster.connectionConfig.regionZoneInfo.region) {
region = cluster.connectionConfig.regionZoneInfo.region;
}

if (region) {
regions.add(region);
}
});
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The region extraction logic is duplicated between VM and K8s cluster processing. Consider extracting this into a reusable function to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.

@seokho-son
Copy link
Member Author

/approve

@cb-github-robot cb-github-robot merged commit d4f98c0 into cloud-barista:main Sep 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants