Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [M3-7197] - "Support Ticket" button in network tab not working properly #11074

Merged
merged 39 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b274baf
unit test coverage for HostNameTableCell
cpathipa Jun 19, 2024
f958dab
Revert "unit test coverage for HostNameTableCell"
cpathipa Jun 19, 2024
5d0a476
Merge branch 'linode:develop' into develop
cpathipa Jun 25, 2024
93aab07
Merge branch 'linode:develop' into develop
cpathipa Jun 25, 2024
d7deb4f
Merge branch 'linode:develop' into develop
cpathipa Jul 1, 2024
a550f05
Merge branch 'linode:develop' into develop
cpathipa Jul 3, 2024
de0f63e
Merge branch 'linode:develop' into develop
cpathipa Jul 5, 2024
426c42c
Merge branch 'linode:develop' into develop
cpathipa Jul 17, 2024
3fb49a6
Merge branch 'linode:develop' into develop
cpathipa Jul 22, 2024
6c76508
Merge branch 'linode:develop' into develop
cpathipa Jul 24, 2024
1653a6b
Merge branch 'linode:develop' into develop
cpathipa Jul 25, 2024
00421cf
Merge branch 'linode:develop' into develop
cpathipa Jul 29, 2024
959730a
Merge branch 'linode:develop' into develop
cpathipa Jul 31, 2024
d9bd490
Merge branch 'linode:develop' into develop
cpathipa Jul 31, 2024
960415e
Merge branch 'linode:develop' into develop
cpathipa Aug 1, 2024
b9f4745
Merge branch 'linode:develop' into develop
cpathipa Aug 2, 2024
b0b9264
Merge branch 'linode:develop' into develop
cpathipa Aug 21, 2024
6c70559
Merge branch 'linode:develop' into develop
cpathipa Aug 28, 2024
96eb34d
Merge branch 'linode:develop' into develop
cpathipa Sep 3, 2024
74b1635
Merge branch 'linode:develop' into develop
cpathipa Sep 4, 2024
70d1422
Merge branch 'linode:develop' into develop
cpathipa Sep 5, 2024
342fd96
Merge branch 'linode:develop' into develop
cpathipa Sep 9, 2024
bfed239
Merge branch 'linode:develop' into develop
cpathipa Sep 13, 2024
8a19f9b
Merge branch 'linode:develop' into develop
cpathipa Sep 17, 2024
9e9c14f
Merge branch 'linode:develop' into develop
cpathipa Sep 17, 2024
a25728e
Merge branch 'linode:develop' into develop
cpathipa Sep 18, 2024
3196f2a
Merge branch 'linode:develop' into develop
cpathipa Sep 19, 2024
4794d04
Merge branch 'linode:develop' into develop
cpathipa Sep 23, 2024
e977a94
Merge branch 'linode:develop' into develop
cpathipa Sep 24, 2024
add3f10
Merge branch 'linode:develop' into develop
cpathipa Sep 24, 2024
2fafd33
Merge branch 'linode:develop' into develop
cpathipa Sep 25, 2024
b3463ae
Merge branch 'linode:develop' into develop
cpathipa Sep 26, 2024
a325e30
Merge branch 'linode:develop' into develop
cpathipa Sep 30, 2024
b1e2a51
chore: [M3-8662] - Update Github Actions actions (#11009)
bnussman-akamai Sep 26, 2024
1b0931b
Merge branch 'develop' of github.com:cpathipa/manager into develop
cpathipa Sep 30, 2024
9b2de1d
Merge branch 'linode:develop' into develop
cpathipa Sep 30, 2024
ff89c50
Merge branch 'linode:develop' into develop
cpathipa Oct 9, 2024
9b9f995
fix: [M3-7197] - "Support Ticket" button in network tab not working p…
cpathipa Oct 9, 2024
a23ac7f
Create pr-11074-fixed-1728476792585.md
cpathipa Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11074-fixed-1728476792585.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

"Support Ticket" button in network tab not working properly ([#11074](https://github.com/linode/manager/pull/11074))
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ import {
} from 'src/queries/linodes/networking';
import { useCreateIPv6RangeMutation } from 'src/queries/networking/networking';

import { ExplainerCopy } from './ExplainerCopy';

import type { IPv6Prefix } from '@linode/api-v4/lib/networking';
import type { Item } from 'src/components/EnhancedSelect/Select';

type IPType = 'v4Private' | 'v4Public';
export type IPType = 'v4Private' | 'v4Public';

const ipOptions: Item<IPType>[] = [
{ label: 'Public', value: 'v4Public' },
Expand All @@ -34,27 +36,6 @@ const prefixOptions = [
{ label: '/56', value: '56' },
];

// @todo: Pre-fill support tickets.
const explainerCopy: Record<IPType, JSX.Element> = {
v4Private: (
<>
Add a private IP address to your Linode. Data sent explicitly to and from
private IP addresses in the same data center does not incur transfer quota
usage. To ensure that the private IP is properly configured once added,
it&rsquo;s best to reboot your Linode.
</>
),
v4Public: (
<>
Public IP addresses, over and above the one included with each Linode,
incur an additional monthly charge. If you need an additional Public IP
Address you must request one. Please open a{' '}
<Link to="support/tickets">Support Ticket</Link> if you have not done so
already.
</>
),
};

const IPv6ExplanatoryCopy = {
56: (
<>
Expand All @@ -70,7 +51,7 @@ const IPv6ExplanatoryCopy = {
),
};

const tooltipCopy: Record<IPType, string | null> = {
const tooltipCopy: Record<IPType, null | string> = {
v4Private: 'This Linode already has a private IP address.',
v4Public: null,
};
Expand Down Expand Up @@ -197,19 +178,23 @@ export const AddIPDrawer = (props: Props) => {
<Box>
{ipOptions.map((option, idx) => (
<FormControlLabel
control={<Radio />}
data-qa-radio={option.label}
disabled={
option.value === 'v4Private' && linodeIsInDistributedRegion
}
control={<Radio />}
data-qa-radio={option.label}
key={idx}
label={option.label}
value={option.value}
/>
))}
</Box>
</StyledRadioGroup>
{selectedIPv4 && <Typography>{explainerCopy[selectedIPv4]}</Typography>}
{selectedIPv4 && (
<Typography>
<ExplainerCopy ipType={selectedIPv4} linodeId={linodeId} />
</Typography>
)}

{_tooltipCopy ? (
<Tooltip placement="bottom-end" title={_tooltipCopy}>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { screen } from '@testing-library/react';
import * as React from 'react';
import { vi } from 'vitest';

import { renderWithTheme } from 'src/utilities/testHelpers';

import { ExplainerCopy } from './ExplainerCopy';

const queryMocks = vi.hoisted(() => ({
useLinodeQuery: vi.fn().mockReturnValue({ data: undefined }),
}));

vi.mock('src/queries/linodes/linodes', async () => {
const actual = await vi.importActual('src/queries/linodes/linodes');
return {
...actual,
useLinodeQuery: queryMocks.useLinodeQuery,
};
});

describe('ExplainerCopy Component', () => {
const linodeId = 1234;

beforeEach(() => {
queryMocks.useLinodeQuery.mockReturnValue({
data: { label: 'Test Linode' },
});
});

afterEach(() => {
vi.resetAllMocks();
});

it('renders the correct content for v4Private IPType', () => {
renderWithTheme(<ExplainerCopy ipType="v4Private" linodeId={linodeId} />);

expect(
screen.getByText(/Add a private IP address to your Linode/i)
).toBeVisible();
expect(
screen.getByText(/Data sent explicitly to and from private IP addresses/i)
).toBeVisible();
});

it('renders the correct content for v4Public IPType with SupportLink', () => {
renderWithTheme(<ExplainerCopy ipType="v4Public" linodeId={linodeId} />);

expect(
screen.getByText(/Public IP addresses, over and above the one included/i)
).toBeVisible();
expect(screen.getByRole('link', { name: 'Support Ticket' })).toBeVisible();
});

it('displays no content when an unknown IPType is provided', () => {
renderWithTheme(<ExplainerCopy ipType={null as any} linodeId={linodeId} />);

expect(screen.queryByText(/Add a private IP address/i)).toBeNull();
expect(screen.queryByText(/Support Ticket/)).toBeNull();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as React from 'react';

import { SupportLink } from 'src/components/SupportLink';
import { useLinodeQuery } from 'src/queries/linodes/linodes';

import type { IPType } from './AddIPDrawer';

interface ExplainerCopyProps {
ipType: IPType;
linodeId: number;
}

export const ExplainerCopy = ({ ipType, linodeId }: ExplainerCopyProps) => {
const { data: linode } = useLinodeQuery(linodeId);

switch (ipType) {
case 'v4Private':
return (
<>
Add a private IP address to your Linode. Data sent explicitly to and
from private IP addresses in the same data center does not incur
transfer quota usage. To ensure that the private IP is properly
configured once added, it&rsquo;s best to reboot your Linode.
</>
);
case 'v4Public':
return (
<>
Public IP addresses, over and above the one included with each Linode,
incur an additional monthly charge. If you need an additional Public
IP Address you must request one. Please open a{' '}
<SupportLink
entity={{ id: linodeId, type: 'linode_id' }}
text="Support Ticket"
title={`Additional Public IP Address on ${linode?.label}`}
Comment on lines +33 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for pre-filling.

/>{' '}
if you have not done so already.
</>
);
default:
return null;
}
};