diff --git a/docs/static/resources/openapi.json b/docs/static/resources/openapi.json index 8077af91c1906..cf03bff32d104 100644 --- a/docs/static/resources/openapi.json +++ b/docs/static/resources/openapi.json @@ -345,7 +345,7 @@ "AnnotationLayerRestApi.get_list": { "properties": { "changed_by": { - "$ref": "#/components/schemas/AnnotationLayerRestApi.get_list.User" + "$ref": "#/components/schemas/AnnotationLayerRestApi.get_list.User1" }, "changed_on": { "format": "date-time", @@ -356,7 +356,7 @@ "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/AnnotationLayerRestApi.get_list.User1" + "$ref": "#/components/schemas/AnnotationLayerRestApi.get_list.User" }, "created_on": { "format": "date-time", @@ -502,13 +502,13 @@ "AnnotationRestApi.get_list": { "properties": { "changed_by": { - "$ref": "#/components/schemas/AnnotationRestApi.get_list.User" + "$ref": "#/components/schemas/AnnotationRestApi.get_list.User1" }, "changed_on_delta_humanized": { "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/AnnotationRestApi.get_list.User1" + "$ref": "#/components/schemas/AnnotationRestApi.get_list.User" }, "end_dttm": { "format": "date-time", @@ -1768,7 +1768,7 @@ "type": "string" }, "changed_by": { - "$ref": "#/components/schemas/ChartDataRestApi.get_list.User1" + "$ref": "#/components/schemas/ChartDataRestApi.get_list.User3" }, "changed_by_name": { "readOnly": true @@ -1783,7 +1783,7 @@ "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/ChartDataRestApi.get_list.User3" + "$ref": "#/components/schemas/ChartDataRestApi.get_list.User1" }, "created_on_delta_humanized": { "readOnly": true @@ -1830,10 +1830,10 @@ "type": "string" }, "last_saved_by": { - "$ref": "#/components/schemas/ChartDataRestApi.get_list.User" + "$ref": "#/components/schemas/ChartDataRestApi.get_list.User2" }, "owners": { - "$ref": "#/components/schemas/ChartDataRestApi.get_list.User2" + "$ref": "#/components/schemas/ChartDataRestApi.get_list.User" }, "params": { "nullable": true, @@ -1904,11 +1904,16 @@ "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, @@ -1918,6 +1923,10 @@ "maxLength": 64, "type": "string" }, + "id": { + "format": "int32", + "type": "integer" + }, "last_name": { "maxLength": 64, "type": "string" @@ -1942,16 +1951,11 @@ "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -1961,10 +1965,6 @@ "maxLength": 64, "type": "string" }, - "id": { - "format": "int32", - "type": "integer" - }, "last_name": { "maxLength": 64, "type": "string" @@ -2560,7 +2560,7 @@ "type": "string" }, "changed_by": { - "$ref": "#/components/schemas/ChartRestApi.get_list.User1" + "$ref": "#/components/schemas/ChartRestApi.get_list.User3" }, "changed_by_name": { "readOnly": true @@ -2575,7 +2575,7 @@ "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/ChartRestApi.get_list.User3" + "$ref": "#/components/schemas/ChartRestApi.get_list.User1" }, "created_on_delta_humanized": { "readOnly": true @@ -2622,10 +2622,10 @@ "type": "string" }, "last_saved_by": { - "$ref": "#/components/schemas/ChartRestApi.get_list.User" + "$ref": "#/components/schemas/ChartRestApi.get_list.User2" }, "owners": { - "$ref": "#/components/schemas/ChartRestApi.get_list.User2" + "$ref": "#/components/schemas/ChartRestApi.get_list.User" }, "params": { "nullable": true, @@ -2696,11 +2696,16 @@ "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, @@ -2710,6 +2715,10 @@ "maxLength": 64, "type": "string" }, + "id": { + "format": "int32", + "type": "integer" + }, "last_name": { "maxLength": 64, "type": "string" @@ -2734,16 +2743,11 @@ "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -2753,10 +2757,6 @@ "maxLength": 64, "type": "string" }, - "id": { - "format": "int32", - "type": "integer" - }, "last_name": { "maxLength": 64, "type": "string" @@ -3027,13 +3027,13 @@ "CssTemplateRestApi.get_list": { "properties": { "changed_by": { - "$ref": "#/components/schemas/CssTemplateRestApi.get_list.User" + "$ref": "#/components/schemas/CssTemplateRestApi.get_list.User1" }, "changed_on_delta_humanized": { "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/CssTemplateRestApi.get_list.User1" + "$ref": "#/components/schemas/CssTemplateRestApi.get_list.User" }, "created_on": { "format": "date-time", @@ -3400,7 +3400,7 @@ "type": "string" }, "changed_by": { - "$ref": "#/components/schemas/DashboardRestApi.get_list.User" + "$ref": "#/components/schemas/DashboardRestApi.get_list.User2" }, "changed_by_name": { "readOnly": true @@ -3415,7 +3415,7 @@ "readOnly": true }, "created_by": { - "$ref": "#/components/schemas/DashboardRestApi.get_list.User2" + "$ref": "#/components/schemas/DashboardRestApi.get_list.User1" }, "created_on_delta_humanized": { "readOnly": true @@ -3441,7 +3441,7 @@ "type": "string" }, "owners": { - "$ref": "#/components/schemas/DashboardRestApi.get_list.User1" + "$ref": "#/components/schemas/DashboardRestApi.get_list.User" }, "position_json": { "nullable": true, @@ -3489,6 +3489,10 @@ }, "DashboardRestApi.get_list.User": { "properties": { + "email": { + "maxLength": 64, + "type": "string" + }, "first_name": { "maxLength": 64, "type": "string" @@ -3507,6 +3511,7 @@ } }, "required": [ + "email", "first_name", "last_name", "username" @@ -3515,10 +3520,6 @@ }, "DashboardRestApi.get_list.User1": { "properties": { - "email": { - "maxLength": 64, - "type": "string" - }, "first_name": { "maxLength": 64, "type": "string" @@ -3530,17 +3531,11 @@ "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ - "email", "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -3557,11 +3552,16 @@ "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, @@ -4056,7 +4056,7 @@ "type": "boolean" }, "allow_run_async": { - "description": "Operate the database in asynchronous mode, meaning that the queries are executed on remote workers as opposed to on the web server itself. This assumes that you have a Celery worker setup as well as a results backend. Refer to the installation docs for more information.", + "description": "Operate the database in asynchronous mode, meaning that the queries are executed on remote workers as opposed to on the web server itself. This assumes that you have a Celery worker setup as well as a results backend. Refer to the installation docs for more information.", "type": "boolean" }, "cache_timeout": { @@ -4169,7 +4169,7 @@ "type": "boolean" }, "allow_run_async": { - "description": "Operate the database in asynchronous mode, meaning that the queries are executed on remote workers as opposed to on the web server itself. This assumes that you have a Celery worker setup as well as a results backend. Refer to the installation docs for more information.", + "description": "Operate the database in asynchronous mode, meaning that the queries are executed on remote workers as opposed to on the web server itself. This assumes that you have a Celery worker setup as well as a results backend. Refer to the installation docs for more information.", "type": "boolean" }, "cache_timeout": { @@ -4881,7 +4881,7 @@ "type": "integer" }, "changed_by": { - "$ref": "#/components/schemas/DatasetRestApi.get.User" + "$ref": "#/components/schemas/DatasetRestApi.get.User1" }, "changed_on": { "format": "date-time", @@ -4959,7 +4959,7 @@ "type": "integer" }, "owners": { - "$ref": "#/components/schemas/DatasetRestApi.get.User1" + "$ref": "#/components/schemas/DatasetRestApi.get.User" }, "schema": { "maxLength": 255, @@ -5156,14 +5156,23 @@ "maxLength": 64, "type": "string" }, + "id": { + "format": "int32", + "type": "integer" + }, "last_name": { "maxLength": 64, "type": "string" + }, + "username": { + "maxLength": 64, + "type": "string" } }, "required": [ "first_name", - "last_name" + "last_name", + "username" ], "type": "object" }, @@ -5173,23 +5182,14 @@ "maxLength": 64, "type": "string" }, - "id": { - "format": "int32", - "type": "integer" - }, "last_name": { "maxLength": 64, "type": "string" - }, - "username": { - "maxLength": 64, - "type": "string" } }, "required": [ "first_name", - "last_name", - "username" + "last_name" ], "type": "object" }, @@ -5606,6 +5606,29 @@ }, "type": "object" }, + "EstimateQueryCostSchema": { + "properties": { + "database_id": { + "format": "int32", + "type": "integer" + }, + "schema": { + "nullable": true, + "type": "string" + }, + "sql": { + "type": "string" + }, + "template_params": { + "type": "object" + } + }, + "required": [ + "database_id", + "sql" + ], + "type": "object" + }, "ExecutePayloadSchema": { "properties": { "client_id": { @@ -6933,7 +6956,7 @@ "type": "boolean" }, "changed_by": { - "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User" + "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User2" }, "changed_on": { "format": "date-time", @@ -6949,7 +6972,7 @@ "type": "integer" }, "created_by": { - "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User2" + "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User1" }, "created_on": { "format": "date-time", @@ -6999,7 +7022,7 @@ "type": "string" }, "owners": { - "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User1" + "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.User" }, "recipients": { "$ref": "#/components/schemas/ReportScheduleRestApi.get_list.ReportRecipients" @@ -7043,6 +7066,10 @@ "maxLength": 64, "type": "string" }, + "id": { + "format": "int32", + "type": "integer" + }, "last_name": { "maxLength": 64, "type": "string" @@ -7060,10 +7087,6 @@ "maxLength": 64, "type": "string" }, - "id": { - "format": "int32", - "type": "integer" - }, "last_name": { "maxLength": 64, "type": "string" @@ -16686,6 +16709,99 @@ ] } }, + "/api/v1/datasource/{datasource_type}/{datasource_id}/column/{column_name}/values/": { + "get": { + "parameters": [ + { + "description": "The type of datasource", + "in": "path", + "name": "datasource_type", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The id of the datasource", + "in": "path", + "name": "datasource_id", + "required": true, + "schema": { + "type": "integer" + } + }, + { + "description": "The name of the column to get values for", + "in": "path", + "name": "column_name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "result": { + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "object" + } + ] + }, + "type": "array" + } + }, + "type": "object" + } + } + }, + "description": "A List of distinct values for the column" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "500": { + "$ref": "#/components/responses/500" + } + }, + "security": [ + { + "jwt": [] + } + ], + "summary": "Get possible values for a datasource column", + "tags": [ + "Datasources" + ] + } + }, "/api/v1/embedded_dashboard/{uuid}": { "get": { "description": "Get a report schedule log", @@ -19738,6 +19854,62 @@ ] } }, + "/api/v1/sqllab/estimate/": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EstimateQueryCostSchema" + } + } + }, + "description": "SQL query and params", + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "properties": { + "result": { + "type": "object" + } + }, + "type": "object" + } + } + }, + "description": "Query estimation result" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401" + }, + "403": { + "$ref": "#/components/responses/403" + }, + "404": { + "$ref": "#/components/responses/404" + }, + "500": { + "$ref": "#/components/responses/500" + } + }, + "security": [ + { + "jwt": [] + } + ], + "summary": "Estimates the SQL query execution cost", + "tags": [ + "SQL Lab" + ] + } + }, "/api/v1/sqllab/execute/": { "post": { "description": "Starts the execution of a SQL query", diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx index b940375aa9eb7..ecdee5be1f28a 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx +++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/ColumnConfigControl/constants.tsx @@ -81,7 +81,7 @@ const columnWidth: ControlFormItemSpec<'InputNumber'> = { "Default minimal column width in pixels, actual width may still be larger than this if other columns don't need much space", ), width: 120, - placeholder: 'auto', + placeholder: t('auto'), debounceDelay: 400, validators: [validateNumber], }; diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js index 0417ea3e8b5af..d97557a77b506 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js +++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.js @@ -19,7 +19,7 @@ import PropTypes from 'prop-types'; import { extent as d3Extent, range as d3Range } from 'd3-array'; import { select as d3Select } from 'd3-selection'; -import { getSequentialSchemeRegistry } from '@superset-ui/core'; +import { getSequentialSchemeRegistry, t } from '@superset-ui/core'; import CalHeatMap from './vendor/cal-heatmap'; const propTypes = { @@ -85,10 +85,12 @@ function Calendar(element, props) { const metricsData = data.data; + const METRIC_TEXT = t('Metric'); + Object.keys(metricsData).forEach(metric => { const calContainer = div.append('div'); if (showMetricName) { - calContainer.text(`Metric: ${verboseMap[metric] || metric}`); + calContainer.text(`${METRIC_TEXT}: ${verboseMap[metric] || metric}`); } const timestamps = metricsData[metric]; const extents = d3Extent(Object.keys(timestamps), key => timestamps[key]); diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js index 3320693f5cc63..760bf0ce2b0c4 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js +++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/vendor/cal-heatmap.js @@ -9,7 +9,7 @@ /* eslint-disable */ import d3tip from 'd3-tip'; -import { getContrastingColor } from '@superset-ui/core'; +import { getContrastingColor, t } from '@superset-ui/core'; var d3 = typeof require === 'function' ? require('d3') : window.d3; @@ -256,9 +256,9 @@ var CalHeatMap = function () { // Formatting of the title displayed when hovering a legend cell legendTitleFormat: { - lower: 'less than {min} {name}', - inner: 'between {down} and {up} {name}', - upper: 'more than {max} {name}', + lower: t('less than {min} {name}'), + inner: t('between {down} and {up} {name}'), + upper: t('more than {max} {name}'), }, // Animation duration, in ms diff --git a/superset-frontend/plugins/legacy-plugin-chart-histogram/src/Histogram.jsx b/superset-frontend/plugins/legacy-plugin-chart-histogram/src/Histogram.jsx index 2c07267748614..67d5f30f9022d 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-histogram/src/Histogram.jsx +++ b/superset-frontend/plugins/legacy-plugin-chart-histogram/src/Histogram.jsx @@ -111,7 +111,7 @@ class CustomHistogram extends React.PureComponent { renderTooltip={({ datum, color }) => (
- {datum.bin0} to {datum.bin1} + {datum.bin0} {t('to')} {datum.bin1}
{t('count')} diff --git a/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js b/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js index f967c985fcfd4..dd70afad3b36c 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js +++ b/superset-frontend/plugins/legacy-plugin-chart-sunburst/src/Sunburst.js @@ -24,6 +24,7 @@ import { NumberFormats, CategoricalColorNamespace, getSequentialSchemeRegistry, + t, } from '@superset-ui/core'; import wrapSvgText from './utils/wrapSvgText'; @@ -381,7 +382,10 @@ function Sunburst(element, props) { .append('text') .attr('class', 'path-abs-percent') .attr('y', yOffsets[offsetIndex]) - .text(`${absolutePercString} of total`); + // eslint-disable-next-line prefer-template + .text(absolutePercString + ' ' + t('of total')); + + const OF_PARENT_TEXT = t('of parent'); if (conditionalPercString) { offsetIndex += 1; @@ -389,7 +393,7 @@ function Sunburst(element, props) { .append('text') .attr('class', 'path-cond-percent') .attr('y', yOffsets[offsetIndex]) - .text(`${conditionalPercString} of parent`); + .text(`${conditionalPercString} ${OF_PARENT_TEXT}`); } offsetIndex += 1; diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx index 3c320b05c4a04..68b9a17345ccf 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Radar/controlPanel.tsx @@ -50,7 +50,7 @@ const radarMetricMaxValue: { name: string; config: ControlFormItemSpec } = { 'The maximum value of metrics. It is an optional configuration', ), width: 120, - placeholder: 'auto', + placeholder: t('auto'), debounceDelay: 400, validators: [validateNumber], }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx index 3e1bb68f49d0f..ae0dd2409c1fb 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx @@ -52,7 +52,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] { const isXAxis = axis === 'x'; const isVertical = (controls: ControlStateMapping) => Boolean(controls?.orientation.value === OrientationType.vertical); - const isHorizental = (controls: ControlStateMapping) => + const isHorizontal = (controls: ControlStateMapping) => Boolean(controls?.orientation.value === OrientationType.horizontal); return [ [ @@ -65,7 +65,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] { default: '', description: t('Changing this control takes effect instantly'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isVertical(controls) : isHorizental(controls), + isXAxis ? isVertical(controls) : isHorizontal(controls), }, }, ], @@ -82,7 +82,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] { choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS), description: t('Changing this control takes effect instantly'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isVertical(controls) : isHorizental(controls), + isXAxis ? isVertical(controls) : isHorizontal(controls), }, }, ], @@ -96,7 +96,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] { default: '', description: t('Changing this control takes effect instantly'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -113,7 +113,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] { choices: formatSelectOptions(sections.TITLE_MARGIN_OPTIONS), description: t('Changing this control takes effect instantly'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -130,7 +130,7 @@ function createAxisTitleControl(axis: 'x' | 'y'): ControlSetRow[] { choices: sections.TITLE_POSITION_OPTIONS, description: t('Changing this control takes effect instantly'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -141,7 +141,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { const isXAxis = axis === 'x'; const isVertical = (controls: ControlStateMapping) => Boolean(controls?.orientation.value === OrientationType.vertical); - const isHorizental = (controls: ControlStateMapping) => + const isHorizontal = (controls: ControlStateMapping) => Boolean(controls?.orientation.value === OrientationType.horizontal); return [ [ @@ -154,7 +154,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { 'When using other than adaptive formatting, labels may overlap.', )}`, visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isVertical(controls) : isHorizental(controls), + isXAxis ? isVertical(controls) : isHorizontal(controls), }, }, ], @@ -176,7 +176,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { 'Input field supports custom rotation. e.g. 30 for 30°', ), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isVertical(controls) : isHorizental(controls), + isXAxis ? isVertical(controls) : isHorizontal(controls), }, }, ], @@ -187,7 +187,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { ...sharedControls.y_axis_format, label: t('Axis Format'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -201,7 +201,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { default: logAxis, description: t('Logarithmic axis'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -215,7 +215,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { default: minorSplitLine, description: t('Draw split lines for minor axis ticks'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -229,7 +229,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { renderTrigger: true, description: t('It’s not recommended to truncate axis in Bar chart.'), visibility: ({ controls }: ControlPanelsContainerProps) => - isXAxis ? isHorizental(controls) : isVertical(controls), + isXAxis ? isHorizontal(controls) : isVertical(controls), }, }, ], @@ -249,7 +249,7 @@ function createAxisControl(axis: 'x' | 'y'): ControlSetRow[] { ), visibility: ({ controls }: ControlPanelsContainerProps) => Boolean(controls?.truncateYAxis?.value) && - (isXAxis ? isHorizental(controls) : isVertical(controls)), + (isXAxis ? isHorizontal(controls) : isVertical(controls)), }, }, ], diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx index a5feed70f21bb..d9653686e11d6 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/PivotTableChart.tsx @@ -29,6 +29,7 @@ import { useTheme, isAdhocColumn, BinaryQueryObjectFilterClause, + t, } from '@superset-ui/core'; import { PivotTable, sortAs, aggregatorTemplates } from './react-pivottable'; import { @@ -55,7 +56,7 @@ const PivotTableWrapper = styled.div` overflow: auto; `; -const METRIC_KEY = 'metric'; +const METRIC_KEY = t('metric'); const vals = ['value']; const StyledPlusSquareOutlined = styled(PlusSquareOutlined)` diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx index ebfc4a2536640..576325a21ddec 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx +++ b/superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx @@ -487,7 +487,9 @@ export class TableRenderer extends React.Component { true, )} > - {`Total (${this.props.aggregatorName})`} + {t('Total (%(aggregatorName)s)', { + aggregatorName: t(this.props.aggregatorName), + })} ) : null; @@ -550,7 +552,9 @@ export class TableRenderer extends React.Component { )} > {colAttrs.length === 0 - ? `Total (${this.props.aggregatorName})` + ? t('Total (%(aggregatorName)s)', { + aggregatorName: t(this.props.aggregatorName), + }) : null} @@ -764,10 +768,9 @@ export class TableRenderer extends React.Component { true, )} > - { - // eslint-disable-next-line prefer-template - t('Total') + ` (${this.props.aggregatorName})` - } + {t('Total (%(aggregatorName)s)', { + aggregatorName: t(this.props.aggregatorName), + })} ); diff --git a/superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SelectPageSize.tsx b/superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SelectPageSize.tsx index 989b121a3352a..48d4b9a66874e 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SelectPageSize.tsx +++ b/superset-frontend/plugins/plugin-chart-table/src/DataTable/components/SelectPageSize.tsx @@ -17,6 +17,7 @@ * under the License. */ import React from 'react'; +import { t } from '@superset-ui/core'; import { formatSelectOptions } from '@superset-ui/chart-controls'; export type SizeOption = [number, string]; @@ -34,7 +35,7 @@ function DefaultSelectRenderer({ }: SelectPageSizeRendererProps) { return ( - Show{' '} + {t('Show')}{' '}