blob: 727f0fe8f55b07b95d7f7c481539fd9c2cd75727 [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 Landoa5445102018-03-04 14:53:33 +020031 StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, ScopeServiceFactory,
32 NotificationServiceProvider
Michael Landoed64b5e2017-06-09 03:19:04 +030033} from "./utils/ng1-upgraded-provider";
34import {ConfigService} from "./services/config.service";
Michael Landoed64b5e2017-06-09 03:19:04 +030035import {HttpModule} from '@angular/http';
Avi Zivf5854fd2017-07-31 15:50:46 +030036import {HttpService} from './services/http.service';
Michael Landoed64b5e2017-06-09 03:19:04 +030037import {AuthenticationService} from './services/authentication.service';
38import {Cookie2Service} from "./services/cookie.service";
39import {ComponentServiceNg2} from "./services/component-services/component.service";
Michael Landoa5445102018-03-04 14:53:33 +020040import {ComponentServiceFactoryNg2} from "./services/component-services/component.service.factory";
Michael Landoed64b5e2017-06-09 03:19:04 +030041import {ServiceServiceNg2} from "./services/component-services/service.service";
42import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service";
Tal Gitelman51d50f02017-12-10 18:55:03 +020043import {ModalService} from "./services/modal.service";
44import {UiElementsModule} from "./components/ui/ui-elements.module";
45import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module";
46import {LayoutModule} from "./components/layout/layout.module";
47import {UserService} from "./services/user.service";
Michael Landoa5445102018-03-04 14:53:33 +020048import {PoliciesService} from "./services/policies.service";
49import {DynamicComponentService} from "./services/dynamic-component.service";
Tal Gitelman51d50f02017-12-10 18:55:03 +020050import {SdcConfig} from "./config/sdc-config.config";
51import { TranslateModule } from "./shared/translator/translate.module";
52import { TranslationServiceConfig } from "./config/translation.service.config";
Michael Landoa5445102018-03-04 14:53:33 +020053import {ServicePathCreatorModule} from './pages/service-path-creator/service-path-creator.module';
54import {ServicePathsListModule} from './pages/service-paths-list/service-paths-list.module';
Idan Amiteedaaf92018-01-31 13:27:33 +020055import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
56import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020057import {EventBusService} from "./services/event-bus.service";
Michael Landoa5445102018-03-04 14:53:33 +020058import {ServicePathModule} from 'app/ng2/components/logic/service-path/service-path.module';
59import {ServicePathSelectorModule} from 'app/ng2/components/logic/service-path-selector/service-path-selector.module';
Michael Landoed64b5e2017-06-09 03:19:04 +030060
61export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
62
63export function configServiceFactory(config:ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020064 return () => {
65 config.loadValidationConfiguration();
Idan Amiteedaaf92018-01-31 13:27:33 +020066 config.loadPluginsConfiguration();
Idan Amit2c285722017-12-29 09:40:43 +020067 }
Michael Landoed64b5e2017-06-09 03:19:04 +030068}
69
Michael Landoed64b5e2017-06-09 03:19:04 +030070
71@NgModule({
72 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020073 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030074 ],
75 imports: [
76 BrowserModule,
77 UpgradeModule,
78 FormsModule,
79 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020080 LayoutModule,
81 TranslateModule,
82 UiElementsModule,
83
84 //We need to import them here since we use them in angular1
85 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +020086 PropertiesAssignmentModule,
Michael Landoa5445102018-03-04 14:53:33 +020087 PluginFrameModule,
88 ServicePathCreatorModule,
89 ServicePathsListModule,
90 ServicePathModule,
91 ServicePathSelectorModule
Michael Landoed64b5e2017-06-09 03:19:04 +030092 ],
93 exports: [],
Tal Gitelman51d50f02017-12-10 18:55:03 +020094 entryComponents: [],
Michael Landoed64b5e2017-06-09 03:19:04 +030095 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +030096 DataTypesServiceProvider,
97 SharingServiceProvider,
98 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +020099 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300100 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200101 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300102 CacheServiceProvider,
103 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200104 NotificationServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300105 AuthenticationService,
106 Cookie2Service,
107 ConfigService,
108 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200109 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200110 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300111 ServiceServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300112 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200113 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200114 PoliciesService,
115 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200116 SdcConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +0300117 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200118 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200119 PluginsService,
Idan Amit71904f22018-02-13 10:38:16 +0200120 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300121 {
122 provide: APP_INITIALIZER,
123 useFactory: configServiceFactory,
124 deps: [ConfigService],
125 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300126 },
Michael Landoed64b5e2017-06-09 03:19:04 +0300127 ],
128 bootstrap: [AppComponent]
129})
130
131
132export class AppModule {
Michael Landoed64b5e2017-06-09 03:19:04 +0300133
Idan Amit71904f22018-02-13 10:38:16 +0200134 constructor(public upgrade:UpgradeModule, eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300135 }
136}