aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/modules
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
committerMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
commited64b5edff15e702493df21aa3230b81593e6133 (patch)
treea4cb01fdaccc34930a8db403a3097c0d1e40914b /catalog-ui/src/app/models/modules
parent280f8015d06af1f41a3ef12e8300801c7a5e0d54 (diff)
[SDC-29] catalog 1707 rebase commit.
Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/models/modules')
-rw-r--r--catalog-ui/src/app/models/modules/base-module.ts95
1 files changed, 95 insertions, 0 deletions
diff --git a/catalog-ui/src/app/models/modules/base-module.ts b/catalog-ui/src/app/models/modules/base-module.ts
new file mode 100644
index 0000000000..4a5f282468
--- /dev/null
+++ b/catalog-ui/src/app/models/modules/base-module.ts
@@ -0,0 +1,95 @@
+/**
+ * Created by obarda on 6/30/2016.
+ */
+/**
+ * Created by obarda on 2/4/2016.
+ */
+'use strict';
+import {PropertyModel} from "../properties";
+import {ArtifactModel} from "../artifacts";
+import {CommonUtils} from "../../utils/common-utils";
+export class Module {
+
+ public name:string;
+ public groupUUID:string;
+ public invariantUUID:string;
+ public propertyValueCounter:number;
+ public type:string;
+ public typeUid:string;
+ public uniqueId:string;
+ public version:string;
+ public artifacts:Array<string> | Array<ArtifactModel>;
+ public artifactsUuid:Array<string>;
+ public properties:Array<PropertyModel>;
+ public members:Array<string>;
+ public customizationUUID:string;
+ public groupInstanceUniqueId:string; // This will only have a value if this is a group instance
+
+ constructor(module?:Module) {
+ if (module) {
+ this.name = module.name;
+ this.groupUUID = module.groupUUID;
+ this.invariantUUID = module.invariantUUID;
+ this.propertyValueCounter = module.propertyValueCounter;
+ this.type = module.type;
+ this.typeUid = module.typeUid;
+ this.uniqueId = module.uniqueId;
+ this.version = module.version;
+ this.artifacts = module.artifacts;
+ this.artifactsUuid = module.artifactsUuid;
+ this.properties = CommonUtils.initProperties(module.properties);
+ this.members = module.members;
+ this.customizationUUID = module.customizationUUID;
+ this.groupInstanceUniqueId = module.groupInstanceUniqueId;
+ this.name = this.name.replace(/:/g, '..');
+
+ }
+ }
+}
+
+export class DisplayModule extends Module {
+
+ isBase:string;
+ artifacts:Array<ArtifactModel>;
+
+ //custom properties
+ public vfInstanceName:string;
+ public heatName:string;
+ public moduleName:string;
+ public customizationUUID:string;
+
+
+ constructor(displayModule?:DisplayModule) {
+ super(displayModule);
+
+ this.isBase = displayModule.isBase;
+ this.customizationUUID = displayModule.customizationUUID;
+ this.initArtifactsForDisplay(displayModule.artifacts);
+
+ //splitting module name for display and edit
+ let splitName:Array<string> = this.name.split('..');
+ this.vfInstanceName = splitName[0];
+ this.heatName = splitName[1];
+ this.moduleName = splitName[2];
+ }
+
+ private initArtifactsForDisplay = (artifacts:Array<ArtifactModel>):void => {
+ this.artifacts = new Array<ArtifactModel>();
+ _.forEach(artifacts, (artifact:ArtifactModel) => {
+ this.artifacts.push(new ArtifactModel(artifact));
+ });
+ };
+
+ public updateName = ():void => {
+ this.name = this.vfInstanceName + '..' + this.heatName + '..' + this.moduleName;
+ };
+
+ public toJSON = ():any => {
+ this.vfInstanceName = undefined;
+ this.heatName = undefined;
+ this.moduleName = undefined;
+ this.isBase = undefined;
+ this.artifacts = undefined;
+ return this;
+ };
+}