sync the vcpu and memory sliders when moving around

This commit is contained in:
Tobias Brunner 2025-07-16 12:09:21 +02:00
parent a7713b46a2
commit 9a86e023dd
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ
4 changed files with 251 additions and 11 deletions

View file

@ -150,6 +150,31 @@ class PricingDataManager {
return { maxCpus, maxMemory };
}
// Get all unique CPU and memory values from plans
getAvailableSliderValues() {
if (!this.pricingData) return { cpuValues: [], memoryValues: [] };
const cpuSet = new Set();
const memorySet = new Set();
// Collect all unique CPU and memory values across all plans
Object.keys(this.pricingData).forEach(groupName => {
const group = this.pricingData[groupName];
Object.keys(group).forEach(serviceLevel => {
group[serviceLevel].forEach(plan => {
cpuSet.add(parseFloat(plan.vcpus));
memorySet.add(parseFloat(plan.ram));
});
});
});
// Convert to sorted arrays
const cpuValues = Array.from(cpuSet).sort((a, b) => a - b);
const memoryValues = Array.from(memorySet).sort((a, b) => a - b);
return { cpuValues, memoryValues };
}
// Get all plans for a specific service level
getPlansForServiceLevel(serviceLevel) {
if (!this.pricingData || !serviceLevel) return [];