blob: 1ae2df2d822b0356713146be21a3675768d54c38 [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';
miriamec2ce9142019-02-13 15:17:26 +020063import {ServiceDependenciesModule} from 'app/ng2/components/logic/service-dependencies/service-dependencies.module';
64import {ServiceDependenciesEditorModule} from './pages/service-dependencies-editor/service-dependencies-editor.module';
Michael Lando5b593492018-07-29 16:13:45 +030065import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/panel.module';
66import { WindowRef } from "./services/window.service";
67import {ArchiveService} from "./services/archive.service";
68import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
Idan Amiteedaaf92018-01-31 13:27:33 +020069import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
70import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020071import {EventBusService} from "./services/event-bus.service";
Michael Lando5b593492018-07-29 16:13:45 +030072import {GroupsService} from "./services/groups.service";
73import {PoliciesService} from "./services/policies.service";
74import {AutomatedUpgradeService} from "./pages/automated-upgrade/automated-upgrade.service";
75import {AutomatedUpgradeModule} from "./pages/automated-upgrade/automated-upgrade.module";
Michael Landoed64b5e2017-06-09 03:19:04 +030076
77export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
78
Michael Lando5b593492018-07-29 16:13:45 +030079export function configServiceFactory(config: ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020080 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030081 return Promise.all([
82 config.loadValidationConfiguration(),
83 config.loadPluginsConfiguration()
84 ]);
Idan Amit2c285722017-12-29 09:40:43 +020085 }
Michael Landoed64b5e2017-06-09 03:19:04 +030086}
87
Michael Landoed64b5e2017-06-09 03:19:04 +030088
89@NgModule({
90 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020091 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030092 ],
93 imports: [
94 BrowserModule,
95 UpgradeModule,
96 FormsModule,
97 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +020098 LayoutModule,
99 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +0300100 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200101 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300102 CompositionPanelModule,
103 SdcUiComponentsModule,
104 AutomatedUpgradeModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200105 //We need to import them here since we use them in angular1
106 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200107 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200108 PropertyCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200109 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +0300110 InterfaceOperationModule,
111 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200112 ServicePathCreatorModule,
113 ServicePathsListModule,
114 ServicePathModule,
miriamec2ce9142019-02-13 15:17:26 +0200115 ServicePathSelectorModule,
116 ServiceDependenciesModule,
117 ServiceDependenciesEditorModule
Michael Landoed64b5e2017-06-09 03:19:04 +0300118 ],
119 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300120 entryComponents: [
121 // *** sdc-ui components to be used as downgraded:
122 // SdcUiComponents.ButtonComponent
123 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300124 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300125 WindowRef,
Michael Landoed64b5e2017-06-09 03:19:04 +0300126 DataTypesServiceProvider,
127 SharingServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300128 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300129 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200130 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300131 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200132 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300133 CacheServiceProvider,
134 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200135 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300136 ModalsHandlerProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300137 AuthenticationService,
138 Cookie2Service,
139 ConfigService,
140 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200141 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200142 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300143 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300144 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300145 WorkflowServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300146 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200147 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200148 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300149 GroupsService,
Michael Landoa5445102018-03-04 14:53:33 +0200150 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200151 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300152 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300153 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200154 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200155 PluginsService,
Michael Lando5b593492018-07-29 16:13:45 +0300156 ArchiveService,
Idan Amit71904f22018-02-13 10:38:16 +0200157 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300158 {
159 provide: APP_INITIALIZER,
160 useFactory: configServiceFactory,
161 deps: [ConfigService],
162 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300163 },
Michael Lando5b593492018-07-29 16:13:45 +0300164 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300165 bootstrap: [AppComponent]
166})
167
168
169export class AppModule {
Michael Lando5b593492018-07-29 16:13:45 +0300170 constructor(public upgrade: UpgradeModule, public eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300171
Michael Landoed64b5e2017-06-09 03:19:04 +0300172 }
173}