Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/google/src/instance/gceInstanceType.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,16 @@ module(GOOGLE_INSTANCE_GCEINSTANCETYPE_SERVICE, []).factory('gceInstanceTypeServ
}

function getAvailableTypesForLocations(locationToInstanceTypesMap, selectedLocations) {
// This function is only ever called with one location.
const [location] = selectedLocations;
return locationToInstanceTypesMap[location].instanceTypes;
if (!locationToInstanceTypesMap || !selectedLocations || selectedLocations.length === 0) {
console.error('Invalid input parameters');
return [];
}

const availableTypes = selectedLocations
.filter((location) => locationToInstanceTypesMap[location])
.flatMap((location) => locationToInstanceTypesMap[location].instanceTypes || []);

return availableTypes;
}

const getAvailableTypesForRegions = getAvailableTypesForLocations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ angular
const c = command;
const result = { dirty: {} };

const locations = c.regional ? [c.region] : [c.zone];
const locations = c.regional ? c.distributionPolicy.zones : [c.zone];
const { credentialsKeyedByAccount } = c.backingData;
const { locationToInstanceTypesMap } = credentialsKeyedByAccount[c.credentials];

Expand Down
Loading
Loading