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
87
88
89
90
91
92
93
|
import {Injectable} from "@angular/core";
import {IframeService} from "../../utils/iframe.service";
import {NgRedux} from "@angular-redux/store";
import {AppState} from "../../store/reducers";
import {ServicePopupService} from "./genericFormServices/service/service.popup.service";
import {ActivatedRoute} from "@angular/router";
import {AaiService} from "../../services/aaiService/aai.service";
import {ITreeNode} from "angular-tree-component/dist/defs/api";
import {UUIDData} from "./generic-form-popup.component";
import {FormPopupDetails} from "../../models/formControlModels/formPopupDetails.model";
import {Subject} from "rxjs";
import {deleteAllServiceInstances} from "../../storeUtil/utils/service/service.actions";
@Injectable()
export class GenericFormPopupService {
constructor(private _iframeService : IframeService,
private _store: NgRedux<AppState>,
private _servicePopupService : ServicePopupService,
public _activatedRoute : ActivatedRoute,
private _aaiService : AaiService){
}
getGenericFormDetails(uuidData : UUIDData, node : ITreeNode, isUpdateMode : boolean) : FormPopupDetails {
switch (uuidData.type){
case 'VL' : {
return uuidData.popupService.getGenericFormPopupDetails(
uuidData['serviceId'],
uuidData['networkId'],
uuidData['networkStoreKey'],
node,
uuidData,
isUpdateMode
);
}
case 'VFmodule' : {
return uuidData.popupService.getGenericFormPopupDetails(
uuidData['serviceId'],
uuidData['vnfStoreKey'],
uuidData['vFModuleStoreKey'],
node,
uuidData,
isUpdateMode
);
}
case 'VF' : {
return uuidData.popupService.getGenericFormPopupDetails(
uuidData['serviceId'],
uuidData['modelName'],
uuidData['vnfStoreKey'],
node,
uuidData,
isUpdateMode
);
}
case 'VnfGroup' : {
return uuidData.popupService.getGenericFormPopupDetails(
uuidData['serviceId'],
uuidData['modelName'],
uuidData['vnfGroupStoreKey'],
node,
uuidData,
isUpdateMode
);
}
case 'service' : {
uuidData['bulkSize'] = this._store.getState().service.serviceInstance[uuidData['serviceId']].bulkSize || 1;
return uuidData.popupService.getGenericFormPopupDetails(
uuidData['serviceId'],
null,
null,
node,
uuidData,
isUpdateMode
);
}
}
}
initReduxOnCreateNewService() : Promise<string> {
return new Promise((resolve, reject) => {
this._activatedRoute
.queryParams
.subscribe(params => {
this._store.dispatch(deleteAllServiceInstances());
this._aaiService.getServiceModelById(params.serviceModelId).subscribe(()=>{
resolve(params.serviceModelId);
});
});
});
}
refreshModalCheckForGeneralErrorTrigger : Subject<boolean> = new Subject<boolean>();
}
|