aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/properties-inputs/input-fe-model.ts
blob: 1261df3d6d34a218cd60103ff4ed561e00ffb23d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { SchemaPropertyGroupModel, SchemaProperty } from "../aschema-property";
import { PropertyBEModel } from "../../models";
import {PROPERTY_DATA} from "../../utils/constants";

export class InputFEModel extends PropertyBEModel {
    isSimpleType: boolean;
    isDataType: boolean;
    instanceName: string;
    propertyName: string;


    constructor(input?: PropertyBEModel) {
        super(input);
        if (input) {
            this.isSimpleType = PROPERTY_DATA.SIMPLE_TYPES.indexOf(this.type) > -1;
            this.isDataType = PROPERTY_DATA.TYPES.indexOf(this.type) == -1;
            let propNameIndex:number = this.name.indexOf('_');
            this.instanceName = this.name.substring(0, propNameIndex);
            if (input.inputPath) {
                this.propertyName = input.inputPath.substring(0, input.inputPath.indexOf('#'))
            } else {
                this.propertyName = this.name.substring(propNameIndex + 1);
            }
        }
    }



    public toJSON = (): any => {
    };

}