summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/workspace/req-and-capabilities/capabilities/capabilities-properties/capabilities-properties.ts
blob: 2a1a16e26526df1aec464b3d583069a447b6ad09 (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
33
import { ViewChild, Input, OnInit, Component } from "@angular/core";
import {SdcUiServices} from "onap-ui-angular";
import { ModalsHandler } from "../../../../../../utils/modals-handler";
import { WorkspaceService } from "../../../workspace.service";
import { PropertyModel } from "../../../../../../models/properties";


@Component({
    selector: 'capabilities-properties',
    templateUrl: './capabilities-properties.html',
    styleUrls: ['./capabilities-properties.less', '../../../../../../../assets/styles/table-style.less']
})
export class CapabilitiesPropertiesComponent {
    @Input() public capabilitiesProperties: Array<PropertyModel> = [];

    private capabilityPropertiesColumns = [
        {name: 'Name', prop: 'name', flexGrow: 1},
        {name: 'Type', prop: 'type', flexGrow: 1},
        {name: 'Schema', prop: 'schema', flexGrow: 1},
        {name: 'Description', prop: 'description', flexGrow: 1},
    ];
    constructor(private modalsHandler: ModalsHandler,
                private workspaceService: WorkspaceService) {}

    private updateProperty(property: PropertyModel): void {
        _.forEach(this.capabilitiesProperties, (prop: PropertyModel) => {
            prop.readonly = true;
        });
        this.modalsHandler.openEditPropertyModal(property, this.workspaceService.metadata, this.capabilitiesProperties, false, 'component',
        this.workspaceService.metadata.uniqueId);
    }
}