Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 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
4dbe28d
Merge branch 'linode:develop' into develop
cpathipa Oct 11, 2024
b2b7d97
Merge branch 'linode:develop' into develop
cpathipa Oct 14, 2024
04514de
Merge branch 'linode:develop' into develop
cpathipa Oct 16, 2024
e343821
Merge branch 'linode:develop' into develop
cpathipa Oct 21, 2024
7fd4fa5
Merge branch 'linode:develop' into develop
cpathipa Oct 22, 2024
81ec4f8
Merge branch 'linode:develop' into develop
cpathipa Oct 22, 2024
81ed6a2
Merge branch 'linode:develop' into develop
cpathipa Oct 23, 2024
2fbcdb3
Merge branch 'linode:develop' into develop
cpathipa Oct 24, 2024
7201471
Remove feature flag, tracking events used for A/B testing in API CLI …
cpathipa Oct 24, 2024
e8b84b6
Added changeset: Remove feature flag, tracking events used for A/B te…
cpathipa Oct 24, 2024
e6ceda5
Merge remote-tracking branch 'origin/develop' into M3-8785
cpathipa Oct 24, 2024
903f2df
Merge remote-tracking branch 'origin/develop' into M3-8785
cpathipa Oct 29, 2024
de80fc7
PR feedback - @mjac0bs
cpathipa Oct 29, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@linode/manager': Tech Stories
---

Remove the feature flag and tracking events used for A/B testing in the API CLI Tools modal, and update the DX Tools modal button copy to 'View Code Snippets ([#11156](https://github.com/linode/manager/pull/11156))
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ import { ui } from 'support/ui';

import { randomLabel, randomString } from 'support/util/random';
import { linodeCreatePage } from 'support/ui/pages';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';

