29 lines
556 B
TypeScript
29 lines
556 B
TypeScript
import toAnvilOverviewHostList from './toAnvilOverviewHostList';
|
|
|
|
const toAnvilOverviewList = (
|
|
data: APIAnvilOverviewArray,
|
|
): APIAnvilOverviewList =>
|
|
data.reduce<APIAnvilOverviewList>(
|
|
(
|
|
previous,
|
|
{
|
|
anvilDescription: description,
|
|
anvilName: name,
|
|
anvilUUID: uuid,
|
|
hosts,
|
|
},
|
|
) => {
|
|
previous[uuid] = {
|
|
description,
|
|
hosts: toAnvilOverviewHostList(hosts),
|
|
name,
|
|
uuid,
|
|
};
|
|
|
|
return previous;
|
|
},
|
|
{},
|
|
);
|
|
|
|
export default toAnvilOverviewList;
|