Skip to content

Commit a6ae221

Browse files
committed
add files
1 parent 7196ba6 commit a6ae221

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import {
2+
Body,
3+
css,
4+
Link,
5+
spacing,
6+
Subtitle,
7+
} from '@mongodb-js/compass-components';
8+
import { useConnectionInfo } from '@mongodb-js/compass-connections/provider';
9+
import React from 'react';
10+
11+
const paragraphStyles = css({
12+
display: 'flex',
13+
flexDirection: 'column',
14+
gap: spacing[100],
15+
});
16+
17+
export function ShardZonesDescription() {
18+
const { atlasMetadata } = useConnectionInfo();
19+
return (
20+
<>
21+
<Subtitle>Location Codes</Subtitle>
22+
<div className={paragraphStyles}>
23+
<Body>
24+
Each document’s first field should include an ISO 3166-1 Alpha-2 code
25+
for the location it belongs to.
26+
</Body>
27+
<Body>
28+
We also support ISO 3166-2 subdivision codes for countries containing
29+
a cloud provider data center (both ISO 3166-1 and ISO 3166-2 codes may
30+
be used for these countries). All valid country codes and the zones to
31+
which they map are listed in the table below. Additionally, you can
32+
view a list of all location codes{' '}
33+
<Link href="/static/atlas/country_iso_codes.txt">here</Link>.
34+
</Body>
35+
<Body>
36+
{atlasMetadata?.projectId && atlasMetadata?.clusterName && (
37+
<>
38+
Locations’ zone mapping can be changed by navigating to this
39+
clusters{' '}
40+
<Link
41+
href={`/v2/${atlasMetadata?.projectId}#/clusters/edit/${atlasMetadata?.clusterName}`}
42+
>
43+
Edit Configuration
44+
</Link>{' '}
45+
page and clicking the Configure Location Mappings’ link above the
46+
map.
47+
</>
48+
)}
49+
</Body>
50+
</div>
51+
</>
52+
);
53+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import { expect } from 'chai';
3+
import { screen } from '@mongodb-js/testing-library-compass';
4+
import type { ConnectionInfo } from '@mongodb-js/compass-connections/provider';
5+
import { renderWithStore } from '../../tests/create-store';
6+
import { ShardZonesDescription } from './shard-zones-description';
7+
8+
describe('ShardZonesDescription', () => {
9+
it('Provides link to Edit Configuration', async function () {
10+
const connectionInfo = {
11+
id: 'testConnection',
12+
connectionOptions: {
13+
connectionString: 'mongodb://test',
14+
},
15+
atlasMetadata: {
16+
projectId: 'project1',
17+
clusterName: 'myCluster',
18+
} as ConnectionInfo['atlasMetadata'],
19+
};
20+
await renderWithStore(<ShardZonesDescription />, {
21+
connectionInfo,
22+
});
23+
24+
const link = await screen.findByRole('link', {
25+
name: /Edit Configuration/,
26+
});
27+
const expectedHref = `/v2/${connectionInfo.atlasMetadata?.projectId}#/clusters/edit/${connectionInfo.atlasMetadata?.clusterName}`;
28+
29+
expect(link).to.be.visible;
30+
expect(link).to.have.attribute('href', expectedHref);
31+
});
32+
});

0 commit comments

Comments
 (0)