mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Edit-Dialog now opens automatically after adding new component configuration
This commit is contained in:
parent
d644854e1f
commit
0b84d33957
1 changed files with 17 additions and 5 deletions
|
@ -54,7 +54,6 @@ class Scenario extends React.Component {
|
|||
if (prevState == null) {
|
||||
prevState = {};
|
||||
}
|
||||
|
||||
// get selected scenario
|
||||
const sessionToken = localStorage.getItem("token");
|
||||
|
||||
|
@ -72,6 +71,16 @@ class Scenario extends React.Component {
|
|||
|
||||
// obtain all component configurations of a scenario
|
||||
let configs = ConfigStore.getState().filter(config => config.scenarioID === parseInt(props.match.params.scenario, 10));
|
||||
let editConfigModal = prevState.editConfigModal || false;
|
||||
let modalConfigData = (prevState.modalConfigData !== {} && prevState.modalConfigData !== undefined )? prevState.modalConfigData : {};
|
||||
let modalConfigIndex = 0;
|
||||
|
||||
if((typeof prevState.configs !== "undefined") && (prevState.newConfig === true ) && (configs.length !== prevState.configs.length)){
|
||||
let index = configs.length -1;
|
||||
editConfigModal = true;
|
||||
modalConfigData = configs[index];
|
||||
modalConfigIndex = index;
|
||||
}
|
||||
|
||||
// obtain all files of a scenario
|
||||
let files = FileStore.getState().filter(file => file.scenarioID === parseInt(props.match.params.scenario, 10));
|
||||
|
@ -86,14 +95,15 @@ class Scenario extends React.Component {
|
|||
dashboards,
|
||||
signals,
|
||||
files,
|
||||
editConfigModal,
|
||||
modalConfigData,
|
||||
modalConfigIndex,
|
||||
ics: ICStore.getState(),
|
||||
|
||||
deleteConfigModal: false,
|
||||
importConfigModal: false,
|
||||
editConfigModal: prevState.editConfigModal || false,
|
||||
modalConfigData: (prevState.modalConfigData !== {} && prevState.modalConfigData !== undefined )? prevState.modalConfigData : {},
|
||||
newConfig: prevState.newConfig || false,
|
||||
selectedConfigs: [],
|
||||
modalConfigIndex: 0,
|
||||
filesEditModal: prevState.filesEditModal || false,
|
||||
filesEditSaveState: prevState.filesEditSaveState || [],
|
||||
|
||||
|
@ -183,10 +193,12 @@ class Scenario extends React.Component {
|
|||
token: this.state.sessionToken
|
||||
});
|
||||
|
||||
this.setState({newConfig: true});
|
||||
|
||||
}
|
||||
|
||||
closeEditConfigModal(data) {
|
||||
this.setState({ editConfigModal: false });
|
||||
this.setState({ editConfigModal: false, newConfig: false });
|
||||
|
||||
if (data) {
|
||||
AppDispatcher.dispatch({
|
||||
|
|
Loading…
Add table
Reference in a new issue