Skip to content

Commit

Permalink
schemaTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Mar 4, 2020
1 parent dec4ac9 commit 338dbf6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('DefaultEditorAgg component', () => {
isLastBucket: false,
isRemovable: false,
metricAggs: [],
state: {} as VisState,
state: { params: {} } as VisState,
setAggParamValue,
setStateParamValue,
onAggTypeChange: () => {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { DefaultEditorAggCommonProps } from './agg_common_props';
import { AGGS_ACTION_KEYS, AggsAction } from './agg_group_state';
import { RowsOrColumnsControl } from './controls/rows_or_columns';
import { RadiusRatioOptionControl } from './controls/radius_ratio_option';
import { getSchemaByName } from '../schemas';

export interface DefaultEditorAggProps extends DefaultEditorAggCommonProps {
agg: IAggConfig;
Expand Down Expand Up @@ -256,10 +257,10 @@ function DefaultEditorAgg({
</div>
);
};

const schemaTitle = getSchemaByName(schemas, agg.schema).title;
const buttonContent = (
<>
{agg.schema} {showDescription && <span>{aggDescription}</span>}
{schemaTitle || agg.schema} {showDescription && <span>{aggDescription}</span>}
</>
);

Expand All @@ -273,7 +274,7 @@ function DefaultEditorAgg({
className="visEditorSidebar__section visEditorSidebar__collapsible visEditorSidebar__collapsible--marginBottom"
aria-label={i18n.translate('visDefaultEditor.agg.toggleEditorButtonAriaLabel', {
defaultMessage: 'Toggle {schema} editor',
values: { schema: agg.schema },
values: { schema: schemaTitle || agg.schema },
})}
data-test-subj={`visEditorAggAccordion${agg.id}`}
extraAction={renderAggButtons()}
Expand Down

0 comments on commit 338dbf6

Please sign in to comment.