Skip to content

Commit

Permalink
fix: enforce mandatory chart name on save and edit (apache#10482)
Browse files Browse the repository at this point in the history
* fix: show empty charts as empty in chart list view

* migrate ControlLabel to FormLabel and enforce requred fields

* lint

* reorder buttons
  • Loading branch information
villebro authored and Jason Davis committed Aug 2, 2020
1 parent 3c9686a commit 70c294e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions superset-frontend/src/explore/components/PropertiesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,18 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) {
</Row>
</Modal.Body>
<Modal.Footer>
<Button type="button" bsSize="sm" onClick={onHide}>
{t('Cancel')}
</Button>
<Button
type="submit"
bsSize="sm"
bsStyle="primary"
className="m-r-5"
disabled={!owners || submitting}
disabled={!owners || submitting || !name}
>
{t('Save')}
</Button>
<Button type="button" bsSize="sm" onClick={onHide}>
{t('Cancel')}
</Button>
<Dialog ref={errorDialog} />
</Modal.Footer>
</form>
Expand Down
13 changes: 9 additions & 4 deletions superset-frontend/src/explore/components/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import {
Button,
FormControl,
FormGroup,
ControlLabel,
Modal,
Radio,
} from 'react-bootstrap';
import FormLabel from 'src/components/FormLabel';
import { CreatableSelect } from 'src/components/Select/SupersetStyledSelect';
import { t } from '@superset-ui/translation';
import ReactMarkdown from 'react-markdown';
Expand Down Expand Up @@ -176,7 +176,7 @@ class SaveModal extends React.Component {
</FormGroup>
<hr />
<FormGroup>
<ControlLabel>{t('Chart name')}</ControlLabel>
<FormLabel required>{t('Chart name')}</FormLabel>
<FormControl
name="new_slice_name"
type="text"
Expand All @@ -187,7 +187,7 @@ class SaveModal extends React.Component {
/>
</FormGroup>
<FormGroup>
<ControlLabel>{t('Add to dashboard')}</ControlLabel>
<FormLabel required>{t('Add to dashboard')}</FormLabel>
<CreatableSelect
id="dashboard-creatable-select"
className="save-modal-selector"
Expand Down Expand Up @@ -224,7 +224,11 @@ class SaveModal extends React.Component {
type="button"
id="btn_modal_save_goto_dash"
bsSize="sm"
disabled={canNotSaveToDash || !this.state.newDashboardName}
disabled={
canNotSaveToDash ||
!this.state.newSliceName ||
!this.state.newDashboardName
}
onClick={this.saveOrOverwrite.bind(this, true)}
>
{t('Save & go to dashboard')}
Expand All @@ -235,6 +239,7 @@ class SaveModal extends React.Component {
bsSize="sm"
bsStyle="primary"
onClick={this.saveOrOverwrite.bind(this, false)}
disabled={!this.state.newSliceName}
>
{t('Save')}
</Button>
Expand Down

0 comments on commit 70c294e

Please sign in to comment.