blob: 750563b092a30726f00f08fdb7de70d594e389f7 [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';
Talio09537852019-01-31 18:00:36 +020030import { PropertyCreatorModule } from './pages/properties-assignment/property-creator/property-creator.module';
Michael Landoed64b5e2017-06-09 03:19:04 +030031import {
Tal Gitelman51d50f02017-12-10 18:55:03 +020032 DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +020033 StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, ScopeServiceFactory,
Michael Lando5b593492018-07-29 16:13:45 +030034 NotificationServiceProvider, ComponentFactoryProvider
Michael Landoed64b5e2017-06-09 03:19:04 +030035} from "./utils/ng1-upgraded-provider";
Michael Lando5b593492018-07-29 16:13:45 +030036import { ConfigService } from "./services/config.service";
37import { HttpModule } from '@angular/http';
38import { HttpService } from './services/http.service';
39import { AuthenticationService } from './services/authentication.service';
40import { Cookie2Service } from "./services/cookie.service";
41import { ComponentServiceNg2 } from "./services/component-services/component.service";
42import { ComponentServiceFactoryNg2 } from "./services/component-services/component.service.factory";
43import { ServiceServiceNg2 } from "./services/component-services/service.service";
44import { ComponentInstanceServiceNg2 } from "./services/component-instance-services/component-instance.service";
Arielkeaaf8012018-07-31 12:59:36 +030045import { WorkflowServiceNg2 } from './services/workflow.service';
Michael Lando5b593492018-07-29 16:13:45 +030046import { ModalService } from "./services/modal.service";
47import { UiElementsModule } from "./components/ui/ui-elements.module";
48import { ConnectionWizardModule } from "./pages/connection-wizard/connection-wizard.module";
Arielkeaaf8012018-07-31 12:59:36 +030049import { InterfaceOperationModule } from "./pages/interface-operation/interface-operation.module";
50import { OperationCreatorModule } from "./pages/interface-operation/operation-creator/operation-creator.module";
Michael Lando5b593492018-07-29 16:13:45 +030051import { LayoutModule } from "./components/layout/layout.module";
52import { UserService } from "./services/user.service";
53import { DynamicComponentService } from "./services/dynamic-component.service";
54import { SdcConfig } from "./config/sdc-config.config";
55import { SdcMenu } from "./config/sdc-menu.config";
Tal Gitelman51d50f02017-12-10 18:55:03 +020056import { TranslateModule } from "./shared/translator/translate.module";
57import { TranslationServiceConfig } from "./config/translation.service.config";
Michael Lando5b593492018-07-29 16:13:45 +030058import { MultilineEllipsisModule } from "./shared/multiline-ellipsis/multiline-ellipsis.module";
59import { ServicePathCreatorModule } from './pages/service-path-creator/service-path-creator.module';
60import { ServicePathsListModule } from './pages/service-paths-list/service-paths-list.module';
61import { ServicePathModule } from 'app/ng2/components/logic/service-path/service-path.module';
62import { ServicePathSelectorModule } from 'app/ng2/components/logic/service-path-selector/service-path-selector.module';
63import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/panel.module';
64import { WindowRef } from "./services/window.service";
65import {ArchiveService} from "./services/archive.service";
66import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
Idan Amiteedaaf92018-01-31 13:27:33 +020067import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
68import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020069import {EventBusService} from "./services/event-bus.service";
Michael Lando5b593492018-07-29 16:13:45 +030070import {GroupsService} from "./services/groups.service";
71import {PoliciesService} from "./services/policies.service";
72import {AutomatedUpgradeService} from "./pages/automated-upgrade/automated-upgrade.service";
73import {AutomatedUpgradeModule} from "./pages/automated-upgrade/automated-upgrade.module";
Michael Landoed64b5e2017-06-09 03:19:04 +030074
75export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
76
Michael Lando5b593492018-07-29 16:13:45 +030077export function configServiceFactory(config: ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020078 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030079 return Promise.all([
80 config.loadValidationConfiguration(),
81 config.loadPluginsConfiguration()
82 ]);
Idan Amit2c285722017-12-29 09:40:43 +020083 }
Michael Landoed64b5e2017-06-09 03:19:04 +030084}
85
Michael Landoed64b5e2017-06-09 03:19:04 +030086
87@NgModule({
88 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020089 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030090 ],
91 imports: [
92 BrowserModule,
93 UpgradeModule,
94 FormsModule,
95 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020096 LayoutModule,
97 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +030098 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020099 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300100 CompositionPanelModule,
101 SdcUiComponentsModule,
102 AutomatedUpgradeModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200103 //We need to import them here since we use them in angular1
104 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200105 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200106 PropertyCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200107 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +0300108 InterfaceOperationModule,
109 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200110 ServicePathCreatorModule,
111 ServicePathsListModule,
112 ServicePathModule,
113 ServicePathSelectorModule
Michael Landoed64b5e2017-06-09 03:19:04 +0300114 ],
115 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300116 entryComponents: [
117 // *** sdc-ui components to be used as downgraded:
118 // SdcUiComponents.ButtonComponent
119 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300120 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300121 WindowRef,
Michael Landoed64b5e2017-06-09 03:19:04 +0300122 DataTypesServiceProvider,
123 SharingServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300124 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300125 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200126 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300127 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200128 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300129 CacheServiceProvider,
130 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200131 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300132 ModalsHandlerProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300133 AuthenticationService,
134 Cookie2Service,
135 ConfigService,
136 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200137 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200138 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300139 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300140 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300141 WorkflowServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300142 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200143 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200144 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300145 GroupsService,
Michael Landoa5445102018-03-04 14:53:33 +0200146 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200147 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300148 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300149 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200150 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200151 PluginsService,
Michael Lando5b593492018-07-29 16:13:45 +0300152 ArchiveService,
Idan Amit71904f22018-02-13 10:38:16 +0200153 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300154 {
155 provide: APP_INITIALIZER,
156 useFactory: configServiceFactory,
157 deps: [ConfigService],
158 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300159 },
Michael Lando5b593492018-07-29 16:13:45 +0300160 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300161 bootstrap: [AppComponent]
162})
163
164
165export class AppModule {
Michael Lando5b593492018-07-29 16:13:45 +0300166 constructor(public upgrade: UpgradeModule, public eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300167
Michael Landoed64b5e2017-06-09 03:19:04 +0300168 }
169}