1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

refactor(azure/aci): migrate create view to react [EE-2188] (#6371)

This commit is contained in:
Chaim Lev-Ari 2022-02-01 19:38:45 +02:00 committed by GitHub
parent 1bb02eea59
commit 6f6f78fbe5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 1476 additions and 571 deletions

View file

@ -0,0 +1,35 @@
import { ProviderViewModel } from '@/azure/models/provider';
import { ResourceGroup } from '@/azure/types';
export function getSubscriptionResourceGroups(
subscriptionId?: string,
resourceGroups?: Record<string, ResourceGroup[]>
) {
if (!subscriptionId || !resourceGroups || !resourceGroups[subscriptionId]) {
return [];
}
return resourceGroups[subscriptionId].map(({ name, id }) => ({
value: id,
label: name,
}));
}
export function getSubscriptionLocations(
subscriptionId?: string,
containerInstanceProviders?: Record<string, ProviderViewModel | undefined>
) {
if (!subscriptionId || !containerInstanceProviders) {
return [];
}
const provider = containerInstanceProviders[subscriptionId];
if (!provider) {
return [];
}
return provider.locations.map((location) => ({
value: location,
label: location,
}));
}