blob: 5cf4d80075f7375620e57f37921cc2f78e09d97c [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 Amit5197c8b2018-01-15 14:31:42 +020049import {DesignerFrameModule} from "./components/ui/designer/designer-frame.module";
Idan Amitae4ab932018-01-23 15:53:11 +020050import {DesignersService} from "./services/designers.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030051
52export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
53
54export function configServiceFactory(config:ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020055 return () => {
56 config.loadValidationConfiguration();
57 config.loadDesignersConfiguration();
58 }
Michael Landoed64b5e2017-06-09 03:19:04 +030059}
60
Michael Landoed64b5e2017-06-09 03:19:04 +030061
62@NgModule({
63 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020064 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030065 ],
66 imports: [
67 BrowserModule,
68 UpgradeModule,
69 FormsModule,
70 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020071 LayoutModule,
72 TranslateModule,
73 UiElementsModule,
74
75 //We need to import them here since we use them in angular1
76 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +020077 PropertiesAssignmentModule,
78 DesignerFrameModule
Michael Landoed64b5e2017-06-09 03:19:04 +030079 ],
80 exports: [],
Tal Gitelman51d50f02017-12-10 18:55:03 +020081 entryComponents: [],
Michael Landoed64b5e2017-06-09 03:19:04 +030082 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030083 DataTypesServiceProvider,
84 SharingServiceProvider,
85 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +020086 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +030087 StateParamsServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030088 CacheServiceProvider,
89 EventListenerServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +030090 AuthenticationService,
91 Cookie2Service,
92 ConfigService,
93 ComponentServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +020094 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +030095 ServiceServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +030096 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +020097 UserService,
98 SdcConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +030099 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200100 TranslationServiceConfig,
Idan Amitae4ab932018-01-23 15:53:11 +0200101 DesignersService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300102 {
103 provide: APP_INITIALIZER,
104 useFactory: configServiceFactory,
105 deps: [ConfigService],
106 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300107 },
Michael Landoed64b5e2017-06-09 03:19:04 +0300108 ],
109 bootstrap: [AppComponent]
110})
111
112
113export class AppModule {
Michael Landoed64b5e2017-06-09 03:19:04 +0300114
Tal Gitelman51d50f02017-12-10 18:55:03 +0200115 constructor(public upgrade:UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300116
117 }
118}