blob: 7108be93f9168108e5e029503c0fabd1cec683ad [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";
Michael Landoed64b5e2017-06-09 03:19:04 +030049
50export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
51
52export function configServiceFactory(config:ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020053 return () => {
54 config.loadValidationConfiguration();
55 config.loadDesignersConfiguration();
56 }
Michael Landoed64b5e2017-06-09 03:19:04 +030057}
58
Michael Landoed64b5e2017-06-09 03:19:04 +030059
60@NgModule({
61 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020062 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030063 ],
64 imports: [
65 BrowserModule,
66 UpgradeModule,
67 FormsModule,
68 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020069 LayoutModule,
70 TranslateModule,
71 UiElementsModule,
72
73 //We need to import them here since we use them in angular1
74 ConnectionWizardModule,
Michael Landoed64b5e2017-06-09 03:19:04 +030075 PropertiesAssignmentModule
76 ],
77 exports: [],
Tal Gitelman51d50f02017-12-10 18:55:03 +020078 entryComponents: [],
Michael Landoed64b5e2017-06-09 03:19:04 +030079 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030080 DataTypesServiceProvider,
81 SharingServiceProvider,
82 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +020083 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +030084 StateParamsServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030085 CacheServiceProvider,
86 EventListenerServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +030087 AuthenticationService,
88 Cookie2Service,
89 ConfigService,
90 ComponentServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +020091 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +030092 ServiceServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +030093 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +020094 UserService,
95 SdcConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +030096 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +020097 TranslationServiceConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +030098 {
99 provide: APP_INITIALIZER,
100 useFactory: configServiceFactory,
101 deps: [ConfigService],
102 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300103 },
Michael Landoed64b5e2017-06-09 03:19:04 +0300104 ],
105 bootstrap: [AppComponent]
106})
107
108
109export class AppModule {
Michael Landoed64b5e2017-06-09 03:19:04 +0300110
Tal Gitelman51d50f02017-12-10 18:55:03 +0200111 constructor(public upgrade:UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300112
113 }
114}