Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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": Upcoming Features
---

Private Image Sharing: properly tag Images search bar and docs links for Pendo ([#13543](https://github.com/linode/manager/pull/13543))
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export interface DebouncedSearchProps extends TextFieldProps {
* Function to perform when searching for query
*/
onSearch: (query: string) => void;
/**
* Value for data-pendo-id attribute for search input, used for analytics tracking.
*/
pendoId?: string;
/**
* Placeholder text for the input.
*/
Expand All @@ -68,6 +72,7 @@ export const DebouncedSearchTextField = React.memo(
isSearching,
label,
onSearch,
pendoId,
placeholder,
value,
...restOfTextFieldProps
Expand Down Expand Up @@ -111,6 +116,7 @@ export const DebouncedSearchTextField = React.memo(
return (
<TextField
className={className}
data-pendo-id={pendoId}
data-qa-debounced-search
defaultValue={defaultValue}
hideLabel={hideLabel}
Expand Down
7 changes: 5 additions & 2 deletions packages/manager/src/components/DocsLink/DocsLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Link } from 'src/components/Link';
import { sendHelpButtonClickEvent } from 'src/utilities/analytics/customEventAnalytics';

export interface DocsLinkProps {
/** The label to use for analytics purposes */
/** DEPRECATED: The label to use for Adobe Analytics purposes */
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I considered just repurposing this prop, but it is used in other places in the code currently, and I didn't want junk data being sent to Pendo.

analyticsLabel?: string;
/** The URL to link to */
href: string;
Expand All @@ -20,6 +20,8 @@ export interface DocsLinkProps {
label?: string;
/** A callback function when the link is clicked */
onClick?: () => void;
/** The Pendo ID to use for tracking purposes */
pendoId?: string;
}

/**
Expand All @@ -28,7 +30,7 @@ export interface DocsLinkProps {
* - Consider displaying the title of a key guide or product document as the link instead of the generic β€œDocs”.
*/
export const DocsLink = (props: DocsLinkProps) => {
const { analyticsLabel, href, label, onClick, icon } = props;
const { analyticsLabel, href, label, onClick, icon, pendoId } = props;

return (
<StyledDocsLink
Expand All @@ -40,6 +42,7 @@ export const DocsLink = (props: DocsLinkProps) => {
onClick();
}
}}
pendoId={pendoId}
to={href}
>
{icon ?? <DocsIcon />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ export const ImagesTable = (props: ImagesTableProps) => {
>
{headerProps.docsLink && (
<DocsLink
analyticsLabel={headerProps.title}
data-pendo-id={headerProps.docsLink.dataPendoId}
href={headerProps.docsLink.href}
label={headerProps.docsLink.label}
pendoId={headerProps.docsLink.dataPendoId}
/>
)}
{headerProps.buttonProps && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export const ImagesView = (props: Props) => {
isSearching={imagesIsFetching}
label="Search"
onSearch={onSearch}
pendoId={config.searchBarPendoId}
placeholder="Search Images"
value={search.query ?? ''}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
MANUAL_IMAGES_DEFAULT_ORDER,
MANUAL_IMAGES_DEFAULT_ORDER_BY,
MANUAL_IMAGES_PREFERENCE_KEY,
OWNED_BY_ME_IMAGES_TAB_PENDO_IDS,
RECOVERY_IMAGES_TAB_PENDO_IDS,
SHARED_IMAGES_DEFAULT_ORDER,
SHARED_IMAGES_DEFAULT_ORDER_BY,
SHARED_IMAGES_PREFERENCE_KEY,
Expand Down Expand Up @@ -54,6 +56,7 @@ export interface ImageConfig {
orderByDefault: string;
orderDefault: 'asc' | 'desc';
preferenceKey: string;
searchBarPendoId: string;
title: string;
type: Image['type'];
}
Expand Down Expand Up @@ -160,6 +163,7 @@ export const IMAGES_CONFIG: Record<ImageLibraryType, ImageConfig> = {
instruction:
'Click \u2018Create Image\u2019 to create your first custom image',
},
searchBarPendoId: OWNED_BY_ME_IMAGES_TAB_PENDO_IDS.searchImagesBar,
},
'recovery-images': {
title: 'Recovery images',
Expand All @@ -179,7 +183,9 @@ export const IMAGES_CONFIG: Record<ImageLibraryType, ImageConfig> = {
emptyMessage: {
main: 'No recovery images to display',
},
searchBarPendoId: RECOVERY_IMAGES_TAB_PENDO_IDS.searchImagesBar,
docsLink: {
dataPendoId: RECOVERY_IMAGES_TAB_PENDO_IDS.recoverDeletedLinodeDocsLink,
label: 'Recover a deleted Linode',
href: 'https://techdocs.akamai.com/cloud-computing/docs/images#recover-a-deleted',
},
Expand Down Expand Up @@ -225,5 +231,6 @@ export const IMAGES_CONFIG: Record<ImageLibraryType, ImageConfig> = {
href: 'https://techdocs.akamai.com/cloud-computing/docs/image-sharing',
dataPendoId: SHARED_WITH_ME_IMAGES_TAB_PENDO_IDS.imageSharingDocsLink,
},
searchBarPendoId: SHARED_WITH_ME_IMAGES_TAB_PENDO_IDS.searchImagesBar,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export const ShareGroupsTable = (props: ShareGroupsTableProps) => {
>
{headerProps.docsLink && (
<DocsLink
analyticsLabel={headerProps.title}
href={headerProps.docsLink.href}
label={headerProps.docsLink.label}
pendoId={headerProps.docsLink.pendoId}
/>
)}
{headerProps.buttonProps && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const ShareGroupsView = (props: Props) => {
isSearching={shareGroupsIsFetching}
label="Search"
onSearch={onSearch}
pendoId={config.searchFieldPendoId}
placeholder="Search share groups"
value={search.query ?? ''}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';

import { SHARE_GROUPS_OWNED_TAB_PENDO_IDS } from 'src/features/Images/constants';

import type { APIError } from '@linode/api-v4';
import type { HiddenProps } from '@linode/ui';
import type { ImageSubTab, ShareGroupsType } from 'src/features/Images/utils';
Expand Down Expand Up @@ -123,7 +125,7 @@ export const SHAREGROUPS_CONFIG: Record<
docsLink: {
href: `https://techdocs.akamai.com/cloud-computing/docs/image-sharing`,
label: 'Image sharing',
pendoId: 'Images Groups Owned-Docs Link',
pendoId: SHARE_GROUPS_OWNED_TAB_PENDO_IDS.imageSharingDocsLink,
},
columns: OWNED_GROUPS_TABLE_COLUMNS,
emptyMessage: {
Expand All @@ -138,9 +140,9 @@ export const SHAREGROUPS_CONFIG: Record<
buttonText: 'Create Share Group',
navigateTo: '/images/share-groups/create',
disabledToolTipText: 'You do not have permissions to create share groups',
pendoId: 'Images Groups Owned-Create Button',
pendoId: SHARE_GROUPS_OWNED_TAB_PENDO_IDS.createButton,
},
searchFieldPendoId: 'Images Groups Owned-Search',
searchFieldPendoId: SHARE_GROUPS_OWNED_TAB_PENDO_IDS.searchShareGroupsBar,
},
'joined-groups': {
title: 'Joined groups',
Expand Down
16 changes: 16 additions & 0 deletions packages/manager/src/features/Images/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export const SHARED_IMAGES_DEFAULT_ORDER_BY = 'label';
export const SHARE_GROUP_COLUMN_HEADER_TOOLTIP =
"Displays the share group for images shared with you; your custom images don't display a group name.";

// Pendo IDs for the Images Landing sub-tabs
export const OWNED_BY_ME_IMAGES_TAB_PENDO_IDS = {
searchImagesBar: 'Images Library Owned-Search',
};

export const SHARED_WITH_ME_IMAGES_TAB_PENDO_IDS = {
searchImagesBar: 'Images Library Shared-Search',
imageSharingDocsLink: 'Images Library Shared-Docs',
Expand All @@ -32,3 +37,14 @@ export const SHARED_WITH_ME_IMAGES_TAB_PENDO_IDS = {
rebuildLinode: 'Images Library Shared-Rebuild an Existing Linode',
},
};

export const RECOVERY_IMAGES_TAB_PENDO_IDS = {
searchImagesBar: 'Images Library Recovery-Search',
recoverDeletedLinodeDocsLink: 'Images Library Recovery-Docs',
};

export const SHARE_GROUPS_OWNED_TAB_PENDO_IDS = {
createButton: 'Images Groups Owned-Create Button',
imageSharingDocsLink: 'Images Groups Owned-Image sharing docs',
searchShareGroupsBar: 'Images Groups Owned-Search',
};
Loading