Add events hub notify calls
[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 } from "./utils/ng1-upgraded-provider";
33 import {ConfigService} from "./services/config.service";
34 import {HttpModule} from '@angular/http';
35 import {HttpService} from './services/http.service';
36 import {AuthenticationService} from './services/authentication.service';
37 import {Cookie2Service} from "./services/cookie.service";
38 import {ComponentServiceNg2} from "./services/component-services/component.service";
39 import {ServiceServiceNg2} from "./services/component-services/service.service";
40 import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
41 import {ModalService} from "./services/modal.service";
42 import {UiElementsModule} from "./components/ui/ui-elements.module";
43 import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module";
44 import {LayoutModule} from "./components/layout/layout.module";
45 import {UserService} from "./services/user.service";
46 import {SdcConfig} from "./config/sdc-config.config";
47 import { TranslateModule } from "./shared/translator/translate.module";
48 import { TranslationServiceConfig } from "./config/translation.service.config";
49 import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
50 import {PluginsService} from "./services/plugins.service";
51 import {EventBusService} from "./services/event-bus.service";
52
53 export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
54
55 export function configServiceFactory(config:ConfigService) {
56     return () => {
57         config.loadValidationConfiguration();
58         config.loadPluginsConfiguration();
59     }
60 }
61
62
63 @NgModule({
64     declarations: [
65         AppComponent
66     ],
67     imports: [
68         BrowserModule,
69         UpgradeModule,
70         FormsModule,
71         HttpModule,
72         LayoutModule,
73         TranslateModule,
74         UiElementsModule,
75
76         //We need to import them here since we use them in angular1
77         ConnectionWizardModule,
78         PropertiesAssignmentModule,
79         PluginFrameModule
80     ],
81     exports: [],
82     entryComponents: [],
83     providers: [
84         DataTypesServiceProvider,
85         SharingServiceProvider,
86         CookieServiceProvider,
87         StateServiceFactory,
88         ScopeServiceFactory,
89         StateParamsServiceFactory,
90         CacheServiceProvider,
91         EventListenerServiceProvider,
92         AuthenticationService,
93         Cookie2Service,
94         ConfigService,
95         ComponentServiceNg2,
96         ModalService,
97         ServiceServiceNg2,
98         HttpService,
99         UserService,
100         SdcConfig,
101         ComponentInstanceServiceNg2,
102         TranslationServiceConfig,
103         PluginsService,
104         EventBusService,
105         {
106             provide: APP_INITIALIZER,
107             useFactory: configServiceFactory,
108             deps: [ConfigService],
109             multi: true
110         },
111      ],
112     bootstrap: [AppComponent]
113 })
114
115
116 export class AppModule {
117
118     constructor(public upgrade:UpgradeModule, eventBusService:EventBusService) {
119     }
120 }