X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-frontend%2Fsrc%2Fapp%2Fonboard%2Fonboard.component.ts;fp=dashboard%2Fwebapp-frontend%2Fsrc%2Fapp%2Fonboard%2Fonboard.component.ts;h=4f843db77fdf8ae923630a5bd615b0f014e681dd;hb=5447254cb207353b33e6a444cce8a7fd84cfd34a;hp=7f609a621cbc61c00f984b878d38e195d9162c67;hpb=854af18c26835319712aded05fdc3624502314a4;p=portal%2Fric-dashboard.git diff --git a/dashboard/webapp-frontend/src/app/onboard/onboard.component.ts b/dashboard/webapp-frontend/src/app/onboard/onboard.component.ts index 7f609a62..4f843db7 100644 --- a/dashboard/webapp-frontend/src/app/onboard/onboard.component.ts +++ b/dashboard/webapp-frontend/src/app/onboard/onboard.component.ts @@ -117,21 +117,24 @@ export class OnboardComponent implements OnInit { selectConfigFile(event) { - this.configFile = event.target.files[0]; - let fileReader = new FileReader(); - fileReader.onload = (e) => { - this.descriptor["config-file.json"] = JSON.parse(fileReader.result as string); + if (event.target.files.length) { + this.configFile = event.target.files[0]; + let fileReader = new FileReader(); + fileReader.onload = (e) => { + this.descriptor["config-file.json"] = JSON.parse(fileReader.result as string); + } + fileReader.readAsText(this.configFile); } - fileReader.readAsText(this.configFile); } selectControlsSchema(event) { - this.controlsSchema = event.target.files[0]; - let fileReader = new FileReader(); - fileReader.onload = (e) => { - this.descriptor["controls-schema.json"] = JSON.parse(fileReader.result as string); + if (event.target.files.length) { + this.controlsSchema = event.target.files[0]; + let fileReader = new FileReader(); + fileReader.onload = (e) => { + this.descriptor["controls-schema.json"] = JSON.parse(fileReader.result as string); + } + fileReader.readAsText(this.controlsSchema); } - fileReader.readAsText(this.controlsSchema); - } }