forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dashboard] Add alert on user delete root level tab (apache#5771)
- Loading branch information
Grace Guo
authored
Sep 6, 2018
1 parent
5616d7b
commit 0c98ecb
Showing
6 changed files
with
131 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
superset/assets/src/dashboard/components/DeleteComponentModal.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button } from 'react-bootstrap'; | ||
|
||
import ModalTrigger from '../../components/ModalTrigger'; | ||
import { t } from '../../locales'; | ||
|
||
const propTypes = { | ||
triggerNode: PropTypes.node.isRequired, | ||
onDelete: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default class DeleteComponentModal extends React.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.modal = null; | ||
this.close = this.close.bind(this); | ||
this.deleteTab = this.deleteTab.bind(this); | ||
this.setModalRef = this.setModalRef.bind(this); | ||
} | ||
|
||
setModalRef(ref) { | ||
this.modal = ref; | ||
} | ||
|
||
close() { | ||
this.modal.close(); | ||
} | ||
|
||
deleteTab() { | ||
this.modal.close(); | ||
this.props.onDelete(); | ||
} | ||
|
||
render() { | ||
return ( | ||
<ModalTrigger | ||
ref={this.setModalRef} | ||
triggerNode={this.props.triggerNode} | ||
modalBody={ | ||
<div className="delete-component-modal"> | ||
<h1>{t('Delete dashboard tab?')}</h1> | ||
<div> | ||
Deleting a tab will remove all content within it. You may still | ||
reverse this action with the <b>undo</b> button (cmd + z) until | ||
you save your changes. | ||
</div> | ||
<div className="delete-modal-actions-container"> | ||
<Button onClick={this.close}>{t('Cancel')}</Button> | ||
<Button bsStyle="primary" onClick={this.deleteTab}> | ||
{t('Delete')} | ||
</Button> | ||
</div> | ||
</div> | ||
} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
DeleteComponentModal.propTypes = propTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters