Sync Integ to Master
[sdc.git] / catalog-ui / src / app / ng2 / app.module.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 import {BrowserModule} from '@angular/platform-browser';
22 import {NgModule, APP_INITIALIZER} from '@angular/core';
23 import {FormsModule} from '@angular/forms';
24 import {forwardRef} from '@angular/core';
25 import {AppComponent} from './app.component';
26 import {UpgradeAdapter} from '@angular/upgrade';
27 import {UpgradeModule} from '@angular/upgrade/static';
28 import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module';
29 import {
30     DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory,
31     StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, ScopeServiceFactory,
32     NotificationServiceProvider
33 } from "./utils/ng1-upgraded-provider";
34 import {ConfigService} from "./services/config.service";
35 import {HttpModule} from '@angular/http';
36 import {HttpService} from './services/http.service';
37 import {AuthenticationService} from './services/authentication.service';
38 import {Cookie2Service} from "./services/cookie.service";
39 import {ComponentServiceNg2} from "./services/component-services/component.service";
40 import {ComponentServiceFactoryNg2} from "./services/component-services/component.service.factory";
41 import {ServiceServiceNg2} from "./services/component-services/service.service";
42 import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
43 import {ModalService} from "./services/modal.service";
44 import {UiElementsModule} from "./components/ui/ui-elements.module";
45 import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module";
46 import {LayoutModule} from "./components/layout/layout.module";
47 import {UserService} from "./services/user.service";
48 import {PoliciesService} from "./services/policies.service";
49 import {DynamicComponentService} from "./services/dynamic-component.service";
50 import {SdcConfig} from "./config/sdc-config.config";
51 import { TranslateModule } from "./shared/translator/translate.module";
52 import { TranslationServiceConfig } from "./config/translation.service.config";
53 import {ServicePathCreatorModule} from './pages/service-path-creator/service-path-creator.module';
54 import {ServicePathsListModule} from './pages/service-paths-list/service-paths-list.module';
55 import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
56 import {PluginsService} from "./services/plugins.service";
57 import {EventBusService} from "./services/event-bus.service";
58 import {ServicePathModule} from 'app/ng2/components/logic/service-path/service-path.module';
59 import {ServicePathSelectorModule} from 'app/ng2/components/logic/service-path-selector/service-path-selector.module';
60
61 export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
62
63 export function configServiceFactory(config:ConfigService) {
64     return () => {
65         config.loadValidationConfiguration();
66         config.loadPluginsConfiguration();
67     }
68 }
69
70
71 @NgModule({
72     declarations: [
73         AppComponent
74     ],
75     imports: [
76         BrowserModule,
77         UpgradeModule,
78         FormsModule,
79         HttpModule,
80         LayoutModule,
81         TranslateModule,
82         UiElementsModule,
83
84         //We need to import them here since we use them in angular1
85         ConnectionWizardModule,
86         PropertiesAssignmentModule,
87         PluginFrameModule,
88         ServicePathCreatorModule,
89         ServicePathsListModule,
90         ServicePathModule,
91         ServicePathSelectorModule
92     ],
93     exports: [],
94     entryComponents: [],
95     providers: [
96         DataTypesServiceProvider,
97         SharingServiceProvider,
98         CookieServiceProvider,
99         StateServiceFactory,
100         StateParamsServiceFactory,
101         ScopeServiceFactory,
102         CacheServiceProvider,
103         EventListenerServiceProvider,
104         NotificationServiceProvider,
105         AuthenticationService,
106         Cookie2Service,
107         ConfigService,
108         ComponentServiceNg2,
109         ComponentServiceFactoryNg2,
110         ModalService,
111         ServiceServiceNg2,
112         HttpService,
113         UserService,
114         PoliciesService,
115         DynamicComponentService,
116         SdcConfig,
117         ComponentInstanceServiceNg2,
118         TranslationServiceConfig,
119         PluginsService,
120         EventBusService,
121         {
122             provide: APP_INITIALIZER,
123             useFactory: configServiceFactory,
124             deps: [ConfigService],
125             multi: true
126         },
127      ],
128     bootstrap: [AppComponent]
129 })
130
131
132 export class AppModule {
133
134     constructor(public upgrade:UpgradeModule, eventBusService:EventBusService) {
135     }
136 }