store/cockpitApi: enable aws image types
This commit is contained in:
parent
ac21488c32
commit
b50c4f4c13
2 changed files with 54 additions and 30 deletions
|
|
@ -69,9 +69,13 @@ const TargetEnvironmentCard = ({
|
|||
}}
|
||||
>
|
||||
<Flex direction={{ default: 'column' }}>
|
||||
<FlexItem>
|
||||
<img className="provider-icon" src={imageSrc} alt={imageAlt} />
|
||||
</FlexItem>
|
||||
{!process.env.IS_ON_PREMISE && (
|
||||
// the logos don't display in cockpit,
|
||||
// so we can just hide them
|
||||
<FlexItem>
|
||||
<img className="provider-icon" src={imageSrc} alt={imageAlt} />
|
||||
</FlexItem>
|
||||
)}
|
||||
<FlexItem>
|
||||
<Title headingLevel="h5" size="md">
|
||||
{title}
|
||||
|
|
|
|||
|
|
@ -124,6 +124,19 @@ const readComposes = async (bpID: string) => {
|
|||
return composes;
|
||||
};
|
||||
|
||||
const getCloudConfigs = async () => {
|
||||
try {
|
||||
const worker_config = cockpit.file(
|
||||
'/etc/osbuild-worker/osbuild-worker.toml'
|
||||
);
|
||||
const contents = await worker_config.read();
|
||||
const parsed = TOML.parse(contents);
|
||||
return Object.keys(parsed).filter((k) => k === 'aws');
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const cockpitApi = contentSourcesApi.injectEndpoints({
|
||||
endpoints: (builder) => {
|
||||
return {
|
||||
|
|
@ -131,33 +144,40 @@ export const cockpitApi = contentSourcesApi.injectEndpoints({
|
|||
GetArchitecturesApiResponse,
|
||||
GetArchitecturesApiArg
|
||||
>({
|
||||
queryFn: () => {
|
||||
// TODO: this is hardcoded for now, but we may need to query
|
||||
// the cloudapi endpoint on the composer socket to get the
|
||||
// available information
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
arch: 'aarch64',
|
||||
image_types: ['guest-image', 'image-installer'],
|
||||
repositories: [],
|
||||
},
|
||||
{
|
||||
arch: 'x86_64',
|
||||
image_types: [
|
||||
'rhel-edge-commit',
|
||||
'rhel-edge-installer',
|
||||
'edge-commit',
|
||||
'edge-installer',
|
||||
'guest-image',
|
||||
'image-installer',
|
||||
'vsphere',
|
||||
'vsphere-ova',
|
||||
],
|
||||
repositories: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
queryFn: async () => {
|
||||
try {
|
||||
const cloudImageTypes = await getCloudConfigs();
|
||||
return {
|
||||
data: [
|
||||
{
|
||||
arch: 'aarch64',
|
||||
image_types: [
|
||||
'guest-image',
|
||||
'image-installer',
|
||||
...cloudImageTypes,
|
||||
],
|
||||
repositories: [],
|
||||
},
|
||||
{
|
||||
arch: 'x86_64',
|
||||
image_types: [
|
||||
'rhel-edge-commit',
|
||||
'rhel-edge-installer',
|
||||
'edge-commit',
|
||||
'edge-installer',
|
||||
'guest-image',
|
||||
'image-installer',
|
||||
'vsphere',
|
||||
'vsphere-ova',
|
||||
...cloudImageTypes,
|
||||
],
|
||||
repositories: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
} catch (error) {
|
||||
return { error };
|
||||
}
|
||||
},
|
||||
}),
|
||||
getBlueprint: builder.query<GetBlueprintApiResponse, GetBlueprintApiArg>({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue