blob: ecaa26e1cea1ee1d7b35766b060e1032d1aa4d2d [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";
Michael Landoed64b5e2017-06-09 03:19:04 +030050
51export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
52
53export function configServiceFactory(config:ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020054 return () => {
55 config.loadValidationConfiguration();
56 config.loadDesignersConfiguration();
57 }
Michael Landoed64b5e2017-06-09 03:19:04 +030058}
59
Michael Landoed64b5e2017-06-09 03:19:04 +030060
61@NgModule({
62 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020063 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030064 ],
65 imports: [
66 BrowserModule,
67 UpgradeModule,
68 FormsModule,
69 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020070 LayoutModule,
71 TranslateModule,
72 UiElementsModule,
73
74 //We need to import them here since we use them in angular1
75 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +020076 PropertiesAssignmentModule,
77 DesignerFrameModule
Michael Landoed64b5e2017-06-09 03:19:04 +030078 ],
79 exports: [],
Tal Gitelman51d50f02017-12-10 18:55:03 +020080 entryComponents: [],
Michael Landoed64b5e2017-06-09 03:19:04 +030081 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030082 DataTypesServiceProvider,
83 SharingServiceProvider,
84 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +020085 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +030086 StateParamsServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +030087 CacheServiceProvider,
88 EventListenerServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +030089 AuthenticationService,
90 Cookie2Service,
91 ConfigService,
92 ComponentServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +020093 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +030094 ServiceServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +030095 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +020096 UserService,
97 SdcConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +030098 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +020099 TranslationServiceConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +0300100 {
101 provide: APP_INITIALIZER,
102 useFactory: configServiceFactory,
103 deps: [ConfigService],
104 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300105 },
Michael Landoed64b5e2017-06-09 03:19:04 +0300106 ],
107 bootstrap: [AppComponent]
108})
109
110
111export class AppModule {
Michael Landoed64b5e2017-06-09 03:19:04 +0300112
Tal Gitelman51d50f02017-12-10 18:55:03 +0200113 constructor(public upgrade:UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300114
115 }
116}