Add data type view/workspace
[sdc.git] / catalog-ui / src / app / ng2 / utils / ng1-upgraded-provider.ts
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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 /**
22  * Created by rc2122 on 4/6/2017.
23  */
24 import {DataTypesService} from "../../services/data-types-service";
25 import {CookieService} from "../../services/cookie-service";
26 import {ComponentFactory} from "../../utils/component-factory"
27 import {EventListenerService} from "app/services/event-listener-service";
28 import {ModalsHandler} from "app/utils";
29 import {SharingService} from "../services/sharing.service";
30 import ICacheObject = angular.ICacheObject;
31
32 /** Services we need to upgrade from angular1 to angular2 - in the future we need to rewrite them all to angular2 **/
33
34 export function dataTypesServiceFactory(cacheObj: ICacheObject) {
35     return cacheObj.get('Sdc.Services.DataTypesService');
36 }
37
38 export function sharingServiceFactory(cacheObj: ICacheObject) {
39     return cacheObj.get('Sdc.Services.SharingService');
40 }
41
42 export function componentServiceFactory(cacheObj: ICacheObject) {
43     return cacheObj.get('Sdc.Services.ComponentFactory');
44 }
45
46 export function cookieServiceFactory(cacheObj: ICacheObject) {
47     return cacheObj.get('Sdc.Services.CookieService');
48 }
49
50 export function stateServiceFactory(cacheObj: ICacheObject) {
51     return cacheObj.get('$state');
52 }
53
54 export function stateParamsServiceFactory(cacheObj: ICacheObject) {
55     return cacheObj.get('$stateParams');
56 }
57
58 export function scopeServiceFactory(cacheObj: ICacheObject) {
59     return cacheObj.get('$scope');
60 }
61
62 export function eventListenerServiceServiceFactory(cacheObj: ICacheObject) {
63     return cacheObj.get('EventListenerService');
64 }
65
66 export function notificationServiceFactory(cacheObj: ICacheObject) {
67     return cacheObj.get('Notification');
68 }
69
70 export function ModalsHandlerFactory(cacheObj: ICacheObject) {
71     return cacheObj.get('ModalsHandler');
72 }
73
74
75 export const ComponentFactoryProvider = {
76     provide: ComponentFactory,
77     useFactory: componentServiceFactory,
78     deps: ['$injector']
79 };
80
81 export const DataTypesServiceProvider = {
82     provide: DataTypesService,
83     useFactory: dataTypesServiceFactory,
84     deps: ['$injector']
85 };
86
87 export const SharingServiceProvider = {
88     provide: SharingService,
89     useFactory: sharingServiceFactory,
90     deps: ['$injector']
91 };
92
93
94 export const CookieServiceProvider = {
95     provide: CookieService,
96     useFactory: cookieServiceFactory,
97     deps: ['$injector']
98 };
99
100 export const StateServiceFactory = {
101     provide: '$state',
102     useFactory: stateServiceFactory,
103     deps: ['$injector']
104 };
105
106 export const ScopeServiceFactory = {
107     provide: '$scope',
108     useFactory: scopeServiceFactory,
109     deps: ['$injector']
110 };
111
112 export const StateParamsServiceFactory = {
113     provide: '$stateParams',
114     useFactory: stateParamsServiceFactory,
115     deps: ['$injector']
116 };
117
118 export const NotificationServiceProvider = {
119     provide: 'Notification',
120     useFactory: notificationServiceFactory,
121     deps: ['$injector']
122 };
123
124 export const ModalsHandlerProvider = {
125     provide: ModalsHandler,
126     useFactory: ModalsHandlerFactory,
127     deps: ['$injector']
128 };