aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavsad <david.sadlier@est.tech>2021-09-23 16:59:57 +0100
committerMichael Morris <michael.morris@est.tech>2021-10-12 08:50:06 +0000
commit0db74a648b91d5affb32be5b5b3fa54e150710bb (patch)
tree2b7e21dc303f6c1b4c5b177baffb91763bc3c694
parentc65452a519e4c64fe23e42251d8237ada676f81c (diff)
Add a display name for the category metadataKeys entries
Issue-ID: SDC-3737 Signed-off-by: davsad <david.sadlier@est.tech> Change-Id: Ia9547f02267fd380feeef6be6af10beadd30457b
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java1
-rw-r--r--catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml1
-rw-r--r--catalog-ui/src/app/models/category.ts1
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts8
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html8
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java2
7 files changed, 18 insertions, 5 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java
index 35502aa573..2b8b8df7ec 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CategoriesImportManager.java
@@ -252,6 +252,7 @@ public class CategoriesImportManager {
MetadataKeyDataDefinition metadataKeyDef = new MetadataKeyDataDefinition();
String metadataKeyName = (String) metadataKeyInfo.get(MetadataKeyEnum.NAME.getName());
metadataKeyDef.setName(metadataKeyName);
+ metadataKeyDef.setDisplayName((String) metadataKeyInfo.get(MetadataKeyEnum.DISPLAY_NAME.getName()));
final Object mandatoryProperty = metadataKeyInfo.get(MetadataKeyEnum.MANDATORY.getName());
final boolean mandatory = mandatoryProperty == null ? false : (Boolean) mandatoryProperty;
metadataKeyDef.setMandatory(mandatory);
diff --git a/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml b/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
index a013264bd8..7889af069d 100644
--- a/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/categories/categoryTypes.yml
@@ -47,6 +47,7 @@ services:
metadataKeys:
etsiVersion:
name: "ETSI Version"
+ displayName: "ETSI Version"
validValues: [ '3.3.1', '2.7.1', '2.5.1' ]
default: '2.5.1'
mandatory: true
diff --git a/catalog-ui/src/app/models/category.ts b/catalog-ui/src/app/models/category.ts
index 7819aae2f1..502020a57b 100644
--- a/catalog-ui/src/app/models/category.ts
+++ b/catalog-ui/src/app/models/category.ts
@@ -51,6 +51,7 @@ export interface IGroup extends ICategoryBase {
export interface IMetadataKey {
name:string;
+ displayName:string;
mandatory:boolean;
validValues: string[];
defaultValue: string;
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 e766e36899..c423028467 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
@@ -801,6 +801,14 @@ export class GeneralViewModel {
return [];
}
+ this.$scope.getMetadataDisplayName = (key: string): string => {
+ let metadataKey = this.getMetadataKey(this.$scope.component.categories, key);
+ if (metadataKey) {
+ return metadataKey.displayName ? metadataKey.displayName : metadataKey.name;
+ }
+ return "";
+ }
+
this.$scope.isMetadataKeyForComponentCategory = (key: string): boolean => {
return this.getMetadataKey(this.$scope.component.categories, key) != 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 a0199164cc..e7ce00b176 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
@@ -138,7 +138,7 @@
<div ng-if="isMetadataKeyForComponentCategory(key) && !isCategoryServiceMetadataKey(key) && getMetadataKeyValidValues(key) && isMetadataKeyMandatory(key)"
class="i-sdc-form-item"
data-ng-class="{'error': validateField(editForm['{{key}}'])}">
- <label class="i-sdc-form-label required" translate="{{key}}"></label>
+ <label class="i-sdc-form-label required" translate="{{getMetadataDisplayName(key)}}"></label>
<select class="i-sdc-form-select"
name="{{key}}"
data-ng-class="{'view-mode': isViewMode()}"
@@ -153,7 +153,7 @@
</div>
<div ng-if="isMetadataKeyForComponentCategory(key) && !isCategoryServiceMetadataKey(key) && getMetadataKeyValidValues(key) && !isMetadataKeyMandatory(key)"
class="i-sdc-form-item">
- <label class="i-sdc-form-label" translate="{{key}}"></label>
+ <label class="i-sdc-form-label" translate="{{getMetadataDisplayName(key)}}"></label>
<select class="i-sdc-form-select"
name="{{key}}"
data-ng-class="{'view-mode': isViewMode()}"
@@ -165,7 +165,7 @@
<div ng-if="isMetadataKeyForComponentCategory(key) && !isCategoryServiceMetadataKey(key) && !getMetadataKeyValidValues(key) && isMetadataKeyMandatory(key)"
class="i-sdc-form-item"
data-ng-class="{'error': validateField(editForm['{{key}}'])}">
- <label class="i-sdc-form-label required" translate="{{key}}"></label>
+ <label class="i-sdc-form-label required" translate="{{getMetadataDisplayName(key)}}"></label>
<input class="i-sdc-form-input" type="text"
data-required
data-ng-class="{'view-mode': isViewMode()}"
@@ -179,7 +179,7 @@
</div>
<div ng-if="isMetadataKeyForComponentCategory(key) && !isCategoryServiceMetadataKey(key) && !getMetadataKeyValidValues(key) && !isMetadataKeyMandatory(key)"
class="i-sdc-form-item">
- <label class="i-sdc-form-label" translate="{{key}}"></label>
+ <label class="i-sdc-form-label" translate="{{getMetadataDisplayName(key)}}"></label>
<input class="i-sdc-form-input" type="text"
data-ng-class="{'view-mode': isViewMode()}"
data-ng-model="component.categorySpecificMetadata[key]"
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java
index 4ee4c59d19..ebddb6d5b6 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/MetadataKeyDataDefinition.java
@@ -34,12 +34,14 @@ import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
public class MetadataKeyDataDefinition extends ToscaDataDefinition {
private String name;
+ private String displayName;
private List<String> validValues;
private boolean mandatory;
private String defaultValue;
public MetadataKeyDataDefinition(MetadataKeyDataDefinition metadataKeyDataDefinition) {
this.name = metadataKeyDataDefinition.name;
+ this.displayName = metadataKeyDataDefinition.displayName;
this.validValues = metadataKeyDataDefinition.validValues;
this.mandatory = metadataKeyDataDefinition.mandatory;
this.defaultValue = metadataKeyDataDefinition.defaultValue;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java
index 45da51164e..45f3ab152a 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/MetadataKeyEnum.java
@@ -24,6 +24,6 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum MetadataKeyEnum {
- METADATA_KEYS("metadataKeys"), NAME("name"), MANDATORY("mandatory"), VALID_VALUES("validValues"), DEFAULT("default");
+ METADATA_KEYS("metadataKeys"), NAME("name"), DISPLAY_NAME("displayName"), MANDATORY("mandatory"), VALID_VALUES("validValues"), DEFAULT("default");
private final String name;
}