Merge pull request #1240 from matrix-org/rxl881/deleteWidgets
Hide widget panel while it is being deleted.pull/21833/head
commit
b589fcc3b0
|
@ -50,6 +50,7 @@ export default React.createClass({
|
||||||
loading: false,
|
loading: false,
|
||||||
widgetUrl: this.props.url,
|
widgetUrl: this.props.url,
|
||||||
error: null,
|
error: null,
|
||||||
|
deleting: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -101,6 +102,7 @@ export default React.createClass({
|
||||||
|
|
||||||
_onDeleteClick: function() {
|
_onDeleteClick: function() {
|
||||||
console.log("Delete widget %s", this.props.id);
|
console.log("Delete widget %s", this.props.id);
|
||||||
|
this.setState({deleting: true});
|
||||||
MatrixClientPeg.get().sendStateEvent(
|
MatrixClientPeg.get().sendStateEvent(
|
||||||
this.props.room.roomId,
|
this.props.room.roomId,
|
||||||
'im.vector.modular.widgets',
|
'im.vector.modular.widgets',
|
||||||
|
@ -110,6 +112,7 @@ export default React.createClass({
|
||||||
console.log('Deleted widget');
|
console.log('Deleted widget');
|
||||||
}, (e) => {
|
}, (e) => {
|
||||||
console.error('Failed to delete widget', e);
|
console.error('Failed to delete widget', e);
|
||||||
|
this.setState({deleting: false});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -124,6 +127,12 @@ export default React.createClass({
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
let appTileBody;
|
let appTileBody;
|
||||||
|
|
||||||
|
// Don't render widget if it is in the process of being deleted
|
||||||
|
if (this.state.deleting) {
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
appTileBody = (
|
appTileBody = (
|
||||||
<div> Loading... </div>
|
<div> Loading... </div>
|
||||||
|
|
Loading…
Reference in New Issue