summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-17 22:40:44 +0300
committerMichael Lando <ml636r@att.com>2017-06-18 07:20:49 +0300
commit4d97d5fac309ce0d66938e5ccd0349e2660d4e23 (patch)
tree3f921054f997d1962fa6f9db9a0119e31a851eea /catalog-ui/src/app/ng2/services
parent89786d31f266a205857cae0177904c249ac6a512 (diff)
[sdc] update code of sdc
Change-Id: If9f37c80b659cb67b34d18e6c019defecca58b9a Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r--catalog-ui/src/app/ng2/services/data-type.service.ts47
1 files changed, 19 insertions, 28 deletions
diff --git a/catalog-ui/src/app/ng2/services/data-type.service.ts b/catalog-ui/src/app/ng2/services/data-type.service.ts
index be2388144f..821c215be5 100644
--- a/catalog-ui/src/app/ng2/services/data-type.service.ts
+++ b/catalog-ui/src/app/ng2/services/data-type.service.ts
@@ -20,35 +20,7 @@ export class DataTypeService {
public getDataTypeByTypeName(typeName: string): DataTypeModel {
return this.dataTypes[typeName];
}
-/*
- //if the dt derived from simple- return the first parent type, else- return null
- public getTypeForDataTypeDerivedFromSimple = (dataTypeName:string):string => {
- /////////temporary hack for tosca primitives///////////////////////
- if (!this.dataTypes[dataTypeName]) {
- return PROPERTY_TYPES.STRING;
- }
- ///////////////////////////////////////////////////////////////////
- if (this.dataTypes[dataTypeName].derivedFromName == PROPERTY_DATA.ROOT_DATA_TYPE || this.dataTypes[dataTypeName].properties) {
- return null;
- }
- if (PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.dataTypes[dataTypeName].derivedFromName) > -1) {
- return this.dataTypes[dataTypeName].derivedFromName
- }
- return this.getTypeForDataTypeDerivedFromSimple(this.dataTypes[dataTypeName].derivedFromName);
- };
- /**
- * The function returns all properties for the DataType passed in, and recurses through parent dataTypes (derivedFrom) to retrieve their properties as well
- * @param dataTypeObj
- *
- public getDataTypePropertiesRecursively(dataTypeObj: DataTypeModel): Array<PropertyBEModel> {
- let propertiesArray: Array<PropertyBEModel> = dataTypeObj.properties || [];
- if (PROPERTY_DATA.ROOT_DATA_TYPE !== dataTypeObj.derivedFromName) {
- propertiesArray = propertiesArray.concat(this.getDataTypePropertiesRecursively(dataTypeObj.derivedFrom));
- }
- return propertiesArray;
- }
-*/
public getDerivedDataTypeProperties(dataTypeObj: DataTypeModel, propertiesArray: Array<DerivedFEProperty>, parentName: string) {
//push all child properties to array
@@ -67,5 +39,24 @@ export class DataTypeService {
}
}
+ /**
+ * Checks for custom behavior for a given data type by checking if a function exists within data-type.service with that name
+ * Additional custom behavior can be added by adding a function with the given dataType name
+ */
+ public checkForCustomBehavior = (property:PropertyFEModel) => {
+ let shortTypeName:string = property.type.split('.').pop();
+ if (this[shortTypeName]) {
+ this[shortTypeName](property); //execute function for given type, pass property as param
+ }
+ }
+
+ public Naming = (property: PropertyFEModel) => {
+ let generatedNamingVal: boolean = _.get(property.valueObj, 'ecomp_generated_naming', true);
+ property.flattenedChildren.forEach((prop) => {
+ if (prop.name == 'naming_policy') prop.hidden = !generatedNamingVal;
+ if (prop.name == 'instance_name') prop.hidden = generatedNamingVal;
+ });
+ }
+
}