mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
feat: add certification to metrics (#10630)
This commit is contained in:
@@ -28,6 +28,7 @@ import Label from 'src/components/Label';
|
||||
import Button from 'src/components/Button';
|
||||
import Loading from 'src/components/Loading';
|
||||
import TableSelector from 'src/components/TableSelector';
|
||||
import CertifiedIconWithTooltip from 'src/components/CertifiedIconWithTooltip';
|
||||
|
||||
import getClientErrorObject from '../utils/getClientErrorObject';
|
||||
import CheckboxControl from '../explore/components/controls/CheckboxControl';
|
||||
@@ -59,6 +60,15 @@ const DatasourceContainer = styled.div`
|
||||
}
|
||||
`;
|
||||
|
||||
const FlexRowContainer = styled.div`
|
||||
align-items: center;
|
||||
display: flex;
|
||||
|
||||
> svg {
|
||||
margin-right: ${({ theme }) => theme.gridUnit}px;
|
||||
}
|
||||
`;
|
||||
|
||||
const checkboxGenerator = (d, onChange) => (
|
||||
<CheckboxControl value={d} onChange={onChange} />
|
||||
);
|
||||
@@ -130,7 +140,7 @@ function ColumnCollectionTable({
|
||||
<Field
|
||||
fieldKey="python_date_format"
|
||||
label={t('Datetime Format')}
|
||||
descr={
|
||||
description={
|
||||
/* Note the fragmented translations may not work. */
|
||||
<div>
|
||||
{t('The pattern of timestamp format. For strings use ')}
|
||||
@@ -460,7 +470,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
handleError={this.props.addDangerToast}
|
||||
/>
|
||||
}
|
||||
descr={t(
|
||||
description={t(
|
||||
'The pointer to a physical table. Keep in mind that the chart is ' +
|
||||
'associated to this Superset logical table, and this logical table points ' +
|
||||
'the physical table referenced here.',
|
||||
@@ -477,7 +487,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="default_endpoint"
|
||||
label={t('Default URL')}
|
||||
descr={t(
|
||||
description={t(
|
||||
'Default URL to redirect to when accessing from the datasource list page',
|
||||
)}
|
||||
control={<TextControl />}
|
||||
@@ -485,14 +495,14 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="filter_select_enabled"
|
||||
label={t('Autocomplete filters')}
|
||||
descr={t('Whether to populate autocomplete filters options')}
|
||||
description={t('Whether to populate autocomplete filters options')}
|
||||
control={<CheckboxControl />}
|
||||
/>
|
||||
{this.state.isSqla && (
|
||||
<Field
|
||||
fieldKey="fetch_values_predicate"
|
||||
label={t('Autocomplete Query Predicate')}
|
||||
descr={t(
|
||||
description={t(
|
||||
'When using "Autocomplete filters", this can be used to improve performance ' +
|
||||
'of the query fetching the values. Use this option to apply a ' +
|
||||
'predicate (WHERE clause) to the query selecting the distinct ' +
|
||||
@@ -505,7 +515,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="owners"
|
||||
label={t('Owners')}
|
||||
descr={t('Owners of the datasource')}
|
||||
description={t('Owners of the datasource')}
|
||||
control={
|
||||
<SelectAsyncControl
|
||||
dataEndpoint="/users/api/read"
|
||||
@@ -536,7 +546,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="sql"
|
||||
label={t('SQL')}
|
||||
descr={t(
|
||||
description={t(
|
||||
'When specifying SQL, the datasource acts as a view. ' +
|
||||
'Superset will use this statement as a subquery while grouping and filtering ' +
|
||||
'on the generated parent queries.',
|
||||
@@ -550,7 +560,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="json"
|
||||
label={t('JSON')}
|
||||
descr={
|
||||
description={
|
||||
<div>{t('The JSON metric or post aggregation definition.')}</div>
|
||||
}
|
||||
control={
|
||||
@@ -561,7 +571,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="cache_timeout"
|
||||
label={t('Cache Timeout')}
|
||||
descr={t(
|
||||
description={t(
|
||||
'The duration of time in seconds before the cache is invalidated',
|
||||
)}
|
||||
control={<TextControl />}
|
||||
@@ -575,7 +585,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
<Field
|
||||
fieldKey="template_params"
|
||||
label={t('Template parameters')}
|
||||
descr={t(
|
||||
description={t(
|
||||
'A set of parameters that become available in the query using Jinja templating syntax',
|
||||
)}
|
||||
control={<TextControl />}
|
||||
@@ -642,7 +652,7 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
}}
|
||||
expandFieldset={
|
||||
<FormContainer>
|
||||
<Fieldset>
|
||||
<Fieldset compact>
|
||||
<Field
|
||||
fieldKey="verbose_name"
|
||||
label={t('Label')}
|
||||
@@ -666,6 +676,22 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
)}
|
||||
control={<TextControl placeholder={t('Warning Message')} />}
|
||||
/>
|
||||
<Field
|
||||
label={t('Certified By')}
|
||||
fieldKey="certified_by"
|
||||
description={t(
|
||||
'Person or group that has certified this metric',
|
||||
)}
|
||||
control={<TextControl placeholder={t('Certified By')} />}
|
||||
/>
|
||||
<Field
|
||||
label={t('Certification Details')}
|
||||
fieldKey="certification_details"
|
||||
description={t('Details of the certification')}
|
||||
control={
|
||||
<TextControl placeholder={t('Certification Details')} />
|
||||
}
|
||||
/>
|
||||
</Fieldset>
|
||||
</FormContainer>
|
||||
}
|
||||
@@ -678,8 +704,16 @@ export class DatasourceEditor extends React.PureComponent {
|
||||
expression: '',
|
||||
})}
|
||||
itemRenderers={{
|
||||
metric_name: (v, onChange) => (
|
||||
<EditableTitle canEdit title={v} onSaveTitle={onChange} />
|
||||
metric_name: (v, onChange, _, record) => (
|
||||
<FlexRowContainer>
|
||||
{record.is_certified && (
|
||||
<CertifiedIconWithTooltip
|
||||
certifiedBy={record.certified_by}
|
||||
details={record.certification_details}
|
||||
/>
|
||||
)}
|
||||
<EditableTitle canEdit title={v} onSaveTitle={onChange} />
|
||||
</FlexRowContainer>
|
||||
),
|
||||
verbose_name: (v, onChange) => (
|
||||
<EditableTitle canEdit title={v} onSaveTitle={onChange} />
|
||||
|
||||
Reference in New Issue
Block a user