aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts')
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts14
1 files changed, 12 insertions, 2 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 a0e8ca9365..96ce7d5fb4 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
@@ -802,6 +802,13 @@ export class GeneralViewModel {
}
this.$scope.component.selectedCategory = this.$scope.componentCategories.selectedCategory;
if (this.$scope.component.selectedCategory) {
+ this.$scope.roleOption = null;
+ (<Service>this.$scope.component).serviceRole = null;
+ this.$scope.othersFlag = false;
+ this.$scope.functionOption = null;
+ (<Service>this.$scope.component).serviceFunction = null;
+ this.$scope.othersRoleFlag = false;
+
this.$scope.component.categories = this.convertCategoryStringToOneArray();
this.$scope.component.icon = DEFAULT_ICON;
if (this.$scope.component.categories[0].metadataKeys) {
@@ -811,6 +818,7 @@ export class GeneralViewModel {
}
if (metadataKey.name === 'Service Role') {
this.$scope.roleOption = this.$scope.component.categorySpecificMetadata[metadataKey.name];
+ (<Service>this.$scope.component).serviceRole = this.$scope.roleOption;
}
if (metadataKey.name === 'Service Function') {
this.$scope.functionOption = this.$scope.component.categorySpecificMetadata[metadataKey.name];
@@ -951,8 +959,10 @@ export class GeneralViewModel {
this.$scope.isMetadataKeyForComponentCategoryService = (key: string, attribute: string): boolean => {
let metadatakey = this.getMetadataKey(key);
- if (metadatakey && (!this.$scope.component[attribute] || !metadatakey.validValues.find(v => v === this.$scope.component[attribute]))) {
- this.$scope.component[attribute] = metadatakey.defaultValue;
+ if (attribute != 'serviceFunction' && attribute != 'serviceRole') {
+ if (metadatakey && (!this.$scope.component[attribute] || !metadatakey.validValues.find(v => v === this.$scope.component[attribute]))) {
+ this.$scope.component[attribute] = metadatakey.defaultValue;
+ }
}
return metadatakey != null;
}