diff options
author | Michael Lando <ml636r@att.com> | 2017-06-09 03:19:04 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-06-09 03:19:04 +0300 |
commit | ed64b5edff15e702493df21aa3230b81593e6133 (patch) | |
tree | a4cb01fdaccc34930a8db403a3097c0d1e40914b /catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts | |
parent | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (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/properties-inputs/derived-fe-property.ts')
-rw-r--r-- | catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts b/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts new file mode 100644 index 0000000000..1d79353453 --- /dev/null +++ b/catalog-ui/src/app/models/properties-inputs/derived-fe-property.ts @@ -0,0 +1,72 @@ +import { SchemaPropertyGroupModel, SchemaProperty } from '../aschema-property'; +import { PROPERTY_DATA, PROPERTY_TYPES} from 'app/utils'; +import { PropertyBEModel } from '../../models'; + +export enum DerivedPropertyType { + SIMPLE, + LIST, + MAP, + COMPLEX //other datatype, list of non-simple, or map of non-simple +} + +export class DerivedFEProperty extends PropertyBEModel { + parentName: string; + propertiesName: string; //"network_assignments#ipv4_subnet#use_ipv4 = parentPath + name + derivedDataType: DerivedPropertyType; + isDeclared: boolean; + isSelected: boolean; + isDisabled: boolean; + isChildOfListOrMap: boolean; + + constructor(property: PropertyBEModel, parentName?: string) + constructor(name: string, parentName: string, type: string, value: string, isChildOfListOrMap?:boolean, schema?: SchemaPropertyGroupModel); + constructor(nameOrPropertyObj?: string | PropertyBEModel, parentName?: string, type?: string, value?: string, isChildOfListOrMap?: boolean, schema?: SchemaPropertyGroupModel) { + + super(typeof nameOrPropertyObj === 'string' ? null : nameOrPropertyObj); + + if (typeof nameOrPropertyObj !== 'string') { //constructor #1 + this.parentName = parentName ? parentName : null; + this.propertiesName = (parentName) ? parentName + '#' + nameOrPropertyObj.name : nameOrPropertyObj.name; + } else { //constructor #2 + this.name = nameOrPropertyObj; + this.type = type; + this.parentName = parentName; + this.propertiesName = parentName + '#' + nameOrPropertyObj; + this.value = value; + if (schema) { + this.schema = new SchemaPropertyGroupModel(new SchemaProperty(schema.property)); + } + } + this.derivedDataType = this.getDerivedPropertyType(); + this.isChildOfListOrMap = (isChildOfListOrMap) ? isChildOfListOrMap : false; + } + + public getDerivedPropertyType = () => { + if (PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1) { + return DerivedPropertyType.SIMPLE; + } else if (this.type == PROPERTY_TYPES.LIST) { + return DerivedPropertyType.LIST; + } else if (this.type == PROPERTY_TYPES.MAP) { + return DerivedPropertyType.MAP; + } else { + return DerivedPropertyType.COMPLEX; + } + } + +} +export class DerivedFEPropertyMap { + [parentPath: string]: Array<DerivedFEProperty>; +} + + + +// isDataType: boolean; + + +// canAdd: boolean; +// canCollapse: boolean; +// canBeDeclared: boolean; + +// derivedValue: string; +// derivedValueType: string; +// propertiesName: string;
\ No newline at end of file |