support set body parameter by json
[sdc/sdc-workflow-designer.git] / sdc-workflow-designer-ui / src / app / components / editable-property / editable-property.component.ts
1 /**
2  * Copyright (c) 2017 ZTE Corporation.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and the Apache License 2.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     ZTE - initial API and implementation and/or initial documentation
11  */
12
13 import { AfterViewInit, Component, EventEmitter, Input, Output } from '@angular/core';
14
15 import { ValueSource } from '../../model/value-source.enum';
16 import { ValueType } from '../../model/value-type.enum';
17 import { Parameter} from '../../model/workflow/parameter';
18
19 /**
20  * property component presents information of a workflow node.
21  * the presented information can be edit in this component.
22  * it may load information dynamically. the content may be different for different node type.
23  */
24 @Component({
25     selector: 'b4t-editable-property',
26     templateUrl: 'editable-property.component.html',
27 })
28 export class EditablePropertyComponent {
29     @Input() public parameter: Parameter;
30     @Input() public showLabel: boolean;
31     @Input() public valueSource: ValueSource[];
32     @Output() public parameterChange = new EventEmitter<Parameter>();
33
34     private editing = false;
35
36     public isEditing(): boolean {
37         return this.editing;
38     }
39
40     public startEdit() {
41         this.editing = true;
42     }
43
44     public completeEdit() {
45         this.editing = false;
46         this.parameterChange.emit(this.parameter);
47     }
48 }