From 3e92d28cf40a47d8e1c947ad77a90cd2c5a5e1c7 Mon Sep 17 00:00:00 2001 From: Allison Suarez Miranda Date: Tue, 14 Mar 2023 13:59:45 -0700 Subject: [PATCH 1/3] feat: add programmatic descriptions to feature details page Signed-off-by: Allison Suarez Miranda --- .../static/js/ducks/feature/reducer.ts | 2 +- .../static/js/fixtures/globalState.ts | 2 +- .../static/js/fixtures/metadata/feature.ts | 2 +- .../static/js/interfaces/Feature.ts | 8 ++++- .../static/js/pages/FeaturePage/index.tsx | 30 ++++++++++++++++++- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/frontend/amundsen_application/static/js/ducks/feature/reducer.ts b/frontend/amundsen_application/static/js/ducks/feature/reducer.ts index f5642ce3fc..ddf490e79f 100644 --- a/frontend/amundsen_application/static/js/ducks/feature/reducer.ts +++ b/frontend/amundsen_application/static/js/ducks/feature/reducer.ts @@ -296,7 +296,7 @@ export const initialFeatureState: FeatureMetadata = { badges: [], owner_tags: [], tags: [], - programmatic_descriptions: [], + programmatic_descriptions: {}, watermarks: [], stats: [], last_updated_timestamp: 0, diff --git a/frontend/amundsen_application/static/js/fixtures/globalState.ts b/frontend/amundsen_application/static/js/fixtures/globalState.ts index a8abe2c97b..02041b84bd 100644 --- a/frontend/amundsen_application/static/js/fixtures/globalState.ts +++ b/frontend/amundsen_application/static/js/fixtures/globalState.ts @@ -94,7 +94,7 @@ const globalState: GlobalState = { badges: [], owner_tags: [], tags: [], - programmatic_descriptions: [], + programmatic_descriptions: {}, watermarks: [], stats: [], last_updated_timestamp: 0, diff --git a/frontend/amundsen_application/static/js/fixtures/metadata/feature.ts b/frontend/amundsen_application/static/js/fixtures/metadata/feature.ts index 78bcf6705d..9accd58981 100644 --- a/frontend/amundsen_application/static/js/fixtures/metadata/feature.ts +++ b/frontend/amundsen_application/static/js/fixtures/metadata/feature.ts @@ -26,7 +26,7 @@ export const featureMetadata = { name: 'test_feature_name', owners: [], partition_column: 'ds', - programmatic_descriptions: [], + programmatic_descriptions: {}, status: 'active', stats: [], tags: [], diff --git a/frontend/amundsen_application/static/js/interfaces/Feature.ts b/frontend/amundsen_application/static/js/interfaces/Feature.ts index 940fda7f46..fbfd44d486 100644 --- a/frontend/amundsen_application/static/js/interfaces/Feature.ts +++ b/frontend/amundsen_application/static/js/interfaces/Feature.ts @@ -20,7 +20,7 @@ export interface FeatureMetadata { badges: Badge[]; owner_tags?: Tag[]; tags: Tag[]; - programmatic_descriptions: ProgrammaticDescription[]; + programmatic_descriptions: ProgrammaticDescriptions; watermarks: FeatureWatermark[]; stats: FeatureStats[]; last_updated_timestamp: number; @@ -28,6 +28,12 @@ export interface FeatureMetadata { partition_column?: string; } +export interface ProgrammaticDescriptions { + left?: ProgrammaticDescription[]; + right?: ProgrammaticDescription[]; + other?: ProgrammaticDescription[]; +} + // TODO - duplicated with FeatureResource in Resources.ts. Might delete this. export interface FeatureSummary { key: string; diff --git a/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx b/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx index ec984a9ac3..4e739b5133 100644 --- a/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx +++ b/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx @@ -45,7 +45,8 @@ import { setUrlParam, } from 'utils/navigationUtils'; import { formatDateTimeShort } from 'utils/dateUtils'; - +import { ProgrammaticDescription } from 'interfaces'; +import EditableText from 'components/EditableText'; import FeatureDescEditableText from './FeatureDescEditableText'; import FeatureOwnerEditor from './FeatureOwnerEditor'; import { GenerationCode } from './GenerationCode'; @@ -172,6 +173,24 @@ export const FeaturePageLoader: React.FC = () => ( ); +export function renderProgrammaticDesc (descriptions: ProgrammaticDescription[] | undefined) { + if (!descriptions) { + return null; + } + + return descriptions.map((d) => ( + + + + )); +}; + + export function renderTabs(featureCode, featureLineage, preview) { const defaultTab = getUrlParam(TAB_URL_PARAM) || FEATURE_TAB.PREVIEW_DATA; const tabInfo: TabInfo[] = []; @@ -331,6 +350,9 @@ export const FeaturePage: React.FC = ({ uriKey={feature.key} /> + {renderProgrammaticDesc( + feature.programmatic_descriptions.left + )}
@@ -354,7 +376,13 @@ export const FeaturePage: React.FC = ({ {feature.feature_group}
+ {renderProgrammaticDesc( + feature.programmatic_descriptions.right + )} + {renderProgrammaticDesc( + feature.programmatic_descriptions.other + )}
From 4337097db3e53b474121fbf664d91294fea69e85 Mon Sep 17 00:00:00 2001 From: Allison Suarez Miranda Date: Tue, 14 Mar 2023 15:01:06 -0700 Subject: [PATCH 2/3] feedback and lint Signed-off-by: Allison Suarez Miranda --- .../static/js/pages/FeaturePage/constants.ts | 2 ++ .../static/js/pages/FeaturePage/index.tsx | 23 ++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/frontend/amundsen_application/static/js/pages/FeaturePage/constants.ts b/frontend/amundsen_application/static/js/pages/FeaturePage/constants.ts index 159f51b9c2..cbc8071753 100644 --- a/frontend/amundsen_application/static/js/pages/FeaturePage/constants.ts +++ b/frontend/amundsen_application/static/js/pages/FeaturePage/constants.ts @@ -18,6 +18,8 @@ export const GEN_CODE_TAB_TITLE = 'Generation Code'; export const STATS_TAB_TITLE = 'Statistics'; export const UPSTREAM_TAB_TITLE = 'Upstream'; +export const DESCRIPTION_MAX_LENGTH = 999999; + export enum FEATURE_TAB { PREVIEW_DATA = 'data_sample', GEN_CODE = 'generation_code', diff --git a/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx b/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx index 4e739b5133..386025857a 100644 --- a/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx +++ b/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx @@ -66,6 +66,7 @@ import { TAG_TITLE, VERSION_TITLE, UPSTREAM_TAB_TITLE, + DESCRIPTION_MAX_LENGTH, } from './constants'; import './styles.scss'; @@ -173,7 +174,9 @@ export const FeaturePageLoader: React.FC = () => ( ); -export function renderProgrammaticDesc (descriptions: ProgrammaticDescription[] | undefined) { +export function renderProgrammaticDesc ( + descriptions: ProgrammaticDescription[] | undefined + ) { if (!descriptions) { return null; } @@ -181,14 +184,14 @@ export function renderProgrammaticDesc (descriptions: ProgrammaticDescription[] return descriptions.map((d) => ( - )); -}; + ) +)}; export function renderTabs(featureCode, featureLineage, preview) { @@ -350,9 +353,7 @@ export const FeaturePage: React.FC = ({ uriKey={feature.key} /> - {renderProgrammaticDesc( - feature.programmatic_descriptions.left - )} + {renderProgrammaticDesc(feature.programmatic_descriptions.left)}
@@ -376,13 +377,9 @@ export const FeaturePage: React.FC = ({ {feature.feature_group}
- {renderProgrammaticDesc( - feature.programmatic_descriptions.right - )} + {renderProgrammaticDesc(feature.programmatic_descriptions.right)} - {renderProgrammaticDesc( - feature.programmatic_descriptions.other - )} + {renderProgrammaticDesc(feature.programmatic_descriptions.other)}
From c68dd536d37f1b508f2e23862e7c51f0f76c6650 Mon Sep 17 00:00:00 2001 From: Allison Suarez Miranda Date: Tue, 14 Mar 2023 15:13:40 -0700 Subject: [PATCH 3/3] fix lint Signed-off-by: Allison Suarez Miranda --- .../static/js/pages/FeaturePage/index.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx b/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx index 386025857a..d06c2da02c 100644 --- a/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx +++ b/frontend/amundsen_application/static/js/pages/FeaturePage/index.tsx @@ -174,9 +174,9 @@ export const FeaturePageLoader: React.FC = () => ( ); -export function renderProgrammaticDesc ( - descriptions: ProgrammaticDescription[] | undefined - ) { +export function renderProgrammaticDesc( + descriptions: ProgrammaticDescription[] | undefined +) { if (!descriptions) { return null; } @@ -190,9 +190,8 @@ export function renderProgrammaticDesc ( allowDangerousHtml /> - ) -)}; - + )); +} export function renderTabs(featureCode, featureLineage, preview) { const defaultTab = getUrlParam(TAB_URL_PARAM) || FEATURE_TAB.PREVIEW_DATA;