mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
fixed issue when signals were not added on config import
Signed-off-by: Andrii Podriez <andrey5577990@gmail.com>
This commit is contained in:
parent
c53400faab
commit
a298ed9430
1 changed files with 15 additions and 7 deletions
|
@ -103,6 +103,7 @@ const ConfigsTable = ({scenario, ics}) => {
|
|||
|
||||
const importConfig = async (data) => {
|
||||
if(data){
|
||||
//imported config
|
||||
const config = {
|
||||
config: {
|
||||
ScenarioID: scenario.id,
|
||||
|
@ -114,7 +115,20 @@ const ConfigsTable = ({scenario, ics}) => {
|
|||
}
|
||||
|
||||
try {
|
||||
await addComponentConfig(config).unwrap();
|
||||
const res = await addComponentConfig(config).unwrap();
|
||||
if(res.config){
|
||||
if(data.config.inputMapping){
|
||||
//after importing new config, we need to import according signals
|
||||
for(let i = 0; i < data.config.inputMapping.length; i++){
|
||||
data.config.inputMapping[i].configID = res.config.id;
|
||||
await addSignalToConfig(data.config.inputMapping[i]).unwrap();
|
||||
}
|
||||
for(let i = 0; i < data.config.outputMapping.length; i++){
|
||||
data.config.outputMapping[i].configID = res.config.id;
|
||||
await addSignalToConfig(data.config.outputMapping[i]).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
notificationsDataManager.addNotification(NotificationsFactory.LOAD_ERROR(err.data.message));
|
||||
}
|
||||
|
@ -125,8 +139,6 @@ const ConfigsTable = ({scenario, ics}) => {
|
|||
}
|
||||
|
||||
const exportConfig = (index) => {
|
||||
|
||||
|
||||
// show save dialog
|
||||
const blob = new Blob([JSON.stringify(config, null, 2)], { type: 'application/json' });
|
||||
FileSaver.saveAs(blob, 'config-' + config.name + '.json');
|
||||
|
@ -250,10 +262,6 @@ const ConfigsTable = ({scenario, ics}) => {
|
|||
}
|
||||
}
|
||||
|
||||
const handleSignalMapping = () => {
|
||||
|
||||
}
|
||||
|
||||
const toggleCheckAllConfigs = () => {
|
||||
if(checkedConfigsIDs.length === configs.length){
|
||||
setCheckedConfigsIDs([]);
|
||||
|
|
Loading…
Add table
Reference in a new issue