summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/utils/common-utils.ts
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-02-16 17:37:57 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-02-17 15:57:55 +0000
commit26e5029d922779fd7e786c1a31b6b37492132388 (patch)
tree8e8e68a6913749e1405fce951bc7816d4fa35ba3 /catalog-ui/src/app/utils/common-utils.ts
parentf2c0a4118c3c0b6360b639622766543bd754b59c (diff)
Implement Attributes/Outputs FE
Change-Id: I014bb0ebc07f3fea4266a4f295172eadee546705 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3448
Diffstat (limited to 'catalog-ui/src/app/utils/common-utils.ts')
-rw-r--r--catalog-ui/src/app/utils/common-utils.ts46
1 files changed, 37 insertions, 9 deletions
diff --git a/catalog-ui/src/app/utils/common-utils.ts b/catalog-ui/src/app/utils/common-utils.ts
index eadb92bd4f..b4e184ab44 100644
--- a/catalog-ui/src/app/utils/common-utils.ts
+++ b/catalog-ui/src/app/utils/common-utils.ts
@@ -25,6 +25,8 @@ import {InputBEModel, PropertyBEModel, RelationshipModel} from "app/models";
import { PolicyInstance } from "app/models/graph/zones/policy-instance";
import { GroupInstance } from "../models/graph/zones/group-instance";
import { InterfaceModel } from "../models/operation";
+import {AttributeBEModel} from "../models/attributes-outputs/attribute-be-model";
+import {OutputBEModel} from "../models/attributes-outputs/output-be-model";
export class CommonUtils {
@@ -32,7 +34,7 @@ export class CommonUtils {
let properties = new Array<PropertyModel>();
if (propertiesObj) {
- _.forEach(propertiesObj, (property:PropertyModel):void => {
+ propertiesObj.forEach((property:PropertyModel):void => {
if (uniqueId) {
property.readonly = property.parentUniqueId != uniqueId;
}
@@ -46,7 +48,7 @@ export class CommonUtils {
let attributes = new Array<AttributeModel>();
if (attributesObj) {
- _.forEach(attributesObj, (attribute:AttributeModel):void => {
+ attributesObj.forEach((attribute:AttributeModel):void => {
if (uniqueId) {
attribute.readonly = attribute.parentUniqueId != uniqueId;
}
@@ -60,7 +62,7 @@ export class CommonUtils {
let componentInstances = new Array<ResourceInstance>();
if (componentInstanceObj) {
- _.forEach(componentInstanceObj, (instance:ResourceInstance):void => {
+ componentInstanceObj.forEach((instance:ResourceInstance):void => {
componentInstances.push(ComponentInstanceFactory.createComponentInstance(instance));
});
}
@@ -72,7 +74,7 @@ export class CommonUtils {
let modules = new Array<Module>();
if (moduleArrayObj) {
- _.forEach(moduleArrayObj, (module:Module):void => {
+ moduleArrayObj.forEach((module:Module):void => {
if (module.type === "org.openecomp.groups.VfModule") {
modules.push(new Module(module));
}
@@ -86,7 +88,7 @@ export class CommonUtils {
let inputs = new Array<InputBEModel>();
if(inputsObj) {
- _.forEach(inputsObj, (input: InputBEModel):void => {
+ inputsObj.forEach((input: InputBEModel):void => {
inputs.push(new InputBEModel(input));
})
}
@@ -94,12 +96,25 @@ export class CommonUtils {
return inputs;
}
+ static initOutputs(outputsObj: Array<OutputBEModel>): Array<OutputBEModel> {
+
+ let outputs = new Array<OutputBEModel>();
+
+ if(outputsObj) {
+ outputsObj.forEach((output: OutputBEModel):void => {
+ outputs.push(new OutputBEModel(output));
+ })
+ }
+
+ return outputs;
+ }
+
static initBeProperties(propertiesObj: Array<PropertyBEModel>): Array<PropertyBEModel> {
let properties = new Array<PropertyBEModel>();
if (propertiesObj) {
- _.forEach(propertiesObj, (property: PropertyBEModel): void => {
+ propertiesObj.forEach((property: PropertyBEModel): void => {
properties.push(new PropertyBEModel(property));
})
}
@@ -107,10 +122,23 @@ export class CommonUtils {
return properties;
}
+ static initBeAttributes(attributesObj: Array<AttributeBEModel>): Array<AttributeBEModel> {
+
+ let attributes = new Array<AttributeBEModel>();
+
+ if (attributesObj) {
+ attributesObj.forEach((attribute: AttributeBEModel): void => {
+ attributes.push(new AttributeBEModel(attribute));
+ })
+ }
+
+ return attributes;
+ }
+
static initComponentInstanceRelations = (componentInstanceRelationsObj:Array<RelationshipModel>):Array<RelationshipModel> => {
if (componentInstanceRelationsObj) {
let componentInstancesRelations: Array<RelationshipModel> = [];
- _.forEach(componentInstanceRelationsObj, (instanceRelation:RelationshipModel):void => {
+ componentInstanceRelationsObj.forEach((instanceRelation:RelationshipModel):void => {
componentInstancesRelations.push(new RelationshipModel(instanceRelation));
});
return componentInstancesRelations;
@@ -121,7 +149,7 @@ export class CommonUtils {
let policies = new Array<PolicyInstance>();
if (policiesObj) {
- _.forEach(policiesObj, (policy: PolicyInstance): void => {
+ policiesObj.forEach((policy: PolicyInstance): void => {
policies.push(new PolicyInstance(policy));
})
}
@@ -132,7 +160,7 @@ export class CommonUtils {
let groups = new Array<GroupInstance>();
if(groupsObj) {
- _.forEach(groupsObj, (group: GroupInstance):void => {
+ groupsObj.forEach((group: GroupInstance):void => {
groups.push(new GroupInstance(group));
});
}