blob: 0346b109152652e80e9c6b8ac9ef1f5b893b2ee6 [file] [log] [blame]
Michael Landodd603392017-07-12 00:54:52 +03001/*-
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
Idan Amit2c285722017-12-29 09:40:43 +020010 *
Michael Landodd603392017-07-12 00:54:52 +030011 * http://www.apache.org/licenses/LICENSE-2.0
Idan Amit2c285722017-12-29 09:40:43 +020012 *
Michael Landodd603392017-07-12 00:54:52 +030013 * 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
Michael Landoed64b5e2017-06-09 03:19:04 +030021import {BrowserModule} from '@angular/platform-browser';
22import {NgModule, APP_INITIALIZER} from '@angular/core';
23import {FormsModule} from '@angular/forms';
24import {forwardRef} from '@angular/core';
25import {AppComponent} from './app.component';
26import {UpgradeAdapter} from '@angular/upgrade';
27import {UpgradeModule} from '@angular/upgrade/static';
28import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module';
29import {
Tal Gitelman51d50f02017-12-10 18:55:03 +020030 DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030031 StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider
Michael Landoed64b5e2017-06-09 03:19:04 +030032} from "./utils/ng1-upgraded-provider";
33import {ConfigService} from "./services/config.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030034import {HttpModule} from '@angular/http';
Avi Zivf5854fd2017-07-31 15:50:46 +030035import {HttpService} from './services/http.service';
Michael Landoed64b5e2017-06-09 03:19:04 +030036import {AuthenticationService} from './services/authentication.service';
37import {Cookie2Service} from "./services/cookie.service";
38import {ComponentServiceNg2} from "./services/component-services/component.service";
39import {ServiceServiceNg2} from "./services/component-services/service.service";
40import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
Tal Gitelman51d50f02017-12-10 18:55:03 +020041import {ModalService} from "./services/modal.service";
42import {UiElementsModule} from "./components/ui/ui-elements.module";
43import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module";
44import {LayoutModule} from "./components/layout/layout.module";
45import {UserService} from "./services/user.service";
46import {SdcConfig} from "./config/sdc-config.config";
47import { TranslateModule } from "./shared/translator/translate.module";
48import { TranslationServiceConfig } from "./config/translation.service.config";
Idan Amiteedaaf92018-01-31 13:27:33 +020049import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
50import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020051import {EventBusService} from "./services/event-bus.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030052
53export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
54
55export function configServiceFactory(config:ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020056 return () => {
57 config.loadValidationConfiguration();
Idan Amiteedaaf92018-01-31 13:27:33 +020058 config.loadPluginsConfiguration();
Idan Amit2c285722017-12-29 09:40:43 +020059 }
Michael Landoed64b5e2017-06-09 03:19:04 +030060}
61
Michael Landoed64b5e2017-06-09 03:19:04 +030062
63@NgModule({
64 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020065 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030066 ],
67 imports: [
68 BrowserModule,
69 UpgradeModule,
70 FormsModule,
71 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020072 LayoutModule,
73 TranslateModule,
74 UiElementsModule,
75
76 //We need to import them here since we use them in angular1
77 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +020078 PropertiesAssignmentModule,
Idan Amiteedaaf92018-01-31 13:27:33 +020079 PluginFrameModule
Michael Landoed64b5e2017-06-09 03:19:04 +030080 ],
81 exports: [],
Tal Gitelman51d50f02017-12-10 18:55:03 +020082 entryComponents: [],
Michael Landoed64b5e2017-06-09 03:19:04 +030083 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030084 DataTypesServiceProvider,
85 SharingServiceProvider,
86 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +020087 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +030088 StateParamsServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030089 CacheServiceProvider,
90 EventListenerServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +030091 AuthenticationService,
92 Cookie2Service,
93 ConfigService,
94 ComponentServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +020095 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +030096 ServiceServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +030097 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +020098 UserService,
99 SdcConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +0300100 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200101 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200102 PluginsService,
Idan Amit71904f22018-02-13 10:38:16 +0200103 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300104 {
105 provide: APP_INITIALIZER,
106 useFactory: configServiceFactory,
107 deps: [ConfigService],
108 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300109 },
Michael Landoed64b5e2017-06-09 03:19:04 +0300110 ],
111 bootstrap: [AppComponent]
112})
113
114
115export class AppModule {
Michael Landoed64b5e2017-06-09 03:19:04 +0300116
Idan Amit71904f22018-02-13 10:38:16 +0200117 constructor(public upgrade:UpgradeModule, eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300118 }
119}