summaryrefslogtreecommitdiffstats
path: root/catalog-ui
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
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')
-rw-r--r--catalog-ui/src/app/models/base-types.ts1
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts16
2 files changed, 12 insertions, 5 deletions
diff --git a/catalog-ui/src/app/models/base-types.ts b/catalog-ui/src/app/models/base-types.ts
index 526355e0f8..69aafa357c 100644
--- a/catalog-ui/src/app/models/base-types.ts
+++ b/catalog-ui/src/app/models/base-types.ts
@@ -21,6 +21,7 @@
interface ListBaseTypesResponse {
baseTypes: BaseTypeResponse[];
required: boolean;
+ defaultBaseType: string;
}
interface BaseTypeResponse {
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