Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate translation module @superset-ui/translation #6222

Merged
merged 18 commits into from
Oct 30, 2018
Merged
Prev Previous commit
Next Next commit
Change imports
  • Loading branch information
kristw committed Oct 29, 2018
commit afc7f3edc10b37b2a10a7380a87d7dabe4c437cd
4 changes: 1 addition & 3 deletions superset/assets/src/CRUD/CollectionTable.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import shortid from 'shortid';

import { t } from '@superset-ui/translation';
import Button from '../components/Button';
import Fieldset from './Fieldset';
import { recurseReactClone } from './utils';
import './styles.css';

import { t } from '../locales';

const propTypes = {
collection: PropTypes.arrayOf(PropTypes.object).isRequired,
itemGenerator: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/actions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import shortid from 'shortid';
import JSONbig from 'json-bigint';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/core';

import { now } from '../modules/dates';
import { t } from '../locales';
import {
addSuccessToast as addSuccessToastAction,
addDangerToast as addDangerToastAction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Alert } from 'react-bootstrap';
import Dialog from 'react-bootstrap-dialog';
import { t } from '@superset-ui/translation';

import shortid from 'shortid';
import { exportChart } from '../../explore/exploreUtils';
import * as actions from '../actions';
import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger';
import { t } from '../../locales';
import Button from '../../components/Button';

const propTypes = {
Expand Down
3 changes: 1 addition & 2 deletions superset/assets/src/SqlLab/components/HighlightedSql.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import PropTypes from 'prop-types';

import SyntaxHighlighter, { registerLanguage } from 'react-syntax-highlighter/dist/light';
import sql from 'react-syntax-highlighter/dist/languages/hljs/sql';
import github from 'react-syntax-highlighter/dist/styles/hljs/github';
import { t } from '@superset-ui/translation';

import ModalTrigger from '../../components/ModalTrigger';
import { t } from '../../locales';

registerLanguage('sql', sql);

Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/QueryHistory.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Alert } from 'react-bootstrap';
import { t } from '@superset-ui/translation';

import QueryTable from './QueryTable';
import { t } from '../../locales';

const propTypes = {
queries: PropTypes.array.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/QuerySearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'react-bootstrap';
import Select from 'react-select';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/core';

import Loading from '../../components/Loading';
Expand All @@ -14,7 +15,6 @@ import {
} from '../../modules/dates';
import { STATUS_OPTIONS, TIME_OPTIONS } from '../constants';
import AsyncSelect from '../../components/AsyncSelect';
import { t } from '../../locales';

const propTypes = {
actions: PropTypes.object.isRequired,
Expand Down
4 changes: 2 additions & 2 deletions superset/assets/src/SqlLab/components/QueryTable.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';

import moment from 'moment';
import { Table } from 'reactable';
import { Label, ProgressBar, Well } from 'react-bootstrap';
import { t } from '@superset-ui/translation';

import Link from './Link';
import ResultSet from './ResultSet';
import ModalTrigger from '../../components/ModalTrigger';
import HighlightedSql from './HighlightedSql';
import { fDuration } from '../../modules/dates';
import { storeQuery } from '../../utils/common';
import QueryStateLabel from './QueryStateLabel';
import { t } from '../../locales';

const propTypes = {
columns: PropTypes.array,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/ResultSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Alert, Button, ButtonGroup, ProgressBar } from 'react-bootstrap';
import shortid from 'shortid';
import { t } from '@superset-ui/translation';

import Loading from '../../components/Loading';
import ExploreResultsButton from './ExploreResultsButton';
import HighlightedSql from './HighlightedSql';
import FilterableTable from '../../components/FilterableTable/FilterableTable';
import QueryStateLabel from './QueryStateLabel';
import { t } from '../../locales';

const propTypes = {
actions: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { t } from '@superset-ui/translation';

import Button from '../../components/Button';
import { t } from '../../locales';

const propTypes = {
allowAsync: PropTypes.bool.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/SaveQuery.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { FormControl, FormGroup, Row, Col } from 'react-bootstrap';
import { t } from '@superset-ui/translation';

import Button from '../../components/Button';
import ModalTrigger from '../../components/ModalTrigger';
import { t } from '../../locales';

const propTypes = {
defaultLabel: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/ShareSqlLabQuery.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Popover, OverlayTrigger } from 'react-bootstrap';
import { t } from '@superset-ui/translation';

import Button from '../../components/Button';
import CopyToClipboard from '../../components/CopyToClipboard';
import { storeQuery } from '../../utils/common';
import { getClientErrorObject } from '../../modules/utils';
import { t } from '../../locales';
import withToasts from '../../messageToasts/enhancers/withToasts';

const propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/SouthPane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import shortid from 'shortid';
import { Alert, Label, Tab, Tabs } from 'react-bootstrap';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { t } from '@superset-ui/translation';

import * as Actions from '../actions';
import QueryHistory from './QueryHistory';
import ResultSet from './ResultSet';
import { STATUS_OPTIONS, STATE_BSSTYLE_MAP } from '../constants';
import { t } from '../../locales';

/*
editorQueries are queries executed by users passed from SqlEditor component
Expand Down
3 changes: 1 addition & 2 deletions superset/assets/src/SqlLab/components/SqlEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Collapse,
} from 'react-bootstrap';
import SplitPane from 'react-split-pane';
import { t } from '@superset-ui/translation';

import Button from '../../components/Button';
import TemplateParamsEditor from './TemplateParamsEditor';
Expand All @@ -26,8 +27,6 @@ import SqlEditorLeftBar from './SqlEditorLeftBar';
import AceEditorWrapper from './AceEditorWrapper';
import { STATE_BSSTYLE_MAP } from '../constants';
import RunQueryActionButton from './RunQueryActionButton';
import { t } from '../../locales';


const propTypes = {
actions: PropTypes.object.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/SqlEditorLeftBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { ControlLabel, Button } from 'react-bootstrap';
import { connect } from 'react-redux';
import Select from 'react-virtualized-select';
import createFilterOptions from 'react-select-fast-filter-options';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/core';

import TableElement from './TableElement';
import AsyncSelect from '../../components/AsyncSelect';
import RefreshLabel from '../../components/RefreshLabel';
import { t } from '../../locales';

const propTypes = {
queryEditor: PropTypes.object.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/components/TabbedSqlEditors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { DropdownButton, MenuItem, Tab, Tabs } from 'react-bootstrap';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import URI from 'urijs';
import { t } from '@superset-ui/translation';

import * as Actions from '../actions';
import SqlEditor from './SqlEditor';
import { areArraysShallowEqual } from '../../reduxUtils';
import { t } from '../../locales';
import TabStatusIcon from './TabStatusIcon';

const propTypes = {
Expand Down
3 changes: 1 addition & 2 deletions superset/assets/src/SqlLab/components/TableElement.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';

import { ButtonGroup, Collapse, Well } from 'react-bootstrap';
import shortid from 'shortid';
import { t } from '@superset-ui/translation';

import CopyToClipboard from '../../components/CopyToClipboard';
import Link from './Link';
import ColumnElement from './ColumnElement';
import ModalTrigger from '../../components/ModalTrigger';
import Loading from '../../components/Loading';
import { t } from '../../locales';

const propTypes = {
table: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Badge } from 'react-bootstrap';

import AceEditor from 'react-ace';
import 'brace/mode/sql';
import 'brace/mode/json';
import 'brace/mode/html';
import 'brace/mode/markdown';
import 'brace/theme/textmate';

import { t } from '@superset-ui/translation';

import ModalTrigger from '../../components/ModalTrigger';
import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger';
import Button from '../../components/Button';
import { t } from '../../locales';

const propTypes = {
onChange: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/SqlLab/getInitialState.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import shortid from 'shortid';
import { t } from '../locales';
import { t } from '@superset-ui/translation';
import getToastsFromPyFlashMessages from '../messageToasts/utils/getToastsFromPyFlashMessages';

export default function getInitialState({ defaultDbId, ...restBootstrapData }) {
Expand Down
4 changes: 2 additions & 2 deletions superset/assets/src/SqlLab/reducers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { combineReducers } from 'redux';
import shortid from 'shortid';
import messageToasts from '../messageToasts/reducers';
import { t } from '@superset-ui/translation';

import messageToasts from '../messageToasts/reducers';
import getInitialState from './getInitialState';
import * as actions from './actions';
import { now } from '../modules/dates';
Expand All @@ -13,7 +14,6 @@ import {
getFromArr,
addToArr,
} from '../reduxUtils';
import { t } from '../locales';

export const sqlLabReducer = function (state = {}, action) {
const actionHandlers = {
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/addSlice/AddSliceContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Button, Panel } from 'react-bootstrap';
import Select from 'react-virtualized-select';
import { t } from '@superset-ui/translation';
import visTypes from '../explore/visTypes';
import { t } from '../locales';

const propTypes = {
datasources: PropTypes.arrayOf(PropTypes.shape({
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/chart/chartAction.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* global window, AbortController */
/* eslint no-undef: 'error' */
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/core';
import { getExploreUrlAndPayload, getAnnotationJsonUrl } from '../explore/exploreUtils';
import { requiresQuery, ANNOTATION_SOURCE_TYPES } from '../modules/AnnotationTypes';
import { addDangerToast } from '../messageToasts/actions';
import { Logger, LOG_ACTIONS_LOAD_CHART } from '../logger';
import { getClientErrorObject } from '../modules/utils';
import { TIME_RANGE_SEPARATOR } from '../utils/common';
import { t } from '../locales';

export const CHART_UPDATE_STARTED = 'CHART_UPDATE_STARTED';
export function chartUpdateStarted(queryController, latestQueryFormData, key) {
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/chart/chartReducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint camelcase: 0 */
import { t } from '@superset-ui/translation';
import { now } from '../modules/dates';
import * as actions from './chartAction';
import { t } from '../locales';

export const chart = {
id: 0,
Expand Down
3 changes: 1 addition & 2 deletions superset/assets/src/components/AlteredSliceTag.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Table, Tr, Td, Thead, Th } from 'reactable';
import { isEqual, isEmpty } from 'lodash';

import { t } from '@superset-ui/translation';
import TooltipWrapper from './TooltipWrapper';
import { controls } from '../explore/controls';
import ModalTrigger from './ModalTrigger';
import { t } from '../locales';

const propTypes = {
origFormData: PropTypes.object.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/AsyncSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import Select from 'react-select';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/core';
import { t } from '../locales';

const propTypes = {
dataEndpoint: PropTypes.string.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/CachedLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Label } from 'react-bootstrap';
import moment from 'moment';
import { t } from '@superset-ui/translation';
import TooltipWrapper from './TooltipWrapper';
import { t } from '../locales';

const propTypes = {
onClick: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/CopyToClipboard.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Tooltip, OverlayTrigger, MenuItem } from 'react-bootstrap';
import { t } from '../locales';
import { t } from '@superset-ui/translation';

const propTypes = {
copyNode: PropTypes.node,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/EditableTitle.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { t } from '@superset-ui/translation';
import TooltipWrapper from './TooltipWrapper';
import { t } from '../locales';

const propTypes = {
title: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/FaveStar.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import { t } from '@superset-ui/translation';
import TooltipWrapper from './TooltipWrapper';
import { t } from '../locales';

const propTypes = {
itemId: PropTypes.number.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/RefreshChartOverlay.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { t } from '@superset-ui/translation';
import Button from '../components/Button';
import { t } from '../locales';

const propTypes = {
height: PropTypes.number.isRequired,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/components/TableLoader.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Table, Tr, Td } from 'reactable';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/core';

import withToasts from '../messageToasts/enhancers/withToasts';
import { t } from '../locales';
import Loading from '../components/Loading';
import '../../stylesheets/reactable-pagination.css';

Expand Down
Loading