blob: b4170a5fde18708e77db727e072039a349c6a6ec (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
import { Component, Output, EventEmitter, Input } from '@angular/core';
import { RuleEngineApiService } from '../api/rule-engine-api.service';
import { Store } from '../../store/store';
@Component({
selector: 'app-version-type-select',
templateUrl: './version-type-select.component.html',
styleUrls: ['./version-type-select.component.scss']
})
export class VersionTypeSelectComponent {
mappingTarget: string;
selectedEvent: String;
selectedVersion: String;
events: Array<String>;
loader: boolean;
editMode = false;
readOnly = false;
@Input() versions;
@Input() metaData;
@Output() nodesUpdated = new EventEmitter();
@Output() refrashRuleList = new EventEmitter();
advancedSetting;
constructor(private _ruleApi: RuleEngineApiService, public store: Store) {
this.selectedVersion = null;
this.selectedEvent = null;
// set ddl with the first option value.
this.mappingTarget = this.store.configurationForm[0].name;
this.advancedSetting = this.store.configurationForm.filter(item => {
if (
!(
item.hasOwnProperty('constraints') &&
!item.assignment.value.includes('get_input')
)
) {
return item;
}
});
}
onChangeMapping(configurationKey) {
console.log('changing propertiy key:', configurationKey);
this._ruleApi.setFieldName(configurationKey);
this.refrashRuleList.next();
}
updateData(version, eventType, isList) {
this.selectedVersion = version;
this.selectedEvent = eventType;
this.readOnly = true;
}
updateVersionTypeFlag(flag) {
this.readOnly = flag;
if (flag === false) {
this.selectedVersion = null;
this.selectedEvent = null;
}
}
onSelectVersion(version, eventType) {
if (typeof eventType === 'undefined') {
this.selectedEvent = '';
this.events = this.metaData
.filter(x => x.version === version)
.map(x => x.eventTypes)[0];
if (eventType) {
this.editMode = true;
this.selectedEvent = eventType + 'Fields';
}
}
}
onSelectEventType(eventType) {
this.loader = true;
this._ruleApi
.getSchema(this.selectedVersion, this.selectedEvent)
.subscribe(tree => {
console.log('tree: ', tree);
this.loader = false;
this.nodesUpdated.emit({
nodes: tree
});
});
}
}
|