}
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) {
}
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];
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;
}
<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>
<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>