src: Rely only osbuild-composer's cloudapi types
Use the predefined types in the status row and the onprem to hosted mapper.
This commit is contained in:
parent
16ae455b67
commit
90bf5cf91f
2 changed files with 8 additions and 21 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { Blueprint as CloudApiBlueprint } from '../../../store/cockpit/composerCloudApi';
|
||||
import {
|
||||
BlueprintExportResponse,
|
||||
Container,
|
||||
|
|
@ -16,6 +17,9 @@ import {
|
|||
Timezone,
|
||||
} from '../../../store/imageBuilderApi';
|
||||
|
||||
// Blueprint as defined by the osbuild-composer cloudapi's /compose
|
||||
// endpoint.
|
||||
|
||||
export type BlueprintOnPrem = {
|
||||
name: string;
|
||||
description?: string;
|
||||
|
|
@ -186,8 +190,8 @@ export const mapOnPremToHosted = (
|
|||
|
||||
export const mapHostedToOnPrem = (
|
||||
blueprint: CreateBlueprintRequest
|
||||
): BlueprintOnPrem => {
|
||||
const result: BlueprintOnPrem = {
|
||||
): CloudApiBlueprint => {
|
||||
const result: CloudApiBlueprint = {
|
||||
name: blueprint.name,
|
||||
customizations: {},
|
||||
};
|
||||
|
|
@ -213,10 +217,6 @@ export const mapHostedToOnPrem = (
|
|||
result.customizations!.files = blueprint.customizations.files;
|
||||
}
|
||||
|
||||
if (blueprint.customizations?.openscap) {
|
||||
result.customizations!.openscap = blueprint.customizations.openscap;
|
||||
}
|
||||
|
||||
if (blueprint.customizations?.filesystem) {
|
||||
result.customizations!.filesystem = blueprint.customizations.filesystem.map(
|
||||
(fs) => {
|
||||
|
|
@ -251,15 +251,6 @@ export const mapHostedToOnPrem = (
|
|||
result.customizations!.kernel = blueprint.customizations.kernel;
|
||||
}
|
||||
|
||||
if (blueprint.customizations?.groups) {
|
||||
result.customizations!.groups = blueprint.customizations.groups.map((g) => {
|
||||
return {
|
||||
name: g.name,
|
||||
gid: g.gid,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
if (blueprint.customizations?.timezone) {
|
||||
result.customizations!.timezone = blueprint.customizations.timezone;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import {
|
|||
selectSelectedBlueprintId,
|
||||
selectBlueprintSearchInput,
|
||||
} from '../../store/BlueprintSlice';
|
||||
import { LocalUploadStatus } from '../../store/cockpit/composerCloudApi';
|
||||
import { useAppSelector } from '../../store/hooks';
|
||||
import {
|
||||
BlueprintItem,
|
||||
|
|
@ -419,14 +420,9 @@ export const LocalInstance = ({ compose }: LocalInstancePropTypes) => {
|
|||
return <Skeleton />;
|
||||
}
|
||||
|
||||
// Hacky to define the type here, but local upload is not available in
|
||||
// the image builder api, only in the composer api.
|
||||
type LocalUploadStatusOptions = {
|
||||
artifact_path: string;
|
||||
};
|
||||
const status = composeStatus?.image_status.status;
|
||||
const options = composeStatus?.image_status.upload_status
|
||||
?.options as unknown as LocalUploadStatusOptions;
|
||||
?.options as unknown as LocalUploadStatus;
|
||||
|
||||
if (status !== 'success') {
|
||||
return <></>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue