blob: 46a176984c9d4f7886c9bb12ce5e9e6bf114fc97 (
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
|
import {Component, Input, OnInit, ViewChild} from "@angular/core";
import {NgRedux, select} from "@angular-redux/store";
import {AppState} from "../../store/reducers";
import {ModelInformationItem} from "../../shared/components/model-information/model-information.component";
import {Observable} from "rxjs/Observable";
import {NgForm} from "@angular/forms";
import * as _ from 'lodash';
@Component({
selector: "app-network-selector",
templateUrl: "./network-selector.component.html",
styleUrls: ["./network-selector.component.scss"]
})
export class NetworkSelectorComponent implements OnInit {
private localStore: NgRedux<AppState>;
networkSelection: any;
groupSelection :any;
@Input() groups: Array<string>;
@Input() cloudOwner : string;
@Input() cloudRegionId : string;
@select(['service', 'networkFunctions'])
readonly networkFunctions: Observable<any>;
@ViewChild('form') form: NgForm;
constructor(store: NgRedux<AppState>) {
this.localStore = store;
this.groupSelection = {};
console.log(store);
}
getValueOfLabelInGroup(group: any, label: string){
let item = _.find(group, {"label": label});
if (item) {
return item["values"][0];
}
}
getNetworksByNetworkFunctionRole(group: any): Observable<string[]> {
let filteredItem = this.getValueOfLabelInGroup(group,"Network Collection Function");
return this.networkFunctions.map(data => {
return (data && data[filteredItem]) || [];
});
}
getGroupName(group: ModelInformationItem[]) {
return this.getValueOfLabelInGroup(group,"Group Name");
}
/**
* [ncf=>aaiResonse]
* groups => groupsModel
*/
ngOnInit() {
let store = this.localStore;
this.networkSelection = {};
}
}
//
/*
Info inside redux = {ncfNetworkMap }
*/
|