service role and service function metadata not imported 13/136313/3
authorfranciscovila <javier.paradela.vila@est.tech>
Wed, 25 Oct 2023 09:49:12 +0000 (10:49 +0100)
committerMichael Morris <michael.morris@est.tech>
Thu, 26 Oct 2023 17:36:09 +0000 (17:36 +0000)
Issue-ID: SDC-4667
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: I5aa1c1b2bb5cce292cf7ddd4541394177f6af465

catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts

index 96ce7d5..86bcab0 100644 (file)
@@ -396,6 +396,12 @@ export class GeneralViewModel {
     }
 
     private setFunctionRole = (service : Service) : void => {
+        if (!service.serviceFunction && service.componentMetadata) {
+            service.serviceFunction = service.componentMetadata.serviceFunction;
+        }
+        if (!service.serviceRole && service.componentMetadata) {
+            service.serviceRole = service.componentMetadata.serviceRole;
+        }
         if (service.serviceFunction) {
             const functionList : string[] = this.$scope.getMetadataKeyValidValues('Service Function');
             if (functionList.find(value => value == service.serviceFunction) != undefined) {
@@ -817,7 +823,12 @@ export class GeneralViewModel {
                             this.$scope.component.categorySpecificMetadata[metadataKey.name] = metadataKey.defaultValue ? metadataKey.defaultValue : "";
                         }
                         if (metadataKey.name === 'Service Role') {
-                            this.$scope.roleOption = this.$scope.component.categorySpecificMetadata[metadataKey.name];
+                            if ((<Service>this.$scope.component).componentMetadata && (<Service>this.$scope.component).componentMetadata.serviceRole) {
+                                this.$scope.roleOption = (<Service>this.$scope.component).componentMetadata.serviceRole;
+                            }
+                            else {
+                                this.$scope.roleOption = this.$scope.component.categorySpecificMetadata[metadataKey.name];
+                            }
                             (<Service>this.$scope.component).serviceRole = this.$scope.roleOption;
                         }
                         if (metadataKey.name === 'Service Function') {