aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-fe/.gitignore
blob: d21b91d9b59974d28c507b38c01da14cf5e1dd8a (plain)
1
2
3
4
5
/target
/target
/target
/target
/build/
00DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
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;