blob: c3cd06043b8aa1b9b3a61f5b370b2a938e50781e [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";
Arielk802bd2a2018-04-16 15:37:39 +030046import {InterfaceOperationModule} from "./pages/interface-operation/interface-operation.module";
47import {OperationCreatorModule} from "./pages/interface-operation/operation-creator/operation-creator.module";
Tal Gitelman51d50f02017-12-10 18:55:03 +020048import {LayoutModule} from "./components/layout/layout.module";
49import {UserService} from "./services/user.service";
Michael Landoa5445102018-03-04 14:53:33 +020050import {PoliciesService} from "./services/policies.service";
51import {DynamicComponentService} from "./services/dynamic-component.service";
Tal Gitelman51d50f02017-12-10 18:55:03 +020052import {SdcConfig} from "./config/sdc-config.config";
53import { TranslateModule } from "./shared/translator/translate.module";
54import { TranslationServiceConfig } from "./config/translation.service.config";
Michael Landoa5445102018-03-04 14:53:33 +020055import {ServicePathCreatorModule} from './pages/service-path-creator/service-path-creator.module';
56import {ServicePathsListModule} from './pages/service-paths-list/service-paths-list.module';
Idan Amiteedaaf92018-01-31 13:27:33 +020057import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
58import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020059import {EventBusService} from "./services/event-bus.service";
Michael Landoa5445102018-03-04 14:53:33 +020060import {ServicePathModule} from 'app/ng2/components/logic/service-path/service-path.module';
61import {ServicePathSelectorModule} from 'app/ng2/components/logic/service-path-selector/service-path-selector.module';
Michael Landoed64b5e2017-06-09 03:19:04 +030062
63export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
64
65export function configServiceFactory(config:ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020066 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030067 return Promise.all([
68 config.loadValidationConfiguration(),
69 config.loadPluginsConfiguration()
70 ]);
Idan Amit2c285722017-12-29 09:40:43 +020071 }
Michael Landoed64b5e2017-06-09 03:19:04 +030072}
73
Michael Landoed64b5e2017-06-09 03:19:04 +030074
75@NgModule({
76 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020077 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030078 ],
79 imports: [
80 BrowserModule,
81 UpgradeModule,
82 FormsModule,
83 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020084 LayoutModule,
85 TranslateModule,
86 UiElementsModule,
87
88 //We need to import them here since we use them in angular1
89 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +020090 PropertiesAssignmentModule,
Michael Landoa5445102018-03-04 14:53:33 +020091 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +030092 InterfaceOperationModule,
93 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +020094 ServicePathCreatorModule,
95 ServicePathsListModule,
96 ServicePathModule,
97 ServicePathSelectorModule
Michael Landoed64b5e2017-06-09 03:19:04 +030098 ],
99 exports: [],
Tal Gitelman51d50f02017-12-10 18:55:03 +0200100 entryComponents: [],
Michael Landoed64b5e2017-06-09 03:19:04 +0300101 providers: [
Michael Landoed64b5e2017-06-09 03:19:04 +0300102 DataTypesServiceProvider,
103 SharingServiceProvider,
104 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200105 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300106 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200107 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300108 CacheServiceProvider,
109 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200110 NotificationServiceProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300111 AuthenticationService,
112 Cookie2Service,
113 ConfigService,
114 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200115 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200116 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300117 ServiceServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300118 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200119 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200120 PoliciesService,
121 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200122 SdcConfig,
Michael Landoed64b5e2017-06-09 03:19:04 +0300123 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200124 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200125 PluginsService,
Idan Amit71904f22018-02-13 10:38:16 +0200126 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300127 {
128 provide: APP_INITIALIZER,
129 useFactory: configServiceFactory,
130 deps: [ConfigService],
131 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300132 },
Michael Landoed64b5e2017-06-09 03:19:04 +0300133 ],
134 bootstrap: [AppComponent]
135})
136
137
138export class AppModule {
Michael Landoed64b5e2017-06-09 03:19:04 +0300139
Idan Amit71904f22018-02-13 10:38:16 +0200140 constructor(public upgrade:UpgradeModule, eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300141 }
142}