diff --git a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/CertifiedIconWithTooltip.tsx b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/CertifiedIconWithTooltip.tsx new file mode 100644 index 000000000000..bb3a6c056ce8 --- /dev/null +++ b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/CertifiedIconWithTooltip.tsx @@ -0,0 +1,67 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { t } from '@superset-ui/translation'; +import { supersetTheme } from '@superset-ui/style'; +import { Tooltip, OverlayTrigger } from 'react-bootstrap'; +import { kebabCase } from 'lodash'; + +const tooltipStyle: React.CSSProperties = { wordWrap: 'break-word' }; + +interface CertifiedIconWithTooltipProps { + certifiedBy?: string | null; + details?: string | null; + metricName: string; +} + +function CertifiedIconWithTooltip({ + certifiedBy, + details, + metricName, +}: CertifiedIconWithTooltipProps) { + return ( + + {certifiedBy &&
{t('Certified by %s', certifiedBy)}
} +
{details}
+ + } + > + {/* TODO: move Icons to superset-ui to remove duplicated icon code here */} + + + + + +
+ ); +} + +export default CertifiedIconWithTooltip; diff --git a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/MetricOption.tsx b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/MetricOption.tsx index df00f24db43a..efddde0afd96 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/MetricOption.tsx +++ b/superset-frontend/temporary_superset_ui/superset-ui/packages/superset-ui-chart-controls/src/components/MetricOption.tsx @@ -16,21 +16,33 @@ * specific language governing permissions and limitations * under the License. */ +/* eslint-disable camelcase */ import React from 'react'; +import styled from '@superset-ui/style'; import InfoTooltipWithTrigger from './InfoTooltipWithTrigger'; import { ColumnTypeLabel } from './ColumnTypeLabel'; +import CertifiedIconWithTooltip from './CertifiedIconWithTooltip'; + +const FlexRowContainer = styled.div` + align-items: center; + display: flex; + + > svg { + margin-right: ${({ theme }) => theme.gridUnit}px; + } +`; export interface MetricOptionProps { metric: { - // eslint-disable-next-line camelcase verbose_name: string; - // eslint-disable-next-line camelcase metric_name: string; label: string; description: string; - // eslint-disable-next-line camelcase warning_text: string; expression: string; + is_certified?: boolean; + certified_by?: string | null; + certification_details?: string | null; }; openInNewWindow: boolean; showFormula: boolean; @@ -54,8 +66,15 @@ export function MetricOption({ verbose ); return ( -
+ {showType && } + {metric.is_certified && ( + + )} {link} {metric.description && ( )} -
+ ); }