From 72fb224bb60cbc5c511d744d8c6d2fff14962446 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 8 Mar 2021 14:56:48 +0100 Subject: [PATCH] scenario: we shouldnt make any assumptions in the frontend on how an IC will use any files. This is IC specific behaviour. --- src/scenario/scenario.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/scenario/scenario.js b/src/scenario/scenario.js index 7770b64..98346d6 100644 --- a/src/scenario/scenario.js +++ b/src/scenario/scenario.js @@ -580,22 +580,18 @@ class Scenario extends React.Component { * File modification methods ############################################## */ - getListOfFiles(fileIDs, types) { - - let fileList = ''; + getListOfFiles(files, fileIDs) { + let fileList = []; for (let id of fileIDs) { - for (let file of this.state.files) { - if (file.id === id && types.some(e => file.type.includes(e))) { - if (fileList === '') { - fileList = file.name - } else { - fileList = fileList + ';' + file.name; - } + for (let file of files) { + if (file.id === id) { + fileList.push(file.name) } } } - return fileList; + + return fileList.join(';'); } /* ############################################## @@ -837,13 +833,14 @@ class Scenario extends React.Component { checkboxDisabled={(index) => !this.usesExternalIC(index)} onChecked={(index, event) => this.onConfigChecked(index, event)} width='30' /> - - this.getListOfFiles(fileIDs, ['json', 'JSON'])} /> + this.getListOfFiles(fileIDs, ['xml'])} - editButton + modifier={(fileIDs) => this.getListOfFiles(this.state.files, fileIDs)} onEdit={(index) => this.startPintura(index)} />