1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Fixing a bug for component configs edit (no files selected before)

This commit is contained in:
Sonja Happ 2020-08-31 09:51:21 +02:00
parent 9d8e9c4364
commit 444a3c29ef

View file

@ -53,8 +53,13 @@ class EditConfigDialog extends React.Component {
for(let e of this.state.selectedFiles){
IDs.push(e.id)
}
if (JSON.stringify(IDs) !== JSON.stringify(this.props.config.fileIDs)){
data.fileIDs = IDs;
if(this.props.config.fileIDs !== null && this.props.config.fileIDs !== undefined) {
if (JSON.stringify(IDs) !== JSON.stringify(this.props.config.fileIDs)) {
data.fileIDs = IDs;
}
}
else{
data.fileIDs = IDs
}
//forward modified config to callback function
@ -96,10 +101,12 @@ class EditConfigDialog extends React.Component {
// determine list of selected files incl id and filename
let selectedFiles = []
for(let selectedFileID of this.props.config.fileIDs){
for (let file of this.props.files){
if (file.id === selectedFileID){
selectedFiles.push({name: file.name, id: file.id})
if(this.props.config.fileIDs !== null && this.props.config.fileIDs !== undefined) {
for (let selectedFileID of this.props.config.fileIDs) {
for (let file of this.props.files) {
if (file.id === selectedFileID) {
selectedFiles.push({name: file.name, id: file.id})
}
}
}
}