-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathindex.tsx
More file actions
90 lines (79 loc) · 2.88 KB
/
index.tsx
File metadata and controls
90 lines (79 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import React, { useMemo } from 'react';
import { Card, CardBody } from '@patternfly/react-core';
import { ON_PREM_RELEASES, RELEASES } from '@/constants';
import { useTargetEnvironmentCategories } from '@/Hooks';
import { useCustomizationRestrictions } from '@/store/api/distributions';
import { useAppSelector } from '@/store/hooks';
import {
selectArchitecture,
selectBlueprintDescription,
selectBlueprintName,
selectDistribution,
selectImageSource,
selectImageTypes,
selectIsImageMode,
selectIsOnPremise,
} from '@/store/slices';
import { MiscFormats, PrivateClouds, PublicClouds } from './components';
import { Users } from '../AdvancedSettings/components';
import { ReviewCardHeader, ReviewGroup, ReviewList } from '../shared';
const ImageOverview = () => {
const imageName = useAppSelector(selectBlueprintName);
const description = useAppSelector(selectBlueprintDescription);
const isOnPremise = useAppSelector(selectIsOnPremise);
const isImageMode = useAppSelector(selectIsImageMode);
const imageSource = useAppSelector(selectImageSource);
const distribution = useAppSelector(selectDistribution);
const arch = useAppSelector(selectArchitecture);
const environments = useAppSelector(selectImageTypes);
const { publicClouds, privateClouds, miscFormats } =
useTargetEnvironmentCategories(environments);
const { restrictions } = useCustomizationRestrictions({
selectedImageTypes: environments,
});
const releases = isOnPremise ? ON_PREM_RELEASES : RELEASES;
const release = useMemo(() => {
if (isImageMode) return imageSource;
return releases.get(distribution);
}, [releases, distribution, isImageMode, imageSource]);
return (
<Card>
<ReviewCardHeader
title='Image overview'
stepId='base-settings-step'
sectionId='image-output-section'
/>
<CardBody>
<ReviewList>
<ReviewGroup heading='Name' description={imageName} />
{description && (
<ReviewGroup heading='Details' description={description} />
)}
{
// TODO: the author line item isn't supported in the
// backend yet, so we can't show this just yet
}
<ReviewGroup
heading={!isImageMode ? 'Base release' : 'Image'}
description={release}
/>
<ReviewGroup
className='pf-v6-u-mb-md'
heading='Architecture'
description={arch}
/>
<ReviewGroup heading='Target environments' />
<PrivateClouds environments={privateClouds} />
<PublicClouds environments={publicClouds} />
<MiscFormats environments={miscFormats} />
<Users
shouldHide={
restrictions.users.shouldHide || !(isOnPremise && isImageMode)
}
/>
</ReviewList>
</CardBody>
</Card>
);
};
export default ImageOverview;