diff --git a/superset-frontend/src/CRUD/Field.jsx b/superset-frontend/src/CRUD/Field.jsx index 1425085ed8..bfd528bede 100644 --- a/superset-frontend/src/CRUD/Field.jsx +++ b/superset-frontend/src/CRUD/Field.jsx @@ -20,13 +20,13 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormGroup, - ControlLabel, HelpBlock, FormControl, OverlayTrigger, Tooltip, } from 'react-bootstrap'; +import FormLabel from 'src/components/FormLabel'; import './crud.less'; const propTypes = { @@ -61,7 +61,7 @@ export default class Field extends React.PureComponent { }); return ( - + {label || fieldKey} {compact && descr && ( )} - + {hookedControl} {!compact && descr && {descr}} diff --git a/superset-frontend/src/SqlLab/components/SaveQuery.jsx b/superset-frontend/src/SqlLab/components/SaveQuery.jsx index 025326a089..b9eb2de847 100644 --- a/superset-frontend/src/SqlLab/components/SaveQuery.jsx +++ b/superset-frontend/src/SqlLab/components/SaveQuery.jsx @@ -21,8 +21,9 @@ 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 Button from 'src/components/Button'; +import FormLabel from 'src/components/FormLabel'; +import ModalTrigger from 'src/components/ModalTrigger'; const propTypes = { query: PropTypes.object, @@ -91,9 +92,9 @@ class SaveQuery extends React.PureComponent { - + - + - + - + {description} - + {t('type "delete" to confirm')} ) => - setDisableChange(event.target.value !== 'DELETE') + setDisableChange(event.target.value.toUpperCase() !== 'DELETE') } /> diff --git a/superset-frontend/src/components/FormLabel.tsx b/superset-frontend/src/components/FormLabel.tsx new file mode 100644 index 0000000000..e1979f579c --- /dev/null +++ b/superset-frontend/src/components/FormLabel.tsx @@ -0,0 +1,46 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +// import styled from '@superset-ui/style'; +import React, { ReactNode } from 'react'; +import { ControlLabel } from 'react-bootstrap'; + +export type FormLabelProps = { + children: ReactNode; + htmlFor?: string; + required?: boolean; +}; + +export default function FormLabel({ + children, + htmlFor, + required = false, +}: FormLabelProps) { + return ( + <> + + {children} + {required && ( + + * + + )} + + + ); +} diff --git a/superset-frontend/src/components/TableSelector.jsx b/superset-frontend/src/components/TableSelector.jsx index d18fea92a1..33d43d87ae 100644 --- a/superset-frontend/src/components/TableSelector.jsx +++ b/superset-frontend/src/components/TableSelector.jsx @@ -21,10 +21,12 @@ import styled from '@superset-ui/style'; import PropTypes from 'prop-types'; import rison from 'rison'; import { Select, AsyncSelect } from 'src/components/Select'; -import { ControlLabel, Label } from 'react-bootstrap'; +import { Label } from 'react-bootstrap'; import { t } from '@superset-ui/translation'; import { SupersetClient } from '@superset-ui/connection'; +import FormLabel from 'src/components/FormLabel'; + import SupersetAsyncSelect from './AsyncSelect'; import RefreshLabel from './RefreshLabel'; import './TableSelector.less'; @@ -393,14 +395,14 @@ export default class TableSelector extends React.PureComponent { renderSeeTableLabel() { return (
- + {t('See table schema')}{' '} {this.props.schema && ( ({this.state.tableOptions.length} in {this.props.schema}) )} - +
); } diff --git a/superset-frontend/src/dashboard/components/FilterIndicatorTooltip.jsx b/superset-frontend/src/dashboard/components/FilterIndicatorTooltip.jsx index 93e42fbe5b..e8f9ce4ebc 100644 --- a/superset-frontend/src/dashboard/components/FilterIndicatorTooltip.jsx +++ b/superset-frontend/src/dashboard/components/FilterIndicatorTooltip.jsx @@ -20,6 +20,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { t } from '@superset-ui/translation'; import { isEmpty } from 'lodash'; +import FormLabel from 'src/components/FormLabel'; const propTypes = { label: PropTypes.string.isRequired, @@ -41,7 +42,7 @@ export default function FilterIndicatorTooltip({ return (
- + {label}: {displayValue}
diff --git a/superset-frontend/src/dashboard/components/PropertiesModal.jsx b/superset-frontend/src/dashboard/components/PropertiesModal.jsx index 6612082d38..77c29952e4 100644 --- a/superset-frontend/src/dashboard/components/PropertiesModal.jsx +++ b/superset-frontend/src/dashboard/components/PropertiesModal.jsx @@ -25,10 +25,11 @@ import AceEditor from 'react-ace'; import rison from 'rison'; import { t } from '@superset-ui/translation'; import { SupersetClient } from '@superset-ui/connection'; -import '../stylesheets/buttons.less'; +import FormLabel from 'src/components/FormLabel'; import getClientErrorObject from '../../utils/getClientErrorObject'; import withToasts from '../../messageToasts/enhancers/withToasts'; +import '../stylesheets/buttons.less'; const propTypes = { dashboardId: PropTypes.number.isRequired, @@ -202,9 +203,7 @@ class PropertiesModal extends React.PureComponent { - + {t('Title')} - + {t('URL Slug')}

{t('Access')}

- + {t('Owners')} {isAdvancedOpen && ( <> - + - + {label} ); } diff --git a/superset-frontend/src/explore/components/AdhocMetricEditPopover.jsx b/superset-frontend/src/explore/components/AdhocMetricEditPopover.jsx index d12f31ef11..8f7be4e706 100644 --- a/superset-frontend/src/explore/components/AdhocMetricEditPopover.jsx +++ b/superset-frontend/src/explore/components/AdhocMetricEditPopover.jsx @@ -18,14 +18,7 @@ */ import React from 'react'; import PropTypes from 'prop-types'; -import { - Button, - ControlLabel, - FormGroup, - Popover, - Tab, - Tabs, -} from 'react-bootstrap'; +import { Button, FormGroup, Popover, Tab, Tabs } from 'react-bootstrap'; import Select from 'src/components/Select'; import ace from 'brace'; import AceEditor from 'react-ace'; @@ -35,6 +28,8 @@ import 'brace/ext/language_tools'; import { t } from '@superset-ui/translation'; import { ColumnOption } from '@superset-ui/chart-controls'; +import FormLabel from 'src/components/FormLabel'; + import { AGGREGATES_OPTIONS } from '../constants'; import AdhocMetricEditPopoverTitle from './AdhocMetricEditPopoverTitle'; import columnType from '../propTypes/columnType'; @@ -251,9 +246,9 @@ export default class AdhocMetricEditPopover extends React.Component { title="Simple" > - + column - +
- + {this.props.leftNode && {this.props.leftNode}} )} {this.renderOptionalIcons()} - +
{this.props.rightNode && (
{this.props.rightNode}
diff --git a/superset-frontend/src/explore/components/EmbedCodeButton.jsx b/superset-frontend/src/explore/components/EmbedCodeButton.jsx index 5a6618fd25..2ed67256ec 100644 --- a/superset-frontend/src/explore/components/EmbedCodeButton.jsx +++ b/superset-frontend/src/explore/components/EmbedCodeButton.jsx @@ -21,7 +21,8 @@ import PropTypes from 'prop-types'; import { Popover, OverlayTrigger } from 'react-bootstrap'; import { t } from '@superset-ui/translation'; -import CopyToClipboard from './../../components/CopyToClipboard'; +import FormLabel from 'src/components/FormLabel'; +import CopyToClipboard from 'src/components/CopyToClipboard'; import { getExploreLongUrl } from '../exploreUtils'; const propTypes = { @@ -97,9 +98,7 @@ export default class EmbedCodeButton extends React.Component {
- + {t('Height')}
- + {t('Width')}

{t('Basic Information')}

- + - + {t('Description')}

{t('Configuration')}

- + {t('Cache Timeout')}

{t('Access')}

- + {t('Owners')} - {ctrl} + {ctrl} {this.renderFilterBadge(chartId, key, label)}
- + {label} {this.renderSelect(filterConfig)}
diff --git a/superset-frontend/stylesheets/superset.less b/superset-frontend/stylesheets/superset.less index aa3d4dba84..16ee9a99e8 100644 --- a/superset-frontend/stylesheets/superset.less +++ b/superset-frontend/stylesheets/superset.less @@ -326,6 +326,10 @@ table.table-no-hover tr:hover { margin-bottom: 10px; } +.m-l-4 { + margin-left: 4px; +} + .m-l-5 { margin-left: 5px; }