summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models
diff options
context:
space:
mode:
authorimamSidero <imam.hussain@est.tech>2022-10-24 17:20:46 +0100
committerMichael Morris <michael.morris@est.tech>2022-10-25 13:05:19 +0000
commit3d79660270cc259688e0ba20150286c1680c7559 (patch)
tree72fbec98f6e785c4d1ff89c193c8d0778606fefe /catalog-ui/src/app/view-models
parent47f96dd966663f7f46b719451c0752721a2940a3 (diff)
Add default baseType to the substitution type
Enabling default baseType in substitution type to be selected Issue-ID: SDC-4229 Signed-off-by: Imam hussain <imam.hussain@est.tech> Change-Id: I869ede4c4e030adc3c4418c28ed787b4c10248dd
Diffstat (limited to 'catalog-ui/src/app/view-models')
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts16
1 files changed, 11 insertions, 5 deletions
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 77c93301b2..2d029cd332 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
@@ -910,13 +910,19 @@ export class GeneralViewModel {
this.$scope.isBaseTypeRequired = baseTypeResponseList.required;
this.$scope.baseTypes = [];
this.$scope.baseTypeVersions = [];
+ let defaultBaseType = baseTypeResponseList.defaultBaseType;
baseTypeResponseList.baseTypes.forEach(baseType => this.$scope.baseTypes.push(baseType.toscaResourceName));
- if (this.$scope.isBaseTypeRequired) {
- const baseType = baseTypeResponseList.baseTypes[0];
- baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
- if(!this.$scope.component.derivedFromGenericType) {
- this.$scope.component.derivedFromGenericType = baseType.toscaResourceName;
+ if (this.$scope.isBaseTypeRequired || defaultBaseType != null) {
+ let baseType = baseTypeResponseList.baseTypes[0];
+ if(defaultBaseType != null){
+ baseTypeResponseList.baseTypes.forEach(baseTypeObj => {
+ if(baseTypeObj.toscaResourceName == defaultBaseType) {
+ baseType = baseTypeObj;
+ }
+ });
}
+ baseType.versions.reverse().forEach(version => this.$scope.baseTypeVersions.push(version));
+ this.$scope.component.derivedFromGenericType = baseType.toscaResourceName;
this.$scope.component.derivedFromGenericVersion = this.$scope.baseTypeVersions[0];
this.$scope.showBaseTypeVersions = true;
return