Skip to content

Commit

Permalink
[CORE-196] Refactor feedbackURL and articleURL in feature preview log…
Browse files Browse the repository at this point in the history
…ic (#5224)
  • Loading branch information
samanehsan authored Jan 27, 2025
1 parent f24ac07 commit 84c6873
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
25 changes: 4 additions & 21 deletions src/libs/feature-previews-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ export type FeaturePreview = {
* Optional date string for the last updated date. Shown on the feature previews page.
*/
readonly lastUpdated?: string;

/**
* Optional URL for an article about the feature. Shown on the feature previews page.
*/
readonly articleUrl?: string;
};

const featurePreviewsConfig: readonly FeaturePreview[] = [
Expand Down Expand Up @@ -99,11 +94,8 @@ const featurePreviewsConfig: readonly FeaturePreview[] = [
title: 'Terra Workflow Repository Improvements',
description:
'Enabling this feature will allow creating and editing workflows with the built-in Terra Workflow Repository UI. This replaces the external Broad Methods Repository. Changes made in Terra are reflected in the external Broad Methods Repository, and vice-versa.',
feedbackUrl: `mailto:[email protected]?subject=${encodeURIComponent(
'Feedback on Terra Workflow Repository Improvements'
)}`,
feedbackUrl: 'https://support.terra.bio/hc/en-us/articles/31191238873243',
lastUpdated: '1/7/2025',
articleUrl: 'https://support.terra.bio/hc/en-us/articles/31191238873243',
},
{
id: COHORT_BUILDER_CARD,
Expand All @@ -121,34 +113,25 @@ const featurePreviewsConfig: readonly FeaturePreview[] = [
title: 'Improved Spend Reports',
description:
'Enabling this feature will show billing project owners costs associated with all workspaces in billing projects with spend reporting enabled. Additional updates to spend reports coming soon!',
feedbackUrl: `mailto:[email protected]?subject=${encodeURIComponent(
'Feedback on Improved Spend Reports'
)}`,
feedbackUrl: 'https://support.terra.bio/hc/en-us/articles/31182586327323',
lastUpdated: '01/17/2025',
articleUrl: 'https://support.terra.bio/hc/en-us/articles/31182586327323',
},
{
id: AUTO_GENERATE_DATA_TABLES,
title: 'Autogenerate data table for single and paired end sequencing',
description:
'Enabling this feature will show a new option in the data uploader to autogenerate a data table instead of uploading your own TSV. This feature will attempt to automatch known file patterns for single and paired end sequencing and autogenerate a data table linking to those files.',
feedbackUrl: `mailto:[email protected]?subject=${encodeURIComponent(
'Feedback on Autogenerate data table for single and paired end sequencing'
)}`,
feedbackUrl: 'https://support.terra.bio/hc/en-us/articles/31258673632923',
lastUpdated: '11/26/2024',
articleUrl: 'https://support.terra.bio/hc/en-us/articles/31258673632923',
},
{
id: PREVIEW_COST_CAPPING,
title: 'Workflow Cost Capping',
description:
'Enabling this feature will show a new workflow configuration option to add a user-configurable cost cap to the workflow. Workflows will be terminated once they exceed the configured value.',
groups: ['preview-cost-capping'],
feedbackUrl: `mailto:[email protected]?subject=${encodeURIComponent(
'Feedback on Workflow Cost Capping'
)}`,
feedbackUrl: 'https://support.terra.bio/hc/en-us/articles/31269696049307',
lastUpdated: '12/6/2024',
articleUrl: 'https://support.terra.bio/hc/en-us/articles/31269696049307',
},
{
id: GCP_BATCH,
Expand Down
8 changes: 3 additions & 5 deletions src/pages/FeaturePreviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const FeaturePreviews = () => {
field: 'description',
headerRenderer: () => span({ style: { fontWeight: 'bold' } }, ['Description']),
cellRenderer: ({ rowIndex }) => {
const { title, description, documentationUrl, feedbackUrl, groups, articleUrl } = featurePreviews[rowIndex];
const { title, description, documentationUrl, feedbackUrl, groups } = featurePreviews[rowIndex];
const isPrivate = !_.isEmpty(groups);
const privateText = 'This feature is in Private Preview and is only visible to you.';
const privateIcon = Icon({
Expand All @@ -111,13 +111,11 @@ export const FeaturePreviews = () => {
return div([
p({ style: { fontWeight: 600, margin: '0.5rem 0 0.5rem' } }, [isPrivate && privateIcon, title]),
p({ style: { margin: '0.5rem 0' } }, [description]),
!!(documentationUrl || feedbackUrl || articleUrl) &&
!!(documentationUrl || feedbackUrl) &&
p({ style: { margin: '0.5rem 0' } }, [
documentationUrl && h(Link, { ...Utils.newTabLinkProps, href: documentationUrl }, ['Documentation']),
!!(documentationUrl && feedbackUrl) && ' | ',
articleUrl
? h(Link, { ...Utils.newTabLinkProps, href: articleUrl }, ['Learn more and provide feedback'])
: feedbackUrl && h(Link, { ...Utils.newTabLinkProps, href: feedbackUrl }, ['Submit feedback']),
feedbackUrl && h(Link, { ...Utils.newTabLinkProps, href: feedbackUrl }, ['Learn more and provide feedback']),
]),
]);
},
Expand Down
16 changes: 1 addition & 15 deletions src/pages/FeaturePreviews.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('FeaturePreviews', () => {
id: 'feature1',
title: 'Feature #1',
description: 'A new feature',
articleUrl: 'https://example.com/article',
documentationUrl: 'https://example.com/feature-1-docs',
lastUpdated: '2024-11-01',
},
Expand Down Expand Up @@ -92,24 +91,11 @@ describe('FeaturePreviews', () => {

it('should render feedback link if provided', () => {
const { getAllByText } = render(h(FeaturePreviews));
const feedbackLinks = getAllByText('Submit feedback');
const feedbackLinks = getAllByText('Learn more and provide feedback');
expect(feedbackLinks.length).toBe(1);
expect(feedbackLinks[0].getAttribute('href')).toBe('mailto:[email protected]');
});

it('displays the correct link based on articleUrl', async () => {
const { getByRole } = render(h(FeaturePreviews));

const link1 = getByRole('link', { name: 'Learn more and provide feedback' });
expect(link1).toHaveAttribute('href', 'https://example.com/article');

const link2 = getByRole('link', { name: 'Documentation' });
expect(link2).toHaveAttribute('href', 'https://example.com/feature-1-docs');

const link3 = getByRole('link', { name: 'Submit feedback' });
expect(link3).toHaveAttribute('href', 'mailto:[email protected]');
});

it('should render "Go to Workspaces List" link', () => {
const { getByRole } = render(h(FeaturePreviews));
const link = getByRole('link', { name: 'Go to Workspaces List' });
Expand Down

0 comments on commit 84c6873

Please sign in to comment.