+ (<Service>this.$scope.component).ecompGeneratedNaming = true;
+ let blob = this.FileUtils.base64toBlob(service.importedFile.base64, "zip");
+ new ServiceCsarReader().read(blob).then(
+ (serviceCsar) => {
+ serviceCsar.serviceMetadata.contactId = this.cacheService.get("user").userId;
+ (<Service>this.$scope.component).setComponentMetadata(serviceCsar.serviceMetadata);
+ (<Service>this.$scope.component).model = serviceCsar.serviceMetadata.model;
+ this.$scope.onModelChange();
+ this.$scope.componentCategories.selectedCategory = serviceCsar.serviceMetadata.selectedCategory;
+ this.$scope.onCategoryChange();
+ serviceCsar.extraServiceMetadata.forEach((value: string, key: string) => {
+ if (this.getMetadataKey(key)) {
+ (<Service>this.$scope.component).categorySpecificMetadata[key] = value;
+ }
+ });
+ (<Service>this.$scope.component).derivedFromGenericType = serviceCsar.substitutionNodeType;
+ this.$scope.onBaseTypeChange();
+ },
+ (error) => {
+ const errorMsg = this.$filter('translate')('IMPORT_FAILURE_MESSAGE_TEXT');
+ console.error(errorMsg, error);
+ const errorDetails = {
+ 'Error': this.capitalize(error.reason),
+ 'Details': this.capitalize(error.message)
+ };
+ this.modalServiceSdcUI.openErrorDetailModal('Error', this.$filter('translate')('IMPORT_FAILURE_MESSAGE_TEXT'),
+ 'error-modal', errorDetails);
+ this.$state.go('dashboard');
+ });