Skip to content

Commit

Permalink
store/cockpitApi: use existing blueprint converter
Browse files Browse the repository at this point in the history
Use the blueprint existing blueprint converter to convert
the on-prem blueprint to the hosted blueprint
  • Loading branch information
kingsleyzissou authored and lucasgarfield committed Dec 21, 2024
1 parent a9ebfb7 commit 47156c4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/store/cockpitApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
BlueprintItem,
} from './imageBuilderApi';

import { mapOnPremToHosted } from '../Components/Blueprints/helpers/onPremToHostedBlueprintMapper';
import { BLUEPRINTS_DIR } from '../constants';

const getBlueprintsPath = async () => {
Expand Down Expand Up @@ -61,12 +62,12 @@ export const cockpitApi = emptyCockpitApi.injectEndpoints({
const parsed = toml.parse(contents);
file.close();

// TODO: using the existing blueprint converter
const blueprint = mapOnPremToHosted(parsed);
const version = (parsed.version as number) ?? 1;
return {
name: parsed.name as string,
...blueprint,
id: filename as string,
version: parsed.version as number,
description: parsed.description as string,
version: Math.floor(version),
last_modified_at: Date.now().toString(),
};
})
Expand Down

0 comments on commit 47156c4

Please sign in to comment.