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:
parent
9d8e9c4364
commit
444a3c29ef
1 changed files with 13 additions and 6 deletions
|
@ -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})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue