blob: 22c66243488fa8c0363c712a55f73fb5527eaefd [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';
miriame41ee9cb2019-03-04 13:49:15 +020046import {ToscaTypesServiceNg2} from "./services/tosca-types.service";
Michael Lando5b593492018-07-29 16:13:45 +030047import { ModalService } from "./services/modal.service";
48import { UiElementsModule } from "./components/ui/ui-elements.module";
49import { ConnectionWizardModule } from "./pages/connection-wizard/connection-wizard.module";
Arielkeaaf8012018-07-31 12:59:36 +030050import { InterfaceOperationModule } from "./pages/interface-operation/interface-operation.module";
51import { OperationCreatorModule } from "./pages/interface-operation/operation-creator/operation-creator.module";
Michael Lando5b593492018-07-29 16:13:45 +030052import { LayoutModule } from "./components/layout/layout.module";
53import { UserService } from "./services/user.service";
54import { DynamicComponentService } from "./services/dynamic-component.service";
55import { SdcConfig } from "./config/sdc-config.config";
56import { SdcMenu } from "./config/sdc-menu.config";
Tal Gitelman51d50f02017-12-10 18:55:03 +020057import { TranslateModule } from "./shared/translator/translate.module";
58import { TranslationServiceConfig } from "./config/translation.service.config";
Michael Lando5b593492018-07-29 16:13:45 +030059import { MultilineEllipsisModule } from "./shared/multiline-ellipsis/multiline-ellipsis.module";
60import { ServicePathCreatorModule } from './pages/service-path-creator/service-path-creator.module';
61import { ServicePathsListModule } from './pages/service-paths-list/service-paths-list.module';
62import { ServicePathModule } from 'app/ng2/components/logic/service-path/service-path.module';
63import { ServicePathSelectorModule } from 'app/ng2/components/logic/service-path-selector/service-path-selector.module';
ojasdubey4192e3c2019-03-18 14:15:03 +053064import { ServiceConsumptionModule } from 'app/ng2/components/logic/service-consumption/service-consumption.module';
65import { ServiceConsumptionCreatorModule } from './pages/service-consumption-editor/service-consumption-editor.module';
miriamec2ce9142019-02-13 15:17:26 +020066import {ServiceDependenciesModule} from 'app/ng2/components/logic/service-dependencies/service-dependencies.module';
67import {ServiceDependenciesEditorModule} from './pages/service-dependencies-editor/service-dependencies-editor.module';
Michael Lando5b593492018-07-29 16:13:45 +030068import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/panel.module';
69import { WindowRef } from "./services/window.service";
70import {ArchiveService} from "./services/archive.service";
71import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
Idan Amiteedaaf92018-01-31 13:27:33 +020072import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
73import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020074import {EventBusService} from "./services/event-bus.service";
Michael Lando5b593492018-07-29 16:13:45 +030075import {GroupsService} from "./services/groups.service";
76import {PoliciesService} from "./services/policies.service";
77import {AutomatedUpgradeService} from "./pages/automated-upgrade/automated-upgrade.service";
78import {AutomatedUpgradeModule} from "./pages/automated-upgrade/automated-upgrade.module";
miriame41ee9cb2019-03-04 13:49:15 +020079import {RequirementsEditorModule} from "./pages/req-and-capabilities-editor/requirements-editor/requirements-editor.module"
80import {CapabilitiesEditorModule} from "./pages/req-and-capabilities-editor/capabilities-editor/capabilities-editor.module"
Michael Landoed64b5e2017-06-09 03:19:04 +030081
82export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
83
Michael Lando5b593492018-07-29 16:13:45 +030084export function configServiceFactory(config: ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020085 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030086 return Promise.all([
87 config.loadValidationConfiguration(),
88 config.loadPluginsConfiguration()
89 ]);
Idan Amit2c285722017-12-29 09:40:43 +020090 }
Michael Landoed64b5e2017-06-09 03:19:04 +030091}
92
Michael Landoed64b5e2017-06-09 03:19:04 +030093
94@NgModule({
95 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020096 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030097 ],
98 imports: [
99 BrowserModule,
100 UpgradeModule,
101 FormsModule,
102 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200103 LayoutModule,
104 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +0300105 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200106 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300107 CompositionPanelModule,
108 SdcUiComponentsModule,
109 AutomatedUpgradeModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200110 //We need to import them here since we use them in angular1
111 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200112 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200113 PropertyCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200114 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +0300115 InterfaceOperationModule,
116 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200117 ServicePathCreatorModule,
118 ServicePathsListModule,
119 ServicePathModule,
miriamec2ce9142019-02-13 15:17:26 +0200120 ServicePathSelectorModule,
ojasdubey4192e3c2019-03-18 14:15:03 +0530121 ServiceConsumptionModule,
122 ServiceConsumptionCreatorModule,
miriamec2ce9142019-02-13 15:17:26 +0200123 ServiceDependenciesModule,
miriame41ee9cb2019-03-04 13:49:15 +0200124 ServiceDependenciesEditorModule,
125 RequirementsEditorModule,
126 CapabilitiesEditorModule
Michael Landoed64b5e2017-06-09 03:19:04 +0300127 ],
128 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300129 entryComponents: [
130 // *** sdc-ui components to be used as downgraded:
miriame41ee9cb2019-03-04 13:49:15 +0200131 SdcUiComponents.SvgIconComponent
Michael Lando5b593492018-07-29 16:13:45 +0300132 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300133 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300134 WindowRef,
Michael Landoed64b5e2017-06-09 03:19:04 +0300135 DataTypesServiceProvider,
136 SharingServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300137 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300138 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200139 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300140 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200141 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300142 CacheServiceProvider,
143 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200144 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300145 ModalsHandlerProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300146 AuthenticationService,
147 Cookie2Service,
148 ConfigService,
149 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200150 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200151 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300152 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300153 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300154 WorkflowServiceNg2,
miriame41ee9cb2019-03-04 13:49:15 +0200155 ToscaTypesServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300156 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200157 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200158 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300159 GroupsService,
Michael Landoa5445102018-03-04 14:53:33 +0200160 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200161 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300162 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300163 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200164 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200165 PluginsService,
Michael Lando5b593492018-07-29 16:13:45 +0300166 ArchiveService,
Idan Amit71904f22018-02-13 10:38:16 +0200167 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300168 {
169 provide: APP_INITIALIZER,
170 useFactory: configServiceFactory,
171 deps: [ConfigService],
172 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300173 },
Michael Lando5b593492018-07-29 16:13:45 +0300174 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300175 bootstrap: [AppComponent]
176})
177
178
179export class AppModule {
Michael Lando5b593492018-07-29 16:13:45 +0300180 constructor(public upgrade: UpgradeModule, public eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300181
Michael Landoed64b5e2017-06-09 03:19:04 +0300182 }
183}