describe('Create Linode flow to validate code snippet modal', () => {
/*
* tests for create Linode flow to validate code snippet modal.
*/
// TODO Delete these mocks once `testdxtoolabexperiment` feature flag is retired.
beforeEach(() => {
mockAppendFeatureFlags({
testdxtoolabexperiment: 'Create using command line',
});
});

it(`view code snippets in create linode flow`, () => {
const linodeLabel = randomLabel();
const rootPass = randomString(32);
Expand All @@ -33,7 +27,7 @@ describe('Create Linode flow to validate code snippet modal', () => {

// View Code Snippets and confirm it's provisioned as expected.
ui.button
.findByTitle('Create using command line')
.findByTitle('View Code Snippets')
.should('be.visible')
.should('be.enabled')
.click();
Expand Down
24 changes: 1 addition & 23 deletions packages/manager/src/components/CodeBlock/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { useLDClient } from 'launchdarkly-react-client-sdk';
import React from 'react';

import { useFlags } from 'src/hooks/useFlags';
import { useIsAkamaiAccount } from 'src/hooks/useIsAkamaiAccount';
import { sendApiAwarenessClickEvent } from 'src/utilities/analytics/customEventAnalytics';

import {
Comment thread
mjac0bs marked this conversation as resolved.
Expand All @@ -22,32 +19,13 @@ export interface CodeBlockProps {
handleCopyIconClick?: () => void;
/** The command language */
language: SupportedLanguage;
ldTrackingKey?: string;
}

export const CodeBlock = (props: CodeBlockProps) => {
const flags = useFlags();
const ldClient = useLDClient();
const { isAkamaiAccount: isInternalAccount } = useIsAkamaiAccount();

const {
command,
commandType,
handleCopyIconClick,
language,
ldTrackingKey,
} = props;

const apicliButtonCopy = flags?.testdxtoolabexperiment;
const { command, commandType, handleCopyIconClick, language } = props;

const _handleCopyIconClick = () => {
sendApiAwarenessClickEvent('Copy Icon', commandType);
if (ldTrackingKey && !isInternalAccount) {
ldClient?.track(ldTrackingKey, {
variation: apicliButtonCopy,
});
ldClient?.flush();
}
};

return (
Expand Down
1 change: 0 additions & 1 deletion packages/manager/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export interface Flags {
taxCollectionBanner: TaxCollectionBanner;
taxId: BaseFeatureFlag;
taxes: Taxes;
testdxtoolabexperiment: string;
tpaProviders: Provider[];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ describe('Actions', () => {
expect(button).toHaveAttribute('type', 'submit');
expect(button).toBeEnabled();
});
it("should render a 'Create using command line' button", () => {
it("should render a ' View Code Snippets' button", () => {
const { getByText } = renderWithThemeAndHookFormContext({
component: <Actions />,
});

const button = getByText('Create Using Command Line').closest('button');
const button = getByText('View Code Snippets').closest('button');

expect(button).toBeVisible();
expect(button).toBeEnabled();
Expand Down
22 changes: 3 additions & 19 deletions packages/manager/src/features/Linodes/LinodeCreate/Actions.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { useLDClient } from 'launchdarkly-react-client-sdk';
import React, { useState } from 'react';
import { useFormContext } from 'react-hook-form';

import { Box } from 'src/components/Box';
import { Button } from 'src/components/Button/Button';
import { LD_DX_TOOLS_METRICS_KEYS } from 'src/constants';
import { useFlags } from 'src/hooks/useFlags';
import { useIsAkamaiAccount } from 'src/hooks/useIsAkamaiAccount';
import { useRestrictedGlobalGrantCheck } from 'src/hooks/useRestrictedGlobalGrantCheck';
import { sendApiAwarenessClickEvent } from 'src/utilities/analytics/customEventAnalytics';
import { sendLinodeCreateFormInputEvent } from 'src/utilities/analytics/formEventAnalytics';
Expand All @@ -21,15 +17,10 @@ import {
import type { LinodeCreateFormValues } from './utilities';

export const Actions = () => {
const flags = useFlags();
const ldClient = useLDClient();
const { params } = useLinodeCreateQueryParams();
const { isAkamaiAccount: isInternalAccount } = useIsAkamaiAccount();

const [isAPIAwarenessModalOpen, setIsAPIAwarenessModalOpen] = useState(false);

const apicliButtonCopy = flags?.testdxtoolabexperiment;

const {
formState,
getValues,
Expand All @@ -44,22 +35,15 @@ export const Actions = () => {
isLinodeCreateRestricted || 'firewallOverride' in formState.errors;

const onOpenAPIAwareness = async () => {
sendApiAwarenessClickEvent('Button', 'Create Using Command Line');
sendApiAwarenessClickEvent('Button', 'View Code Snippets');
sendLinodeCreateFormInputEvent({
createType: params.type ?? 'OS',
interaction: 'click',
label: apicliButtonCopy ?? 'Create Using Command Line',
label: 'View Code Snippets',
});
if (await trigger()) {
// If validation is successful, we open the dialog.
setIsAPIAwarenessModalOpen(true);
if (!isInternalAccount) {
ldClient?.track(LD_DX_TOOLS_METRICS_KEYS.OPEN_MODAL, {
variation: apicliButtonCopy,
});
}

ldClient?.flush();
} else {
scrollErrorIntoView(undefined, { behavior: 'smooth' });
}
Expand All @@ -68,7 +52,7 @@ export const Actions = () => {
return (
<Box sx={{ display: 'flex', gap: 1, justifyContent: 'flex-end' }}>
<Button buttonType="outlined" onClick={onOpenAPIAwareness}>
{apicliButtonCopy ?? 'Create Using Command Line'}
View Code Snippets
</Button>
<Button
buttonType="primary"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { useLDClient } from 'launchdarkly-react-client-sdk';
import React from 'react';

import { ResourceLinks } from 'src/components/EmptyLandingPageResources/ResourcesLinks';
import { Typography } from 'src/components/Typography';
import { LD_DX_TOOLS_METRICS_KEYS } from 'src/constants';
import { useFlags } from 'src/hooks/useFlags';
import { useIsAkamaiAccount } from 'src/hooks/useIsAkamaiAccount';

import type { ResourcesLinks } from 'src/components/EmptyLandingPageResources/ResourcesLinksTypes';

Expand Down Expand Up @@ -41,24 +37,6 @@ export const gettingStartedGuides: ResourcesLinks['links'] = [
];

export const AnsibleIntegrationResources = () => {
const ldClient = useLDClient();
const flags = useFlags();
const { isAkamaiAccount: isInternalAccount } = useIsAkamaiAccount();

const apicliButtonCopy = flags?.testdxtoolabexperiment;

const handleClick = () => {
if (!isInternalAccount) {
ldClient?.track(
LD_DX_TOOLS_METRICS_KEYS.INTEGRATION_ANSIBLE_RESOURCE_LINKS,
{
variation: apicliButtonCopy,
}
);
}

ldClient?.flush();
};
return (
<>
<Typography sx={(theme) => ({ mt: theme.spacing(2) })} variant="h3">
Expand All @@ -67,7 +45,6 @@ export const AnsibleIntegrationResources = () => {
<ResourceLinks
linkAnalyticsEvent={linkAnalyticsEvent}
links={gettingStartedGuides}
onClick={handleClick}
/>
</>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { styled } from '@mui/material/styles';
import { useLDClient } from 'launchdarkly-react-client-sdk';
import React, { useEffect } from 'react';
import { useHistory } from 'react-router-dom';

Expand All @@ -11,9 +10,6 @@ import { TabList } from 'src/components/Tabs/TabList';
import { TabPanels } from 'src/components/Tabs/TabPanels';
import { Tabs } from 'src/components/Tabs/Tabs';
import { Typography } from 'src/components/Typography';
import { LD_DX_TOOLS_METRICS_KEYS } from 'src/constants';
import { useFlags } from 'src/hooks/useFlags';
import { useIsAkamaiAccount } from 'src/hooks/useIsAkamaiAccount';
import { useInProgressEvents } from 'src/queries/events/events';
import { sendApiAwarenessClickEvent } from 'src/utilities/analytics/customEventAnalytics';

Expand Down Expand Up @@ -56,11 +52,8 @@ export const tabs = [
export const ApiAwarenessModal = (props: ApiAwarenessModalProps) => {
const { isOpen, onClose, payLoad } = props;

const flags = useFlags();
const ldClient = useLDClient();
const history = useHistory();
const { data: events } = useInProgressEvents();
const { isAkamaiAccount: isInternalAccount } = useIsAkamaiAccount();

const linodeCreationEvent = events?.find(
(event) =>
Expand All @@ -71,33 +64,10 @@ export const ApiAwarenessModal = (props: ApiAwarenessModalProps) => {

const isLinodeCreated = linodeCreationEvent !== undefined;

const apicliButtonCopy = flags?.testdxtoolabexperiment;

const handleTabChange = (index: number) => {
const { title, type } = tabs[index];
const { type } = tabs[index];

sendApiAwarenessClickEvent(`${type} Tab`, type);

const trackingKey =
type === 'INTEGRATIONS' && title !== 'SDKs'
? LD_DX_TOOLS_METRICS_KEYS.INTEGRATION_TAB_SELECTION
: type === 'API'
? LD_DX_TOOLS_METRICS_KEYS.CURL_TAB_SELECTION
: title === 'SDKs'
? LD_DX_TOOLS_METRICS_KEYS.SDK_TAB_SELECTION
: title === 'Linode CLI'
? LD_DX_TOOLS_METRICS_KEYS.LINODE_CLI_TAB_SELECTION
: undefined;

if (trackingKey) {
if (!isInternalAccount) {
ldClient?.track(trackingKey, {
variation: apicliButtonCopy,
});
}

ldClient?.flush();
}
};

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { useTheme } from '@mui/material/styles';
import { useLDClient } from 'launchdarkly-react-client-sdk';
import React, { useMemo } from 'react';

import { CodeBlock } from 'src/components/CodeBlock/CodeBlock';
import { Link } from 'src/components/Link';
import { SafeTabPanel } from 'src/components/Tabs/SafeTabPanel';
import { Typography } from 'src/components/Typography';
import { LD_DX_TOOLS_METRICS_KEYS } from 'src/constants';
import { useFlags } from 'src/hooks/useFlags';
import { useIsAkamaiAccount } from 'src/hooks/useIsAkamaiAccount';
import { sendApiAwarenessClickEvent } from 'src/utilities/analytics/customEventAnalytics';
import { generateCurlCommand } from 'src/utilities/codesnippets/generate-cURL';

Expand All @@ -21,29 +17,20 @@ export interface CurlTabPanelProps {
}

export const CurlTabPanel = ({ index, payLoad, title }: CurlTabPanelProps) => {
const flags = useFlags();
const ldClient = useLDClient();
const theme = useTheme();
const { isAkamaiAccount: isInternalAccount } = useIsAkamaiAccount();

const curlCommand = useMemo(
() => generateCurlCommand(payLoad, '/linode/instances'),
[payLoad]
);
const apicliButtonCopy = flags?.testdxtoolabexperiment;

return (
<SafeTabPanel index={index}>
<Typography sx={{ marginTop: theme.spacing(2) }} variant="body1">
Most Linode API requests need to be authenticated with a valid{' '}
<Link
onClick={() => {
sendApiAwarenessClickEvent('link', 'personal access token');
if (!isInternalAccount) {
ldClient?.track(LD_DX_TOOLS_METRICS_KEYS.CURL_RESOURCE_LINKS, {
variation: apicliButtonCopy,
});
}

ldClient?.flush();
}}
to="/profile/tokens"
>
Expand All @@ -57,13 +44,6 @@ export const CurlTabPanel = ({ index, payLoad, title }: CurlTabPanelProps) => {
'link',
'Get Started with the Linode API'
);
if (!isInternalAccount) {
ldClient?.track(LD_DX_TOOLS_METRICS_KEYS.CURL_RESOURCE_LINKS, {
variation: apicliButtonCopy,
});
}

ldClient?.flush();
}}
to="https://techdocs.akamai.com/linode-api/reference/get-started"
>
Expand All @@ -73,26 +53,14 @@ export const CurlTabPanel = ({ index, payLoad, title }: CurlTabPanelProps) => {
<Link
onClick={() => {
sendApiAwarenessClickEvent('link', 'Linode API Guides');
if (!isInternalAccount) {
ldClient?.track(LD_DX_TOOLS_METRICS_KEYS.CURL_RESOURCE_LINKS, {
variation: apicliButtonCopy,
});
}

ldClient?.flush();
}}
to="https://techdocs.akamai.com/linode-api/reference/api"
>
Linode API Guides
</Link>
.
</Typography>
<CodeBlock
command={curlCommand}
commandType={title}
language={'bash'}
ldTrackingKey={LD_DX_TOOLS_METRICS_KEYS.CURL_CODE_SNIPPET}
/>
<CodeBlock command={curlCommand} commandType={title} language={'bash'} />
</SafeTabPanel>
);
};
Loading