diff options
author | franciscovila <javier.paradela.vila@est.tech> | 2023-10-23 13:26:50 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-10-24 17:45:22 +0000 |
commit | a762f63e5dc464dd160808615fce1cfa6c922c90 (patch) | |
tree | 3290080fc5afe4c46734d3acaee61e7b50c4e5cf /catalog-ui/src | |
parent | 8d59b022d1b35a4549ff4a1f3aeea0c11214c6fb (diff) |
service role metadata cleared after service creation
Issue-ID: SDC-4665
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: I4e2fc183e28827aa967bb9c62f2701bfe5ab6e36
Diffstat (limited to 'catalog-ui/src')
-rw-r--r-- | catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts | 14 | ||||
-rw-r--r-- | catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html | 4 |
2 files changed, 14 insertions, 4 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; } diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html index 1432729293..1a7c493b0f 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html +++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html @@ -475,7 +475,7 @@ <div ng-if="component.isService() && !isNotApplicableMetadataKeys('Service Role')" class="i-sdc-form-item" data-ng-class="{'error': validateField(editForm.serviceRole)}"> - <div ng-if="component.selectedCategory"> + <div ng-if="component.selectedCategory && isMetadataKeyForComponentCategoryService('Service Role', 'serviceRole')"> <div ng-if="isMetadataKeyMandatory('Service Role')"> <label class="i-sdc-form-label required" translate="GENERAL_TAB_LABEL_SERVICE_ROLE"></label> </div> @@ -530,7 +530,7 @@ <div ng-if="component.isService() && !isNotApplicableMetadataKeys('Service Function')" class="i-sdc-form-item" data-ng-class="{'error': validateField(editForm.serviceFunction)}"> - <div ng-if="component.selectedCategory"> + <div ng-if="component.selectedCategory && isMetadataKeyForComponentCategoryService('Service Function', 'serviceFunction')"> <div ng-if="isMetadataKeyMandatory('Service Function')"> <label class="i-sdc-form-label required" translate="GENERAL_TAB_LABEL_SERVICE_FUNCTION"></label> </div> |