blob: 7a845ef159734fa02814ad203bb750ff9bacffb8 [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";
Arielkeaaf8012018-07-31 12:59:36 +030044import { WorkflowServiceNg2 } from './services/workflow.service';
Michael Lando5b593492018-07-29 16:13:45 +030045import { ModalService } from "./services/modal.service";
46import { UiElementsModule } from "./components/ui/ui-elements.module";
47import { ConnectionWizardModule } from "./pages/connection-wizard/connection-wizard.module";
Arielkeaaf8012018-07-31 12:59:36 +030048import { InterfaceOperationModule } from "./pages/interface-operation/interface-operation.module";
49import { OperationCreatorModule } from "./pages/interface-operation/operation-creator/operation-creator.module";
Michael Lando5b593492018-07-29 16:13:45 +030050import { LayoutModule } from "./components/layout/layout.module";
51import { UserService } from "./services/user.service";
52import { DynamicComponentService } from "./services/dynamic-component.service";
53import { SdcConfig } from "./config/sdc-config.config";
54import { SdcMenu } from "./config/sdc-menu.config";
Tal Gitelman51d50f02017-12-10 18:55:03 +020055import { TranslateModule } from "./shared/translator/translate.module";
56import { TranslationServiceConfig } from "./config/translation.service.config";
Michael Lando5b593492018-07-29 16:13:45 +030057import { MultilineEllipsisModule } from "./shared/multiline-ellipsis/multiline-ellipsis.module";
58import { ServicePathCreatorModule } from './pages/service-path-creator/service-path-creator.module';
59import { ServicePathsListModule } from './pages/service-paths-list/service-paths-list.module';
60import { 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';
62import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/panel.module';
63import { WindowRef } from "./services/window.service";
64import {ArchiveService} from "./services/archive.service";
65import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
Idan Amiteedaaf92018-01-31 13:27:33 +020066import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
67import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020068import {EventBusService} from "./services/event-bus.service";
Michael Lando5b593492018-07-29 16:13:45 +030069import {GroupsService} from "./services/groups.service";
70import {PoliciesService} from "./services/policies.service";
71import {AutomatedUpgradeService} from "./pages/automated-upgrade/automated-upgrade.service";
72import {AutomatedUpgradeModule} from "./pages/automated-upgrade/automated-upgrade.module";
Michael Landoed64b5e2017-06-09 03:19:04 +030073
74export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
75
Michael Lando5b593492018-07-29 16:13:45 +030076export function configServiceFactory(config: ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020077 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030078 return Promise.all([
79 config.loadValidationConfiguration(),
80 config.loadPluginsConfiguration()
81 ]);
Idan Amit2c285722017-12-29 09:40:43 +020082 }
Michael Landoed64b5e2017-06-09 03:19:04 +030083}
84
Michael Landoed64b5e2017-06-09 03:19:04 +030085
86@NgModule({
87 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020088 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030089 ],
90 imports: [
91 BrowserModule,
92 UpgradeModule,
93 FormsModule,
94 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020095 LayoutModule,
96 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +030097 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020098 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +030099 CompositionPanelModule,
100 SdcUiComponentsModule,
101 AutomatedUpgradeModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200102 //We need to import them here since we use them in angular1
103 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200104 PropertiesAssignmentModule,
Michael Landoa5445102018-03-04 14:53:33 +0200105 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +0300106 InterfaceOperationModule,
107 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200108 ServicePathCreatorModule,
109 ServicePathsListModule,
110 ServicePathModule,
111 ServicePathSelectorModule
Michael Landoed64b5e2017-06-09 03:19:04 +0300112 ],
113 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300114 entryComponents: [
115 // *** sdc-ui components to be used as downgraded:
116 // SdcUiComponents.ButtonComponent
117 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300118 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300119 WindowRef,
Michael Landoed64b5e2017-06-09 03:19:04 +0300120 DataTypesServiceProvider,
121 SharingServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300122 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300123 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200124 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300125 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200126 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300127 CacheServiceProvider,
128 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200129 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300130 ModalsHandlerProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300131 AuthenticationService,
132 Cookie2Service,
133 ConfigService,
134 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200135 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200136 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300137 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300138 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300139 WorkflowServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300140 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200141 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200142 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300143 GroupsService,
Michael Landoa5445102018-03-04 14:53:33 +0200144 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200145 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300146 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300147 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200148 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200149 PluginsService,
Michael Lando5b593492018-07-29 16:13:45 +0300150 ArchiveService,
Idan Amit71904f22018-02-13 10:38:16 +0200151 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300152 {
153 provide: APP_INITIALIZER,
154 useFactory: configServiceFactory,
155 deps: [ConfigService],
156 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300157 },
Michael Lando5b593492018-07-29 16:13:45 +0300158 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300159 bootstrap: [AppComponent]
160})
161
162
163export class AppModule {
Michael Lando5b593492018-07-29 16:13:45 +0300164 constructor(public upgrade: UpgradeModule, public eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300165
Michael Landoed64b5e2017-06-09 03:19:04 +0300166 }
167}