Skip to content

Commit 1939c95

Browse files
committed
Move ViewImageDrawer to /ImageLibrary; update Pendo IDs
1 parent dfde5cb commit 1939c95

File tree

4 files changed

+42
-32
lines changed

4 files changed

+42
-32
lines changed

packages/manager/src/features/Images/ImagesLanding/v2/ImageLibrary/ImageLibraryTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import { EditImageDrawer } from '../../EditImageDrawer';
1616
import { ManageImageReplicasForm } from '../../ImageRegions/ManageImageRegionsForm';
1717
import { RebuildImageDrawer } from '../../RebuildImageDrawer';
1818
import { VIEW_SHARED_IMAGE_DETAILS_DRAWER_PENDO_IDS } from '../constants';
19-
import { ViewImageDrawer } from '../ShareGroups/ViewImageDrawer';
2019
import { imageLibrarySubTabs as subTabs } from './imageLibraryTabsConfig';
2120
import { ImagesView } from './ImagesView';
21+
import { ViewImageDrawer } from './ViewImageDrawer';
2222

2323
import type { Handlers as ImageHandlers } from '../../ImagesActionMenu';
2424
import type { Image } from '@linode/api-v4';

packages/manager/src/features/Images/ImagesLanding/v2/ShareGroups/ViewSharedImageDrawer.test.tsx renamed to packages/manager/src/features/Images/ImagesLanding/v2/ImageLibrary/ViewImageDrawer.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const defaultProps = {
5656
image: baseImage,
5757
imageError: null,
5858
isFetching: false,
59+
isSharedImage: true,
5960
onClose,
6061
open: true,
6162
pendoIDs: {} as typeof VIEW_SHARED_IMAGE_DETAILS_DRAWER_PENDO_IDS,
@@ -91,7 +92,7 @@ describe('ViewImageDrawer', () => {
9192
<ViewImageDrawer {...defaultProps} />
9293
);
9394

94-
expect(getByText('my-share-group')).toBeVisible();
95+
expect(getByText(/my-share-group/)).toBeVisible();
9596
});
9697

9798
it('renders original image size and total replica size', () => {

packages/manager/src/features/Images/ImagesLanding/v2/ShareGroups/ViewImageDrawer.tsx renamed to packages/manager/src/features/Images/ImagesLanding/v2/ImageLibrary/ViewImageDrawer.tsx

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ export const ViewImageDrawer = (props: Props) => {
4949
<StyledLabel>Label:</StyledLabel> {image?.label}
5050
</Typography>
5151
<Typography variant="body1">
52-
<StyledLabel>Image ID:</StyledLabel>{' '}
53-
<CopyTooltip copyableText text={image?.id ?? ''} />
52+
<StyledLabel>Image ID:</StyledLabel> {image?.id}
53+
<StyledCopyIcon
54+
data-pendo-id={pendoIDs.copyImageIdIcon}
55+
text={image?.id ?? ''}
56+
/>
5457
</Typography>
5558
{isSharedImage && (
5659
<Typography variant="body1">
@@ -87,37 +90,33 @@ export const ViewImageDrawer = (props: Props) => {
8790
</Stack>
8891
)}
8992
{image?.description && (
90-
<Typography variant="body1">
91-
<Stack direction="column" spacing={1}>
92-
<StyledLabel>Description</StyledLabel>
93-
{image.description}
94-
</Stack>
95-
</Typography>
93+
<Stack direction="column" spacing={1}>
94+
<StyledLabel>Description</StyledLabel>
95+
<Typography variant="body1">{image.description}</Typography>
96+
</Stack>
9697
)}
97-
<Typography variant="body1">
98-
<StyledLabel>Replicated in the following regions:</StyledLabel>{' '}
99-
{image?.regions.map((region) => {
100-
const countryAndLabelObject = getCountryAndLabelFromImageRegion(
101-
regions ?? [],
102-
region
103-
);
98+
<StyledLabel>Replicated in the following regions:</StyledLabel>{' '}
99+
{image?.regions.map((region) => {
100+
const countryAndLabelObject = getCountryAndLabelFromImageRegion(
101+
regions ?? [],
102+
region
103+
);
104104

105-
const imageCountry = countryAndLabelObject.country ?? 'us';
106-
const regionLabel = countryAndLabelObject.label ?? 'Unknown';
105+
const imageCountry = countryAndLabelObject.country ?? 'us';
106+
const regionLabel = countryAndLabelObject.label ?? 'Unknown';
107107

108-
return (
109-
<Stack
110-
alignItems="center"
111-
direction="row"
112-
key={region.region}
113-
marginTop={1}
114-
>
115-
<Flag country={imageCountry} />
116-
<span style={{ paddingLeft: 8 }}>{regionLabel}</span>
117-
</Stack>
118-
);
119-
})}
120-
</Typography>
108+
return (
109+
<Stack
110+
alignItems="center"
111+
direction="row"
112+
key={region.region}
113+
marginTop={1}
114+
>
115+
<Flag country={imageCountry} />
116+
<span style={{ paddingLeft: 8 }}>{regionLabel}</span>
117+
</Stack>
118+
);
119+
})}
121120
</Stack>
122121
<ActionsPanel
123122
data-pendo-id={pendoIDs.closeButton}
@@ -143,3 +142,12 @@ const StyledCloudInitIcon = styled(CloudInitIcon, {
143142
height: 16,
144143
width: 16,
145144
}));
145+
146+
const StyledCopyIcon = styled(CopyTooltip)(({ theme }) => ({
147+
'& svg': {
148+
height: 12,
149+
top: 1,
150+
width: 12,
151+
},
152+
marginLeft: theme.spacingFunction(4),
153+
}));

packages/manager/src/features/Images/ImagesLanding/v2/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export const DEFAULT_PAGE_SIZES = [25, 50, 75, 100];
44
export const VIEW_SHARED_IMAGE_DETAILS_DRAWER_PENDO_IDS = {
55
xButton: 'Images Library Shared View-X button',
66
closeButton: 'Images Library Shared View-Close',
7+
copyImageIdIcon: 'Images Library Shared View-Copy ID',
78
};

0 commit comments

Comments
 (0)