[VID-6] Initial rebase push
[vid.git] / vid-app-common / src / main / webapp / app / vid / scripts / services / detailsService.js
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * VID\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 "use strict";\r
22 \r
23 var DetailsService = function($log, DataService, ComponentService, COMPONENT,\r
24         FIELD, UtilityService) {\r
25 \r
26     var _this = this;\r
27 \r
28     var getSummaryList = function() {\r
29         switch (_this.componentId) {\r
30         case COMPONENT.NETWORK:\r
31         case COMPONENT.SERVICE:\r
32         case COMPONENT.VNF:\r
33         case COMPONENT.VF_MODULE:\r
34         case COMPONENT.VOLUME_GROUP:\r
35             return [ {\r
36                 name : FIELD.NAME.SUBSCRIBER_NAME,\r
37                 value : DataService.getSubscriberName()\r
38             }, {\r
39                 name : FIELD.NAME.SERVICE_INSTANCE_ID,\r
40                 value : DataService.getServiceInstanceId()\r
41             }, {\r
42                 name : FIELD.NAME.SERVICE_TYPE,\r
43                 value : DataService.getServiceType()\r
44             } ];\r
45         }\r
46     };\r
47 \r
48     var getDetailsList = function() {\r
49         switch (_this.componentId) {\r
50         case COMPONENT.NETWORK:\r
51         case COMPONENT.SERVICE:\r
52         case COMPONENT.VNF:\r
53         case COMPONENT.VF_MODULE:\r
54         case COMPONENT.VOLUME_GROUP:\r
55             return ComponentService.getDisplayNames(ComponentService\r
56                     .getInventoryParameterList(_this.componentId, DataService\r
57                             .getInventoryItem(), false));\r
58         }\r
59     };\r
60 \r
61     var getMsoFilterString = function() {\r
62 \r
63         var instanceId = "";\r
64 \r
65         switch (_this.componentId) {\r
66         case COMPONENT.NETWORK:\r
67             instanceId = DataService.getNetworkInstanceId();\r
68             break;\r
69         case COMPONENT.SERVICE:\r
70             instanceId = DataService.getServiceInstanceId();\r
71             break;\r
72         case COMPONENT.VNF:\r
73             instanceId = DataService.getVnfInstanceId();\r
74             break;\r
75         case COMPONENT.VF_MODULE:\r
76             instanceId = DataService.getVfModuleInstanceId();\r
77             break;\r
78         case COMPONENT.VOLUME_GROUP:\r
79             instanceId = DataService.getVolumeGroupInstanceId();\r
80         }\r
81 \r
82         return "filter=" + _this.componentId + "InstanceId:EQUALS:"\r
83                 + instanceId;\r
84     };\r
85 \r
86     return {\r
87         initializeComponent : function(componentId) {\r
88             _this.componentId = ComponentService.initialize(componentId);\r
89         },\r
90         getComponentDisplayName : ComponentService.getComponentDisplayName,\r
91         getSummaryList : getSummaryList,\r
92         getDetailsList : getDetailsList,\r
93         getMsoFilterString : getMsoFilterString\r
94     }\r
95 }\r
96 \r
97 appDS2.factory("DetailsService", [ "$log", "DataService", "ComponentService",\r
98         "COMPONENT", "FIELD", "UtilityService", DetailsService ]);\r