Fix child model being shown in UI 11/124411/3
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>
Mon, 20 Sep 2021 12:04:29 +0000 (13:04 +0100)
committerMichael Morris <michael.morris@est.tech>
Tue, 5 Oct 2021 13:32:20 +0000 (13:32 +0000)
Issue-ID: SDC-3734
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: Iadbbf93dc2a84a14df6b73a191d4c6d3e657f4d1

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

index a5e6021..0f7cab5 100644 (file)
 
 export class Model {
   name: string;
+  derivedFrom: string;
+  modelType: string;
 
   constructor(param?: any) {
     if (param) {
-      this.name = param;
+      this.name = param.name;
+      this.derivedFrom = param.derivedFrom;
+      this.modelType = param.modelType;
     }
   }
 
index 1bcf266..6c28fae 100644 (file)
@@ -489,7 +489,17 @@ export class GeneralViewModel {
 
             if (!this.$scope.isCreateMode() && this.$scope.isVspImport()){
                 this.modelService.getModels().subscribe((modelsFound: Model[]) => {
-                    modelsFound.sort().forEach(model => {this.$scope.models.push(model.name)});
+                    modelsFound.sort().forEach(model => {
+                        if (this.$scope.component.model != undefined) {
+                            if (model.modelType == "NORMATIVE_EXTENSION") {
+                                this.$scope.component.model = model.derivedFrom;
+                                this.$scope.models.push(model.derivedFrom)
+                            } else {
+                                this.$scope.component.model = model.name;
+                                this.$scope.models.push(model.name)
+                            }
+                        }
+                    });
                 });
             } else {
                 this.modelService.getModelsOfType("normative").subscribe((modelsFound: Model[]) => {