diff --git a/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx index dd7ebb8bf9371..eb593be1607bc 100644 --- a/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx +++ b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx @@ -39,6 +39,15 @@ test('renders with certified by', async () => { expect(await screen.findByRole('tooltip')).toHaveTextContent(certifiedBy); }); +test('renders with multiple certified by values', async () => { + const certifiedBy = ['Trusted Authority', 'Other Authority']; + render(); + userEvent.hover(screen.getByRole('img')); + expect(await screen.findByRole('tooltip')).toHaveTextContent( + certifiedBy.join(', '), + ); +}); + test('renders with details', async () => { const details = 'All requirements have been met.'; render(); diff --git a/superset-frontend/src/components/CertifiedBadge/index.tsx b/superset-frontend/src/components/CertifiedBadge/index.tsx index 80581e6320d70..d2ef264c5dfb7 100644 --- a/superset-frontend/src/components/CertifiedBadge/index.tsx +++ b/superset-frontend/src/components/CertifiedBadge/index.tsx @@ -17,12 +17,12 @@ * under the License. */ import React from 'react'; -import { t, useTheme } from '@superset-ui/core'; +import { ensureIsArray, t, useTheme } from '@superset-ui/core'; import Icons, { IconType } from 'src/components/Icons'; import { Tooltip } from 'src/components/Tooltip'; export interface CertifiedBadgeProps { - certifiedBy?: string; + certifiedBy?: string | string[]; details?: string; size?: IconType['iconSize']; } @@ -41,7 +41,9 @@ function CertifiedBadge({ <> {certifiedBy && (
- {t('Certified by %s', certifiedBy)} + + {t('Certified by %s', ensureIsArray(certifiedBy).join(', '))} +
)}
{details}
diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx index 3354d9d42122a..cfc826da6aa71 100644 --- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx @@ -905,7 +905,7 @@ class DatasourceEditor extends React.PureComponent { description={t( 'Extra data to specify table metadata. Currently supports ' + 'metadata of the format: `{ "certification": { "certified_by": ' + - '"Data Platform Team", "details": "This table is the source of truth." ' + + '["Data Platform Team", "Engineering Team"], "details": "This table is the source of truth." ' + '}, "warning_markdown": "This is a warning." }`.', )} control={ diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py index 47e5f216d5647..c7b0271123924 100644 --- a/superset/connectors/sqla/views.py +++ b/superset/connectors/sqla/views.py @@ -144,7 +144,7 @@ class TableColumnInlineView( "extra": utils.markdown( "Extra data to specify column metadata. Currently supports " 'certification data of the format: `{ "certification": "certified_by": ' - '"Taylor Swift", "details": "This column is the source of truth." ' + '["Taylor Swift", "Harry Styles"], "details": "This column is the source of truth." ' "} }`. This should be modified from the edit datasource model in " "Explore to ensure correct formatting.", True, @@ -236,7 +236,7 @@ class SqlMetricInlineView( "extra": utils.markdown( "Extra data to specify metric metadata. Currently supports " 'metadata of the format: `{ "certification": { "certified_by": ' - '"Data Platform Team", "details": "This metric is the source of truth." ' + '["Data Platform Team", "Engineering Team"], "details": "This metric is the source of truth." ' '}, "warning_markdown": "This is a warning." }`. This should be modified ' "from the edit datasource model in Explore to ensure correct formatting.", True, @@ -443,7 +443,7 @@ class TableModelView( # pylint: disable=too-many-ancestors "extra": utils.markdown( "Extra data to specify table metadata. Currently supports " 'metadata of the format: `{ "certification": { "certified_by": ' - '"Data Platform Team", "details": "This table is the source of truth." ' + '["Data Platform Team", "Engineering Team"], "details": "This table is the source of truth." ' '}, "warning_markdown": "This is a warning." }`.', True, ),