You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2026/04/23 17:37:37 UTC
(superset) 14/33: More fixes
This is an automated email from the ASF dual-hosted git repository.
betodealmeida pushed a commit to branch backup/semantic-layer-dynamic-columns-before-rebase-20260423-133321
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 493bacd128cf1b488f6630ea0fbd4653ffb0cb18
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Mar 12 10:50:31 2026 -0400
More fixes
---
superset-frontend/src/components/Chart/Chart.tsx | 3 ++-
.../Chart/DrillDetail/DrillDetailPane.tsx | 3 ++-
.../src/components/DatabaseSelector/index.tsx | 24 ++++++++++++++++++----
.../Datasource/ChangeDatasourceModal/index.tsx | 11 +++++++---
.../Datasource/DatasourceModal/index.tsx | 7 ++++---
.../DatasourceEditor/DatasourceEditor.tsx | 3 ++-
.../ErrorMessage/DatasetNotFoundErrorMessage.tsx | 3 ++-
.../src/components/ImportModal/index.tsx | 3 ++-
.../components/AddSliceCard/AddSliceCard.tsx | 3 ++-
.../src/dashboard/components/SliceAdder.tsx | 3 ++-
.../FilterBar/FilterControls/GroupByFilterCard.tsx | 11 ++++++++--
.../FiltersConfigForm/DatasetSelect.tsx | 11 +++++++---
.../FiltersConfigForm/FiltersConfigForm.tsx | 7 ++++---
.../DataTablesPane/components/SamplesPane.tsx | 6 +++++-
.../explore/components/DatasourcePanel/index.tsx | 3 ++-
.../explore/components/ExploreChartPanel/index.tsx | 5 +++--
.../src/explore/components/SaveModal.tsx | 8 +++++---
.../controls/DatasourceControl/index.tsx | 20 ++++++++++--------
.../DndColumnSelectControl/ColumnSelectPopover.tsx | 7 ++++---
.../DndAdhocFilterOption.tsx | 6 +++++-
.../DndColumnMetricSelect.tsx | 6 +++++-
.../DndColumnSelectControl/DndColumnSelect.tsx | 6 +++++-
.../DndColumnSelectControl/DndMetricSelect.tsx | 11 ++++++++--
.../MetricControl/AdhocMetricEditPopover/index.tsx | 3 ++-
.../components/controls/ViewQueryModalFooter.tsx | 3 ++-
superset-frontend/src/explore/controls.tsx | 3 ++-
.../src/pages/ChartCreation/index.tsx | 22 ++++++++++++++------
superset-frontend/src/pages/ChartList/index.tsx | 5 +++--
28 files changed, 147 insertions(+), 59 deletions(-)
diff --git a/superset-frontend/src/components/Chart/Chart.tsx b/superset-frontend/src/components/Chart/Chart.tsx
index a7e38aa61a4..c20ca163c95 100644
--- a/superset-frontend/src/components/Chart/Chart.tsx
+++ b/superset-frontend/src/components/Chart/Chart.tsx
@@ -46,6 +46,7 @@ import { Dispatch } from 'redux';
import ChartRenderer from './ChartRenderer';
import { ChartErrorMessage } from './ChartErrorMessage';
import { getChartRequiredFieldsMissingMessage } from '../../utils/getChartRequiredFieldsMissingMessage';
+import { databaseLabelLower } from 'src/utils/semanticLayerLabels';
export type ChartErrorType = Partial<ClientErrorObject>;
export interface ChartProps {
@@ -312,7 +313,7 @@ class Chart extends PureComponent<ChartProps, {}> {
renderSpinner(databaseName: string | undefined) {
const message = databaseName
? t('Waiting on %s', databaseName)
- : t('Waiting on database...');
+ : t('Waiting on %s...', databaseLabelLower());
return (
<LoadingDiv>
diff --git a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx
index 747c17d80bf..cf44a7f1314 100644
--- a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx
+++ b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx
@@ -53,6 +53,7 @@ import { Dataset } from '../types';
import TableControls from './DrillDetailTableControls';
import { getDrillPayload } from './utils';
import { ResultsPage } from './types';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
const PAGE_SIZE = 50;
@@ -303,7 +304,7 @@ export default function DrillDetailPane({
tableContent = <Loading />;
} else if (resultsPage?.total === 0) {
// Render empty state if no results are returned for page
- const title = t('No rows were returned for this dataset');
+ const title = t('No rows were returned for this %s', datasetLabelLower());
tableContent = <EmptyState image="document.svg" title={title} />;
} else {
// Render table if at least one page has successfully loaded
diff --git a/superset-frontend/src/components/DatabaseSelector/index.tsx b/superset-frontend/src/components/DatabaseSelector/index.tsx
index ee5f39b9979..361f63dc75a 100644
--- a/superset-frontend/src/components/DatabaseSelector/index.tsx
+++ b/superset-frontend/src/components/DatabaseSelector/index.tsx
@@ -52,6 +52,10 @@ import type {
DatabaseObject,
} from './types';
import { StyledFormLabel } from './styles';
+import {
+ databaseLabel,
+ databasesLabelLower,
+} from 'src/utils/semanticLayerLabels';
const DatabaseSelectorWrapper = styled.div<{ horizontal?: boolean }>`
${({ theme, horizontal }) =>
@@ -431,7 +435,11 @@ export function DatabaseSelector({
function renderDatabaseSelect() {
if (sqlLabMode) {
return renderSelectRow(
- t('Select database or type to search databases'),
+ t(
+ 'Select %s or type to search %s',
+ databaseLabel().toLowerCase(),
+ databasesLabelLower(),
+ ),
null,
null,
{
@@ -448,16 +456,24 @@ export function DatabaseSelector({
return (
<div>
{renderSelectRow(
- t('Database'),
+ databaseLabel(),
<AsyncSelect
- ariaLabel={t('Select database or type to search databases')}
+ ariaLabel={t(
+ 'Select %s or type to search %s',
+ databaseLabel().toLowerCase(),
+ databasesLabelLower(),
+ )}
optionFilterProps={['database_name', 'value']}
data-test="select-database"
lazyLoading={false}
notFoundContent={emptyState}
onChange={changeDatabase}
value={currentDb}
- placeholder={t('Select database or type to search databases')}
+ placeholder={t(
+ 'Select %s or type to search %s',
+ databaseLabel().toLowerCase(),
+ databasesLabelLower(),
+ )}
disabled={!isDatabaseSelectEnabled || readOnly}
options={loadDatabases}
sortComparator={sortComparator}
diff --git a/superset-frontend/src/components/Datasource/ChangeDatasourceModal/index.tsx b/superset-frontend/src/components/Datasource/ChangeDatasourceModal/index.tsx
index 3b8f3531039..c9d67bb6c4e 100644
--- a/superset-frontend/src/components/Datasource/ChangeDatasourceModal/index.tsx
+++ b/superset-frontend/src/components/Datasource/ChangeDatasourceModal/index.tsx
@@ -53,6 +53,7 @@ import {
import withToasts from 'src/components/MessageToasts/withToasts';
import { InputRef } from 'antd';
import type { Datasource, ChangeDatasourceModalProps } from '../types';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
const CONFIRM_WARNING_MESSAGE = t(
'Warning! Changing the dataset may break the chart if the metadata does not exist.',
@@ -109,7 +110,11 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
const {
state: { loading, resourceCollection, resourceCount },
fetchData,
- } = useListViewResource<Dataset>('dataset', t('dataset'), addDangerToast);
+ } = useListViewResource<Dataset>(
+ 'dataset',
+ datasetLabelLower(),
+ addDangerToast,
+ );
const selectDatasource = useCallback((datasource: Datasource) => {
setConfirmChange(true);
@@ -187,7 +192,7 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
);
});
onHide();
- addSuccessToast(t('Successfully changed dataset!'));
+ addSuccessToast(t('Successfully changed %s!', datasetLabelLower()));
};
const handlerCancelConfirm = () => {
@@ -253,7 +258,7 @@ const ChangeDatasourceModal: FunctionComponent<ChangeDatasourceModalProps> = ({
onHide={onHide}
responsive
name="Swap dataset"
- title={t('Swap dataset')}
+ title={t('Swap %s', datasetLabelLower())}
width={confirmChange ? '432px' : ''}
height={confirmChange ? 'auto' : '540px'}
hideFooter={!confirmChange}
diff --git a/superset-frontend/src/components/Datasource/DatasourceModal/index.tsx b/superset-frontend/src/components/Datasource/DatasourceModal/index.tsx
index d3e34b76484..ef4033331fc 100644
--- a/superset-frontend/src/components/Datasource/DatasourceModal/index.tsx
+++ b/superset-frontend/src/components/Datasource/DatasourceModal/index.tsx
@@ -40,6 +40,7 @@ import withToasts from 'src/components/MessageToasts/withToasts';
import { ErrorMessageWithStackTrace } from 'src/components';
import type { DatasetObject } from 'src/features/datasets/types';
import type { DatasourceModalProps } from '../types';
+import { datasetLabel, datasetLabelLower } from 'src/utils/semanticLayerLabels';
const DatasourceEditor = AsyncEsmComponent(
() => import('../components/DatasourceEditor'),
@@ -195,7 +196,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
endpoint: `/api/v1/dataset/${currentDatasource?.id}`,
});
- addSuccessToast(t('The dataset has been saved'));
+ addSuccessToast(t('The %s has been saved', datasetLabelLower()));
// eslint-disable-next-line no-param-reassign
json.result.type = 'table';
onDatasourceSave({
@@ -216,7 +217,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
errorText = error.error;
}
modal.error({
- title: t('Error saving dataset'),
+ title: t('Error saving %s', datasetLabelLower()),
okButtonProps: { danger: true, className: 'btn-danger' },
content: (
<ErrorMessageWithStackTrace
@@ -326,7 +327,7 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
`}
data-test="edit-alt"
/>
- {t('Edit Dataset ')}
+ {t('Edit %s ', datasetLabel())}
<strong>{currentDatasource.table_name}</strong>
</span>
}
diff --git a/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx b/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx
index 6150927ca6a..ba8710bf2d2 100644
--- a/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx
+++ b/superset-frontend/src/components/Datasource/components/DatasourceEditor/DatasourceEditor.tsx
@@ -101,6 +101,7 @@ import {
} from '../../FoldersEditor/treeUtils';
import FoldersEditor from '../../FoldersEditor';
import { DatasourceFolder } from 'src/explore/components/DatasourcePanel/types';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
const extensionsRegistry = getExtensionsRegistry();
@@ -1906,7 +1907,7 @@ class DatasourceEditor extends PureComponent<
onChange={table => {
this.onDatasourcePropChange('table_name', table);
}}
- placeholder={t('Dataset name')}
+ placeholder={t('%s name', datasetLabel())}
disabled={!this.state.isEditMode}
/>
}
diff --git a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx
index e74da4d0649..26cd6e4f8cd 100644
--- a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx
+++ b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx
@@ -20,6 +20,7 @@ import { t } from '@apache-superset/core/translation';
import type { ErrorMessageComponentProps } from './types';
import { ErrorAlert } from './ErrorAlert';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
export function DatasetNotFoundErrorMessage({
error,
@@ -29,7 +30,7 @@ export function DatasetNotFoundErrorMessage({
const { level, message } = error;
return (
<ErrorAlert
- errorType={t('Missing dataset')}
+ errorType={t('Missing %s', datasetLabelLower())}
message={subtitle}
description={message}
type={level}
diff --git a/superset-frontend/src/components/ImportModal/index.tsx b/superset-frontend/src/components/ImportModal/index.tsx
index b046abf8880..a3097803b14 100644
--- a/superset-frontend/src/components/ImportModal/index.tsx
+++ b/superset-frontend/src/components/ImportModal/index.tsx
@@ -29,6 +29,7 @@ import { Button, Input, Modal } from '@superset-ui/core/components';
import { ModalTitleWithIcon } from 'src/components/ModalTitleWithIcon';
import { ImportErrorAlert } from './ImportErrorAlert';
import type { ImportModelsModalProps } from './types';
+import { databaseLabel } from 'src/utils/semanticLayerLabels';
const HelperMessage = styled.div`
display: block;
@@ -247,7 +248,7 @@ export const ImportModal: FunctionComponent<ImportModelsModalProps> = ({
return (
<>
- <h5>{t('Database passwords')}</h5>
+ <h5>{t('%s passwords', databaseLabel())}</h5>
<HelperMessage>{passwordsNeededMessage}</HelperMessage>
{files.map(fileName => (
<>
diff --git a/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx b/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx
index 56229cc2bc3..8d0c75c3a96 100644
--- a/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx
+++ b/superset-frontend/src/dashboard/components/AddSliceCard/AddSliceCard.tsx
@@ -36,6 +36,7 @@ import { Tooltip, ImageLoader } from '@superset-ui/core/components';
import { GenericLink, usePluginContext } from 'src/components';
import { assetUrl } from 'src/utils/assetUrl';
import { Theme } from '@emotion/react';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
const FALLBACK_THUMBNAIL_URL = assetUrl(
'/static/assets/images/chart-card-fallback.svg',
@@ -283,7 +284,7 @@ const AddSliceCard: FC<{
>
<MetadataItem label={t('Viz type')} value={vizName} />
<MetadataItem
- label={t('Dataset')}
+ label={datasetLabel()}
value={
datasourceUrl ? (
<GenericLink to={datasourceUrl}>
diff --git a/superset-frontend/src/dashboard/components/SliceAdder.tsx b/superset-frontend/src/dashboard/components/SliceAdder.tsx
index 8ad34e3c065..49fd3ce9ff9 100644
--- a/superset-frontend/src/dashboard/components/SliceAdder.tsx
+++ b/superset-frontend/src/dashboard/components/SliceAdder.tsx
@@ -55,6 +55,7 @@ import type { ConnectDragSource } from 'react-dnd';
import AddSliceCard from './AddSliceCard';
import AddSliceDragPreview from './dnd/AddSliceDragPreview';
import { DragDroppable } from './dnd/DragDroppable';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
export type SliceAdderProps = {
theme: Theme;
@@ -88,7 +89,7 @@ const KEYS_TO_FILTERS = ['slice_name', 'viz_type', 'datasource_name'];
const KEYS_TO_SORT = {
slice_name: t('name'),
viz_type: t('viz type'),
- datasource_name: t('dataset'),
+ datasource_name: datasetLabelLower(),
changed_on: t('recent'),
};
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx
index b079f133af9..2c609088340 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/GroupByFilterCard.tsx
@@ -51,6 +51,7 @@ import { addDangerToast } from 'src/components/MessageToasts/actions';
import { cachedSupersetGet } from 'src/utils/cachedSupersetGet';
import { dispatchChartCustomizationHoverAction } from './utils';
import { mergeExtraFormData } from '../../utils';
+import { datasetLabel, datasetLabelLower } from 'src/utils/semanticLayerLabels';
interface ColumnApiResponse {
column_name?: string;
@@ -262,7 +263,7 @@ const GroupByFilterCardContent: FC<{
</Row>
<Row>
- <RowLabel>{t('Dataset')}</RowLabel>
+ <RowLabel>{datasetLabel()}</RowLabel>
<RowValue>
{typeof datasetLabel === 'string' ? datasetLabel : 'Dataset'}
</RowValue>
@@ -475,7 +476,13 @@ const GroupByFilterCard: FC<GroupByFilterCardProps> = ({
} catch (error) {
setColumnOptions([]);
dispatch(
- addDangerToast(t('Failed to load columns for dataset %s', datasetId)),
+ addDangerToast(
+ t(
+ 'Failed to load columns for %s %s',
+ datasetLabelLower(),
+ datasetId,
+ ),
+ ),
);
} finally {
setLoading(false);
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
index f48e6dc039f..f77c8e84cbd 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DatasetSelect.tsx
@@ -30,6 +30,11 @@ import {
Dataset,
DatasetSelectLabel,
} from 'src/features/datasets/DatasetSelectLabel';
+import {
+ datasetLabel,
+ datasetLabelLower,
+ datasetsLabelLower,
+} from 'src/utils/semanticLayerLabels';
interface DatasetSelectProps {
onChange: (value: { label: string | ReactNode; value: number }) => void;
@@ -101,13 +106,13 @@ const DatasetSelect = ({
return (
<AsyncSelect
- ariaLabel={t('Dataset')}
+ ariaLabel={datasetLabel()}
value={value}
options={loadDatasetOptionsCallback}
onChange={onChange}
optionFilterProps={['table_name']}
- notFoundContent={t('No compatible datasets found')}
- placeholder={t('Select a dataset')}
+ notFoundContent={t('No compatible %s found', datasetsLabelLower())}
+ placeholder={t('Select a %s', datasetLabelLower())}
/>
);
};
diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
index ab6a9f22e69..ddf41f39fd3 100644
--- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
+++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx
@@ -115,6 +115,7 @@ import {
INPUT_WIDTH,
} from './constants';
import DependencyList from './DependencyList';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
const FORM_ITEM_WIDTH = 260;
@@ -972,7 +973,7 @@ const FiltersConfigForm = (
<StyledFormItem
expanded={expanded}
name={['filters', filterId, 'dataset']}
- label={<StyledLabel>{t('Dataset')}</StyledLabel>}
+ label={<StyledLabel>{datasetLabel()}</StyledLabel>}
initialValue={
datasetDetails
? {
@@ -992,7 +993,7 @@ const FiltersConfigForm = (
rules={[
{
required: !isRemoved,
- message: t('Dataset is required'),
+ message: t('%s is required', datasetLabel()),
},
]}
{...getFiltersConfigModalTestId('datasource-input')}
@@ -1018,7 +1019,7 @@ const FiltersConfigForm = (
) : (
<StyledFormItem
expanded={expanded}
- label={<StyledLabel>{t('Dataset')}</StyledLabel>}
+ label={<StyledLabel>{datasetLabel()}</StyledLabel>}
>
<Loading position="inline-centered" />
</StyledFormItem>
diff --git a/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx b/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx
index 1c58bd9ae69..d79d3d537de 100644
--- a/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx
+++ b/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx
@@ -19,6 +19,7 @@
import { useState, useEffect, useMemo, useCallback } from 'react';
import { t } from '@apache-superset/core/translation';
import { ensureIsArray } from '@superset-ui/core';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
import { styled } from '@apache-superset/core/theme';
import {
TableView,
@@ -135,7 +136,10 @@ export const SamplesPane = ({
}
if (data.length === 0) {
- const title = t('No samples were returned for this dataset');
+ const title = t(
+ 'No samples were returned for this %s',
+ datasetLabelLower(),
+ );
return <EmptyState image="document.svg" title={title} />;
}
diff --git a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
index 74718ae3751..8a340c55f25 100644
--- a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
+++ b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx
@@ -22,6 +22,7 @@ import { DatasourceType, Metric, QueryFormData } from '@superset-ui/core';
import { Alert } from '@apache-superset/core/components';
import { css, styled, useTheme } from '@apache-superset/core/theme';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
import { ControlConfig } from '@superset-ui/chart-controls';
import AutoSizer from 'react-virtualized-auto-sizer';
@@ -291,7 +292,7 @@ export default function DataSourcePanel({
onClick={() => setShowSaveDatasetModal(true)}
className="add-dataset-alert-description"
>
- {t('Create a dataset')}
+ {t('Create a %s', datasetLabelLower())}
</span>
{t(' to edit or add columns and metrics.')}
</>
diff --git a/superset-frontend/src/explore/components/ExploreChartPanel/index.tsx b/superset-frontend/src/explore/components/ExploreChartPanel/index.tsx
index c692e65bfd1..fbfce00da15 100644
--- a/superset-frontend/src/explore/components/ExploreChartPanel/index.tsx
+++ b/superset-frontend/src/explore/components/ExploreChartPanel/index.tsx
@@ -31,6 +31,7 @@ import {
getExtensionsRegistry,
} from '@superset-ui/core';
import { Alert } from '@apache-superset/core/components';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
import { css, styled, useTheme } from '@apache-superset/core/theme';
import ChartContainer from 'src/components/Chart/ChartContainer';
import {
@@ -325,7 +326,7 @@ const ExploreChartPanel = ({
>
{vizTypeNeedsDataset && (
<Alert
- message={t('Chart type requires a dataset')}
+ message={t('Chart type requires a %s', datasetLabelLower())}
type="error"
css={theme => css`
margin: 0 0 ${theme.sizeUnit * 4}px 0;
@@ -341,7 +342,7 @@ const ExploreChartPanel = ({
onClick={() => setShowDatasetModal(true)}
css={{ textDecoration: 'underline' }}
>
- {t('Create a dataset')}
+ {t('Create a %s', datasetLabelLower())}
</span>
{t(' to visualize your data.')}
</>
diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx
index a78b4ce7dc1..2d05d1817e0 100644
--- a/superset-frontend/src/explore/components/SaveModal.tsx
+++ b/superset-frontend/src/explore/components/SaveModal.tsx
@@ -59,6 +59,7 @@ import {
import { Dashboard } from 'src/types/Dashboard';
import { TabNode, TabTreeNode } from '../types';
import { CHART_WIDTH, CHART_HEIGHT } from 'src/dashboard/constants';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
// Session storage key for recent dashboard
const SK_DASHBOARD_ID = 'save_chart_recent_dashboard';
@@ -635,11 +636,12 @@ class SaveModal extends Component<SaveModalProps, SaveModalState> {
<FormItem
label={
<Flex align="center" gap={this.props.theme.sizeUnit}>
- {t('Dataset Name')}
+ {t('%s Name', datasetLabel())}
<InfoTooltip
data-test="info-tooltip-icon"
tooltip={t(
- 'A reusable dataset will be saved with your chart.',
+ 'A reusable %s will be saved with your chart.',
+ datasetLabel().toLowerCase(),
)}
placement="right"
/>
@@ -650,7 +652,7 @@ class SaveModal extends Component<SaveModalProps, SaveModalState> {
<Input
name="dataset_name"
type="text"
- placeholder={t('Dataset Name')}
+ placeholder={t('%s Name', datasetLabel())}
value={this.state.datasetName}
onChange={this.handleDatasetNameChange}
data-test="new-dataset-name"
diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx b/superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx
index 76136b8b483..512795b2d3e 100644
--- a/superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx
+++ b/superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx
@@ -45,6 +45,7 @@ import { Icons } from '@superset-ui/core/components/Icons';
import WarningIconWithTooltip from '@superset-ui/core/components/WarningIconWithTooltip';
import { URL_PARAMS } from 'src/constants';
import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
import {
userHasPermission,
isUserAdmin,
@@ -375,7 +376,7 @@ class DatasourceControl extends PureComponent<
const canAccessSqlLab = userHasPermission(user, 'SQL Lab', 'menu_access');
- const editText = t('Edit dataset');
+ const editText = t('Edit %s', datasetLabelLower());
const requestedQuery = {
datasourceKey: `${datasource.id}__${datasource.type}`,
sql: datasource.sql,
@@ -387,7 +388,9 @@ class DatasourceControl extends PureComponent<
label: !allowEdit ? (
<Tooltip
title={t(
- 'You must be a dataset owner in order to edit. Please reach out to a dataset owner to request modifications or edit access.',
+ 'You must be a %s owner in order to edit. Please reach out to a %s owner to request modifications or edit access.',
+ datasetLabelLower(),
+ datasetLabelLower(),
)}
>
{editText}
@@ -402,7 +405,7 @@ class DatasourceControl extends PureComponent<
defaultDatasourceMenuItems.push({
key: CHANGE_DATASET,
- label: t('Swap dataset'),
+ label: t('Swap %s', datasetLabelLower()),
});
if (!isMissingDatasource && canAccessSqlLab) {
@@ -481,7 +484,7 @@ class DatasourceControl extends PureComponent<
queryDatasourceMenuItems.push({
key: SAVE_AS_DATASET,
- label: <span>{t('Save as dataset')}</span>,
+ label: <span>{t('Save as %s', datasetLabelLower())}</span>,
});
const queryDatasourceMenu = (
@@ -495,7 +498,7 @@ class DatasourceControl extends PureComponent<
const titleText =
isMissingDatasource && !datasource.name
- ? t('Missing dataset')
+ ? t('Missing %s', datasetLabelLower())
: getDatasourceTitle(datasource);
const tooltip = titleText;
@@ -561,14 +564,15 @@ class DatasourceControl extends PureComponent<
) : (
<ErrorAlert
type="warning"
- message={t('Missing dataset')}
+ message={t('Missing %s', datasetLabelLower())}
descriptionPre={false}
descriptionDetailsCollapsed={false}
descriptionDetails={
<>
<p>
{t(
- 'The dataset linked to this chart may have been deleted.',
+ 'The %s linked to this chart may have been deleted.',
+ datasetLabelLower(),
)}
</p>
<p>
@@ -578,7 +582,7 @@ class DatasourceControl extends PureComponent<
this.handleMenuItemClick({ key: CHANGE_DATASET })
}
>
- {t('Swap dataset')}
+ {t('Swap %s', datasetLabelLower())}
</Button>
</p>
</>
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
index f61fafe8bcb..bd8ab88c700 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx
@@ -57,6 +57,7 @@ import {
} from 'src/explore/constants';
import { ExplorePageState } from 'src/explore/types';
import useResizeButton from './useResizeButton';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
const TABS_KEYS = {
SAVED: 'saved',
@@ -472,7 +473,7 @@ const ColumnSelectPopover = ({
tabIndex={0}
onClick={setDatasetAndClose}
>
- {t('Create a dataset')}
+ {t('Create a %s', datasetLabelLower())}
</span>{' '}
{t(' to mark a column as a time column')}
</>
@@ -483,7 +484,7 @@ const ColumnSelectPopover = ({
tabIndex={0}
onClick={setDatasetAndClose}
>
- {t('Create a dataset')}
+ {t('Create a %s', datasetLabelLower())}
</span>{' '}
{t(' to add calculated columns')}
</>
@@ -517,7 +518,7 @@ const ColumnSelectPopover = ({
tabIndex={0}
onClick={setDatasetAndClose}
>
- {t('Create a dataset')}
+ {t('Create a %s', datasetLabelLower())}
</span>{' '}
{t(' to mark a column as a time column')}
</>
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
index 857b098003b..96024e6fa0d 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
@@ -23,6 +23,7 @@ import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilt
import { OptionSortType } from 'src/explore/types';
import { useGetTimeRangeLabel } from 'src/explore/components/controls/FilterControl/utils';
import OptionWrapper from './OptionWrapper';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
export interface DndAdhocFilterOptionProps {
adhocFilter: AdhocFilter;
@@ -68,7 +69,10 @@ export default function DndAdhocFilterOption({
isExtra={adhocFilter.isExtra}
datasourceWarningMessage={
adhocFilter.datasourceWarning
- ? t('This filter might be incompatible with current dataset')
+ ? t(
+ 'This filter might be incompatible with current %s',
+ datasetLabelLower(),
+ )
: undefined
}
/>
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx
index 126d699ddff..1f81bbb9a85 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnMetricSelect.tsx
@@ -38,6 +38,7 @@ import AdhocMetric from 'src/explore/components/controls/MetricControl/AdhocMetr
import MetricDefinitionValue from 'src/explore/components/controls/MetricControl/MetricDefinitionValue';
import ColumnSelectPopoverTrigger from './ColumnSelectPopoverTrigger';
import { DndControlProps } from './types';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
const AGGREGATED_DECK_GL_CHART_TYPES = [
'deck_screengrid',
@@ -326,7 +327,10 @@ function DndColumnMetricSelect(props: DndColumnMetricSelectProps) {
typeof item === 'object' &&
'error_text' in item &&
item.error_text)
- ? t('This metric might be incompatible with current dataset')
+ ? t(
+ 'This metric might be incompatible with current %s',
+ datasetLabelLower(),
+ )
: undefined;
return (
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx
index 6e474e552cf..2987d41e3be 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelect.tsx
@@ -29,6 +29,7 @@ import { DatasourcePanelDndItem } from 'src/explore/components/DatasourcePanel/t
import { DndItemType } from 'src/explore/components/DndItemType';
import ColumnSelectPopoverTrigger from './ColumnSelectPopoverTrigger';
import { DndControlProps } from './types';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
export type DndColumnSelectProps = DndControlProps<QueryFormColumn> & {
options: ColumnMeta[];
@@ -103,7 +104,10 @@ function DndColumnSelect(props: DndColumnSelectProps) {
optionSelector.values.map((column, idx) => {
const datasourceWarningMessage =
isAdhocColumn(column) && column.datasourceWarning
- ? t('This column might be incompatible with current dataset')
+ ? t(
+ 'This column might be incompatible with current %s',
+ datasetLabelLower(),
+ )
: undefined;
const withCaret = isAdhocColumn(column) || !column.error_text;
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.tsx
index 0dd1074acec..de5608c03e2 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndMetricSelect.tsx
@@ -41,6 +41,7 @@ import { DndItemType } from 'src/explore/components/DndItemType';
import DndSelectLabel from 'src/explore/components/controls/DndColumnSelectControl/DndSelectLabel';
import { savedMetricType } from 'src/explore/components/controls/MetricControl/types';
import { AGGREGATES } from 'src/explore/constants';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
const EMPTY_OBJECT = {};
const DND_ACCEPTED_TYPES = [DndItemType.Column, DndItemType.Metric];
@@ -77,7 +78,10 @@ const coerceMetrics = (
) {
return {
metric_name: metric,
- error_text: t('This metric might be incompatible with current dataset'),
+ error_text: t(
+ 'This metric might be incompatible with current %s',
+ datasetLabelLower(),
+ ),
uuid: nanoid(),
};
}
@@ -296,7 +300,10 @@ const DndMetricSelect = (props: any) => {
multi={multi}
datasourceWarningMessage={
option instanceof AdhocMetric && option.datasourceWarning
- ? t('This metric might be incompatible with current dataset')
+ ? t(
+ 'This metric might be incompatible with current %s',
+ datasetLabelLower(),
+ )
: undefined
}
/>
diff --git a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.tsx b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.tsx
index 031248df0a0..000ac461e9c 100644
--- a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.tsx
+++ b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.tsx
@@ -49,6 +49,7 @@ import {
import { getColumnKeywords } from 'src/explore/controlUtils/getColumnKeywords';
import SQLEditorWithValidation from 'src/components/SQLEditorWithValidation';
import type { RefObject } from 'react';
+import { datasetLabelLower } from 'src/utils/semanticLayerLabels';
interface ColumnType {
column_name: string;
@@ -475,7 +476,7 @@ export default class AdhocMetricEditPopover extends PureComponent<
this.props.onClose();
}}
>
- {t('Create a dataset')}
+ {t('Create a %s', datasetLabelLower())}
</span>
{t(' to add metrics')}
</>
diff --git a/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx b/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx
index fc8c7c948b2..ee14b70436f 100644
--- a/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx
+++ b/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx
@@ -22,6 +22,7 @@ import { t } from '@apache-superset/core/translation';
import { SupersetClient } from '@superset-ui/core';
import { Button } from '@superset-ui/core/components';
import { useHistory } from 'react-router-dom';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
interface SimpleDataSource {
id: string;
@@ -36,7 +37,7 @@ interface ViewQueryModalFooterProps {
}
const CLOSE = t('Close');
-const SAVE_AS_DATASET = t('Save as Dataset');
+const SAVE_AS_DATASET = t('Save as %s', datasetLabel());
const OPEN_IN_SQL_LAB = t('Open in SQL Lab');
const ViewQueryModalFooter: FC<ViewQueryModalFooterProps> = (props: {
diff --git a/superset-frontend/src/explore/controls.tsx b/superset-frontend/src/explore/controls.tsx
index 91e91de6867..b58808feebe 100644
--- a/superset-frontend/src/explore/controls.tsx
+++ b/superset-frontend/src/explore/controls.tsx
@@ -64,6 +64,7 @@ import {
validateNonEmpty,
} from '@superset-ui/core';
import { t } from '@apache-superset/core/translation';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
import { formatSelectOptions } from 'src/explore/exploreUtils';
import { TIME_FILTER_LABELS } from './constants';
import { StyledColumnOption } from './components/optionRenderers';
@@ -214,7 +215,7 @@ export const controls = {
datasource: {
type: 'DatasourceControl',
- label: t('Dataset'),
+ label: datasetLabel(),
default: null,
description: null,
mapStateToProps: ({ datasource }: ControlState) => ({
diff --git a/superset-frontend/src/pages/ChartCreation/index.tsx b/superset-frontend/src/pages/ChartCreation/index.tsx
index bea1756ab53..05a7b8f3486 100644
--- a/superset-frontend/src/pages/ChartCreation/index.tsx
+++ b/superset-frontend/src/pages/ChartCreation/index.tsx
@@ -44,6 +44,7 @@ import {
DatasetSelectLabel,
} from 'src/features/datasets/DatasetSelectLabel';
import { Icons } from '@superset-ui/core/components/Icons';
+import { datasetLabel, datasetLabelLower } from 'src/utils/semanticLayerLabels';
export interface ChartCreationProps extends RouteComponentProps {
user: UserWithPermissionsAndRoles;
@@ -210,7 +211,9 @@ export class ChartCreation extends PureComponent<
.catch(() => {
this.setState({ loading: false });
});
- this.props.addSuccessToast(t('The dataset has been saved'));
+ this.props.addSuccessToast(
+ t('The %s has been saved', datasetLabelLower()),
+ );
}
}
@@ -295,7 +298,7 @@ export class ChartCreation extends PureComponent<
const datasetHelpText = this.state.canCreateDataset ? (
<span data-test="dataset-write">
<Link to="/dataset/add/" data-test="add-chart-new-dataset">
- {t('Add a dataset')}
+ {t('Add a %s', datasetLabelLower())}
</Link>{' '}
{t('or')}{' '}
<a
@@ -332,18 +335,22 @@ export class ChartCreation extends PureComponent<
<h3>{t('Create a new chart')}</h3>
<Steps direction="vertical" size="small">
<Steps.Step
- title={<StyledStepTitle>{t('Choose a dataset')}</StyledStepTitle>}
+ title={
+ <StyledStepTitle>
+ {t('Choose a %s', datasetLabelLower())}
+ </StyledStepTitle>
+ }
status={this.state.datasource?.value ? 'finish' : 'process'}
description={
<StyledStepDescription className="dataset">
<AsyncSelect
autoFocus
- ariaLabel={t('Dataset')}
+ ariaLabel={datasetLabel()}
name="select-datasource"
onChange={this.changeDatasource}
options={this.loadDatasources}
optionFilterProps={['id', 'table_name']}
- placeholder={t('Choose a dataset')}
+ placeholder={t('Choose a %s', datasetLabelLower())}
showSearch
value={this.state.datasource}
/>
@@ -370,7 +377,10 @@ export class ChartCreation extends PureComponent<
<div className="footer">
{isButtonDisabled && (
<span>
- {t('Please select both a Dataset and a Chart type to proceed')}
+ {t(
+ 'Please select both a %s and a Chart type to proceed',
+ datasetLabel(),
+ )}
</span>
)}
<Button
diff --git a/superset-frontend/src/pages/ChartList/index.tsx b/superset-frontend/src/pages/ChartList/index.tsx
index dc91a9028b7..f11f40c5f1f 100644
--- a/superset-frontend/src/pages/ChartList/index.tsx
+++ b/superset-frontend/src/pages/ChartList/index.tsx
@@ -83,6 +83,7 @@ import { findPermission } from 'src/utils/findPermission';
import { QueryObjectColumns } from 'src/views/CRUD/types';
import { WIDER_DROPDOWN_WIDTH } from 'src/components/ListView/utils';
import { Tag } from 'src/components/Tag';
+import { datasetLabel } from 'src/utils/semanticLayerLabels';
const FlexRowContainer = styled.div`
align-items: center;
@@ -430,7 +431,7 @@ function ChartList(props: ChartListProps) {
</Tooltip>
);
},
- Header: t('Dataset'),
+ Header: datasetLabel(),
accessor: 'datasource_id',
disableSortBy: true,
size: 'xl',
@@ -658,7 +659,7 @@ function ChartList(props: ChartListProps) {
}),
},
{
- Header: t('Dataset'),
+ Header: datasetLabel(),
key: 'dataset',
id: 'datasource_id',
input: 'select',