diff options
Diffstat (limited to 'catalog-ui')
-rw-r--r-- | catalog-ui/src/app/models/base-types.ts | 1 | ||||
-rw-r--r-- | catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts | 16 |
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 |