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