From 458bf21d934e356c20b69a1c7b0aae79197e1023 Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 14 Sep 2023 17:54:11 +0100 Subject: Improve error reporting during the service import Signed-off-by: Vasyl Razinkov Change-Id: I407d18e3b1c0757efb4623d73b21d98cbb76310a Issue-ID: SDC-4623 --- .../view-models/workspace/tabs/general/general-view-model.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'catalog-ui/src') diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts index 685f564f27..5065023cb4 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts @@ -304,8 +304,8 @@ export class GeneralViewModel { const errorMsg = this.$filter('translate')('IMPORT_FAILURE_MESSAGE_TEXT'); console.error(errorMsg, error); const errorDetails = { - 'Error': error.reason, - 'Details': error.message + 'Error': this.capitalize(error.reason), + 'Details': this.capitalize(error.message) }; this.modalServiceSdcUI.openErrorDetailModal('Error', this.$filter('translate')('IMPORT_FAILURE_MESSAGE_TEXT'), 'error-modal', errorDetails); @@ -339,7 +339,6 @@ export class GeneralViewModel { this.$scope.isShowOnboardingSelectionBrowse = false; } - //init file extensions based on the file that was imported. if (this.$scope.component.isResource() && (this.$scope.component).importedFile) { let fileName:string = (this.$scope.component).importedFile.filename; @@ -357,8 +356,6 @@ export class GeneralViewModel { //(this.$scope.component).importedFile.filetype="csar"; } - - this.$scope.setValidState(true); this.$scope.calculateUnique = (mainCategory:string, subCategory:string):string => { @@ -375,7 +372,6 @@ export class GeneralViewModel { this.$scope.originComponent.contactId = this.$scope.component.contactId; } - this.$scope.$on('$destroy', () => { this.EventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE_WITH_SAVE); this.EventListenerService.unRegisterObserver(EVENTS.ON_LIFECYCLE_CHANGE); @@ -383,6 +379,10 @@ export class GeneralViewModel { }; + private capitalize(s) { + return s && s[0].toUpperCase() + s.slice(1); + } + // Convert category string MainCategory_#_SubCategory to Array with one item (like the server except) private convertCategoryStringToOneArray = ():IMainCategory[] => { let tmp = this.$scope.component.selectedCategory.split("_#_"); -- cgit 1.2.3-korg