Skip to content

Commit 2562a2f

Browse files
refactor: [M3-6910] - Replace instances in : Object Storage (#11456)
* refactor: [M3-6910] - Replace instances in : Object Storage * Added changeset: Replace Select with Autocomplete component in Object Storage * Remove unnecessary `vi.mocks`
1 parent 6992080 commit 2562a2f

File tree

6 files changed

+14
-19
lines changed

6 files changed

+14
-19
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Tech Stories
3+
---
4+
5+
Replace Select with Autocomplete component in Object Storage ([#11456](https://github.com/linode/manager/pull/11456))

packages/manager/src/features/ObjectStorage/BucketDetail/AccessSelect.test.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ const AUTHENTICATED_READ_TEXT = 'Authenticated Read';
1515
const BUCKET_ACCESS_URL = '*object-storage/buckets/*/*/access';
1616
const OBJECT_ACCESS_URL = '*object-storage/buckets/*/*/object-acl';
1717

18-
vi.mock('src/components/EnhancedSelect/Select');
19-
2018
const defaultProps: Props = {
2119
clusterOrRegion: 'in-maa',
2220
endpointType: 'E1',
@@ -30,9 +28,6 @@ describe('AccessSelect', () => {
3028
flags: { objectStorageGen2: { enabled: true } },
3129
});
3230

33-
beforeEach(() => {
34-
vi.clearAllMocks();
35-
});
3631
it.each([
3732
['bucket', 'E0', true],
3833
['bucket', 'E1', true],

packages/manager/src/features/ObjectStorage/BucketDetail/ObjectDetailsDrawer.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ vi.mock('@linode/api-v4/lib/object-storage/objects', async () => {
2323
};
2424
});
2525

26-
vi.mock('src/components/EnhancedSelect/Select');
27-
2826
const props: ObjectDetailsDrawerProps = {
2927
bucketName: 'my-bucket',
3028
clusterId: 'cluster-id',

packages/manager/src/features/ObjectStorage/BucketLanding/ClusterSelect.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { renderWithTheme } from 'src/utilities/testHelpers';
44

55
import ClusterSelect from './ClusterSelect';
66

7-
vi.mock('src/components/EnhancedSelect/Select');
8-
97
describe('ClusterSelect', () => {
108
it('Renders a select with object storage clusters', () => {
119
const { getByText } = renderWithTheme(

packages/manager/src/features/ObjectStorage/BucketLanding/CreateBucketDrawer.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ const props = {
1818
onClose: vi.fn(),
1919
};
2020

21-
vi.mock('src/components/EnhancedSelect/Select');
22-
2321
describe('CreateBucketDrawer', () => {
2422
it.skip('Should show a general error notice if the API returns one', async () => {
2523
server.use(

packages/manager/src/features/ObjectStorage/utilities.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { OBJECT_STORAGE_DELIMITER } from 'src/constants';
22

33
import type { AccountSettings } from '@linode/api-v4/lib/account';
4-
import type {
5-
ACLType,
6-
ObjectStorageObject,
7-
} from '@linode/api-v4/lib/object-storage';
4+
import type { ObjectStorageObject } from '@linode/api-v4/lib/object-storage';
85
import type { ObjectStorageEndpoint } from '@linode/api-v4/lib/object-storage';
96
import type { FormikProps } from 'formik';
10-
import type { Item } from 'src/components/EnhancedSelect/Select';
117

128
export const generateObjectUrl = (hostname: string, objectName: string) => {
139
return `https://${hostname}/${objectName}`;
@@ -43,6 +39,11 @@ export const basename = (
4339
return path.substr(idx + 1);
4440
};
4541

42+
export interface ACLType {
43+
label: string;
44+
value: string;
45+
}
46+
4647
export interface ExtendedObject extends ObjectStorageObject {
4748
_displayName: string;
4849
_isFolder: boolean;
@@ -153,18 +154,18 @@ export const confirmObjectStorage = async <T extends {}>(
153154
}
154155
};
155156

156-
export const objectACLOptions: Item<ACLType>[] = [
157+
export const objectACLOptions: ACLType[] = [
157158
{ label: 'Private', value: 'private' },
158159
{ label: 'Authenticated Read', value: 'authenticated-read' },
159160
{ label: 'Public Read', value: 'public-read' },
160161
];
161162

162-
export const bucketACLOptions: Item<ACLType>[] = [
163+
export const bucketACLOptions: ACLType[] = [
163164
...objectACLOptions,
164165
{ label: 'Public Read/Write', value: 'public-read-write' },
165166
];
166167

167-
export const objectACLHelperText: Record<ACLType, string> = {
168+
export const objectACLHelperText: Record<string, string> = {
168169
'authenticated-read': 'Authenticated Read ACL',
169170
custom: 'Custom ACL',
170171
private: 'Private ACL',

0 commit comments

Comments
 (0)