mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
- add session userID as param to dispatcher
- fix issue with event handler for deletion of simulator
This commit is contained in:
parent
755784f64c
commit
edd7c4f39d
1 changed files with 18 additions and 10 deletions
|
@ -79,6 +79,7 @@ class Simulators extends Component {
|
|||
|
||||
return {
|
||||
sessionToken: UserStore.getState().token,
|
||||
sessionUserID: UserStore.getState().userid,
|
||||
simulators,
|
||||
modalSimulator: {},
|
||||
deleteModal: false,
|
||||
|
@ -90,11 +91,12 @@ class Simulators extends Component {
|
|||
componentWillMount() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-load',
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
|
||||
// Start timer for periodic refresh
|
||||
this.timer = window.setInterval(() => this.refresh(), 1000);
|
||||
this.timer = window.setInterval(() => this.refresh(), 5000);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
@ -104,7 +106,8 @@ class Simulators extends Component {
|
|||
refresh() {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-load',
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -116,7 +119,8 @@ class Simulators extends Component {
|
|||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-add',
|
||||
data,
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -135,12 +139,13 @@ class Simulators extends Component {
|
|||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-edit',
|
||||
data: simulator,
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
closeDeleteModal = confirmDelete => {
|
||||
closeDeleteModal(confirmDelete){
|
||||
this.setState({ deleteModal: false });
|
||||
|
||||
if (confirmDelete === false) {
|
||||
|
@ -150,7 +155,8 @@ class Simulators extends Component {
|
|||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-remove',
|
||||
data: this.state.modalSimulator,
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -171,7 +177,8 @@ class Simulators extends Component {
|
|||
AppDispatcher.dispatch({
|
||||
type: 'simulators/start-add',
|
||||
data,
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +214,8 @@ class Simulators extends Component {
|
|||
type: 'simulators/start-action',
|
||||
simulator: this.state.simulators[index],
|
||||
data: action.data,
|
||||
token: this.state.sessionToken
|
||||
token: this.state.sessionToken,
|
||||
userid: this.state.sessionUserID
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +318,7 @@ class Simulators extends Component {
|
|||
<EditSimulatorDialog show={this.state.editModal} onClose={data => this.closeEditModal(data)} simulator={this.state.modalSimulator} />
|
||||
<ImportSimulatorDialog show={this.state.importModal} onClose={data => this.closeImportModal(data)} />
|
||||
|
||||
<DeleteDialog title="simulator" name={_.get(this.state.modalSimulator, 'properties.name') || _.get(this.state.modalSimulator, 'rawProperties.name') || 'Unknown'} show={this.state.deleteModal} onClose={this.closeDeleteModal} />
|
||||
<DeleteDialog title="simulator" name={_.get(this.state.modalSimulator, 'properties.name') || _.get(this.state.modalSimulator, 'rawProperties.name') || 'Unknown'} show={this.state.deleteModal} onClose={(e) => this.closeDeleteModal(e)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue