blob: c949a73248c6cb088a153f5571fa3c485857f8c0 [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 Lando5b593492018-07-29 16:13:45 +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 { SdcUiComponentsModule, SdcUiComponents } from "sdc-ui/lib/angular";
29import { PropertiesAssignmentModule } from './pages/properties-assignment/properties-assignment.module';
Michael Landoed64b5e2017-06-09 03:19:04 +030030import {
Tal Gitelman51d50f02017-12-10 18:55:03 +020031 DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +020032 StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, ScopeServiceFactory,
Michael Lando5b593492018-07-29 16:13:45 +030033 NotificationServiceProvider, ComponentFactoryProvider
Michael Landoed64b5e2017-06-09 03:19:04 +030034} from "./utils/ng1-upgraded-provider";
Michael Lando5b593492018-07-29 16:13:45 +030035import { ConfigService } from "./services/config.service";
36import { HttpModule } from '@angular/http';
37import { HttpService } from './services/http.service';
38import { AuthenticationService } from './services/authentication.service';
39import { Cookie2Service } from "./services/cookie.service";
40import { ComponentServiceNg2 } from "./services/component-services/component.service";
41import { ComponentServiceFactoryNg2 } from "./services/component-services/component.service.factory";
42import { ServiceServiceNg2 } from "./services/component-services/service.service";
43import { ComponentInstanceServiceNg2 } from "./services/component-instance-services/component-instance.service";
44import { ModalService } from "./services/modal.service";
45import { UiElementsModule } from "./components/ui/ui-elements.module";
46import { ConnectionWizardModule } from "./pages/connection-wizard/connection-wizard.module";
Arielk802bd2a2018-04-16 15:37:39 +030047import {InterfaceOperationModule} from "./pages/interface-operation/interface-operation.module";
48import {OperationCreatorModule} from "./pages/interface-operation/operation-creator/operation-creator.module";
Michael Lando5b593492018-07-29 16:13:45 +030049import { LayoutModule } from "./components/layout/layout.module";
50import { UserService } from "./services/user.service";
51import { DynamicComponentService } from "./services/dynamic-component.service";
52import { SdcConfig } from "./config/sdc-config.config";
53import { SdcMenu } from "./config/sdc-menu.config";
Tal Gitelman51d50f02017-12-10 18:55:03 +020054import { TranslateModule } from "./shared/translator/translate.module";
55import { TranslationServiceConfig } from "./config/translation.service.config";
Michael Lando5b593492018-07-29 16:13:45 +030056import { MultilineEllipsisModule } from "./shared/multiline-ellipsis/multiline-ellipsis.module";
57import { ServicePathCreatorModule } from './pages/service-path-creator/service-path-creator.module';
58import { ServicePathsListModule } from './pages/service-paths-list/service-paths-list.module';
59import { ServicePathModule } from 'app/ng2/components/logic/service-path/service-path.module';
60import { ServicePathSelectorModule } from 'app/ng2/components/logic/service-path-selector/service-path-selector.module';
61import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/panel.module';
62import { WindowRef } from "./services/window.service";
63import {ArchiveService} from "./services/archive.service";
64import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
Idan Amiteedaaf92018-01-31 13:27:33 +020065import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
66import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020067import {EventBusService} from "./services/event-bus.service";
Michael Lando5b593492018-07-29 16:13:45 +030068import {GroupsService} from "./services/groups.service";
69import {PoliciesService} from "./services/policies.service";
70import {AutomatedUpgradeService} from "./pages/automated-upgrade/automated-upgrade.service";
71import {AutomatedUpgradeModule} from "./pages/automated-upgrade/automated-upgrade.module";
Michael Landoed64b5e2017-06-09 03:19:04 +030072
73export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
74
Michael Lando5b593492018-07-29 16:13:45 +030075export function configServiceFactory(config: ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020076 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030077 return Promise.all([
78 config.loadValidationConfiguration(),
79 config.loadPluginsConfiguration()
80 ]);
Idan Amit2c285722017-12-29 09:40:43 +020081 }
Michael Landoed64b5e2017-06-09 03:19:04 +030082}
83
Michael Landoed64b5e2017-06-09 03:19:04 +030084
85@NgModule({
86 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020087 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030088 ],
89 imports: [
90 BrowserModule,
91 UpgradeModule,
92 FormsModule,
93 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020094 LayoutModule,
95 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +030096 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020097 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +030098 CompositionPanelModule,
99 SdcUiComponentsModule,
100 AutomatedUpgradeModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200101 //We need to import them here since we use them in angular1
102 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200103 PropertiesAssignmentModule,
Michael Landoa5445102018-03-04 14:53:33 +0200104 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +0300105 InterfaceOperationModule,
106 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200107 ServicePathCreatorModule,
108 ServicePathsListModule,
109 ServicePathModule,
110 ServicePathSelectorModule
Michael Landoed64b5e2017-06-09 03:19:04 +0300111 ],
112 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300113 entryComponents: [
114 // *** sdc-ui components to be used as downgraded:
115 // SdcUiComponents.ButtonComponent
116 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300117 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300118 WindowRef,
Michael Landoed64b5e2017-06-09 03:19:04 +0300119 DataTypesServiceProvider,
120 SharingServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300121 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300122 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200123 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300124 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200125 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300126 CacheServiceProvider,
127 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200128 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300129 ModalsHandlerProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300130 AuthenticationService,
131 Cookie2Service,
132 ConfigService,
133 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200134 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200135 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300136 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300137 AutomatedUpgradeService,
Avi Zivf5854fd2017-07-31 15:50:46 +0300138 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200139 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200140 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300141 GroupsService,
Michael Landoa5445102018-03-04 14:53:33 +0200142 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200143 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300144 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300145 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200146 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200147 PluginsService,
Michael Lando5b593492018-07-29 16:13:45 +0300148 ArchiveService,
Idan Amit71904f22018-02-13 10:38:16 +0200149 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300150 {
151 provide: APP_INITIALIZER,
152 useFactory: configServiceFactory,
153 deps: [ConfigService],
154 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300155 },
Michael Lando5b593492018-07-29 16:13:45 +0300156 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300157 bootstrap: [AppComponent]
158})
159
160
161export class AppModule {
Michael Lando5b593492018-07-29 16:13:45 +0300162 constructor(public upgrade: UpgradeModule, public eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300163
Michael Landoed64b5e2017-06-09 03:19:04 +0300164 }
165}