mirror of https://github.com/portainer/portainer
22 lines
475 B
TypeScript
22 lines
475 B
TypeScript
import _ from 'lodash-es';
|
|
|
|
import { ProviderResponse } from '../types';
|
|
|
|
export interface ProviderViewModel {
|
|
id: string;
|
|
namespace: string;
|
|
locations: string[];
|
|
}
|
|
|
|
export function parseViewModel({
|
|
id,
|
|
namespace,
|
|
resourceTypes,
|
|
}: ProviderResponse): ProviderViewModel {
|
|
const containerGroupType = _.find(resourceTypes, {
|
|
resourceType: 'containerGroups',
|
|
});
|
|
const { locations = [] } = containerGroupType || {};
|
|
return { id, namespace, locations };
|
|
}
|