[dashboard] load list of slices at modal enter time (#3379)

This commit is contained in:
Maxime Beauchemin 2017-08-28 14:31:43 -07:00 committed by GitHub
parent a47a512808
commit 48b88e5241
2 changed files with 7 additions and 6 deletions

View File

@ -37,7 +37,11 @@ class SliceAdder extends React.Component {
}; };
} }
componentDidMount() { componentWillUnmount() {
this.slicesRequest.abort();
}
onEnterModal() {
const uri = '/sliceaddview/api/read?_flt_0_created_by=' + this.props.dashboard.curUserId; const uri = '/sliceaddview/api/read?_flt_0_created_by=' + this.props.dashboard.curUserId;
this.slicesRequest = $.ajax({ this.slicesRequest = $.ajax({
url: uri, url: uri,
@ -66,10 +70,6 @@ class SliceAdder extends React.Component {
}); });
} }
componentWillUnmount() {
this.slicesRequest.abort();
}
addSlices() { addSlices() {
this.props.dashboard.addSlicesToDashboard(Object.keys(this.state.selectionMap)); this.props.dashboard.addSlicesToDashboard(Object.keys(this.state.selectionMap));
} }
@ -173,6 +173,7 @@ class SliceAdder extends React.Component {
<ModalTrigger <ModalTrigger
triggerNode={this.props.triggerNode} triggerNode={this.props.triggerNode}
tooltip="Add a new slice to the dashboard" tooltip="Add a new slice to the dashboard"
beforeOpen={this.onEnterModal.bind(this)}
isButton isButton
modalBody={modalContent} modalBody={modalContent}
bsSize="large" bsSize="large"

View File

@ -67,7 +67,7 @@
"react-addons-shallow-compare": "^15.4.2", "react-addons-shallow-compare": "^15.4.2",
"react-alert": "^1.0.14", "react-alert": "^1.0.14",
"react-bootstrap": "^0.31.2", "react-bootstrap": "^0.31.2",
"react-bootstrap-table": "^3.1.7", "react-bootstrap-table": "^4.0.2",
"react-datetime": "^2.9.0", "react-datetime": "^2.9.0",
"react-dom": "^15.5.1", "react-dom": "^15.5.1",
"react-gravatar": "^2.6.1", "react-gravatar": "^2.6.1",