blob: 0ff9378949e2bff22297f6f46882c1fc73def6ab [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';
miriamec2ce9142019-02-13 15:17:26 +020064import {ServiceDependenciesModule} from 'app/ng2/components/logic/service-dependencies/service-dependencies.module';
65import {ServiceDependenciesEditorModule} from './pages/service-dependencies-editor/service-dependencies-editor.module';
Michael Lando5b593492018-07-29 16:13:45 +030066import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/panel.module';
67import { WindowRef } from "./services/window.service";
68import {ArchiveService} from "./services/archive.service";
69import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
Idan Amiteedaaf92018-01-31 13:27:33 +020070import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
71import {PluginsService} from "./services/plugins.service";
Idan Amit71904f22018-02-13 10:38:16 +020072import {EventBusService} from "./services/event-bus.service";
Michael Lando5b593492018-07-29 16:13:45 +030073import {GroupsService} from "./services/groups.service";
74import {PoliciesService} from "./services/policies.service";
75import {AutomatedUpgradeService} from "./pages/automated-upgrade/automated-upgrade.service";
76import {AutomatedUpgradeModule} from "./pages/automated-upgrade/automated-upgrade.module";
miriame41ee9cb2019-03-04 13:49:15 +020077import {RequirementsEditorModule} from "./pages/req-and-capabilities-editor/requirements-editor/requirements-editor.module"
78import {CapabilitiesEditorModule} from "./pages/req-and-capabilities-editor/capabilities-editor/capabilities-editor.module"
Michael Landoed64b5e2017-06-09 03:19:04 +030079
80export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
81
Michael Lando5b593492018-07-29 16:13:45 +030082export function configServiceFactory(config: ConfigService) {
Idan Amit2c285722017-12-29 09:40:43 +020083 return () => {
Idan Amitf1039ca2018-05-21 16:09:35 +030084 return Promise.all([
85 config.loadValidationConfiguration(),
86 config.loadPluginsConfiguration()
87 ]);
Idan Amit2c285722017-12-29 09:40:43 +020088 }
Michael Landoed64b5e2017-06-09 03:19:04 +030089}
90
Michael Landoed64b5e2017-06-09 03:19:04 +030091
92@NgModule({
93 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +020094 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +030095 ],
96 imports: [
97 BrowserModule,
98 UpgradeModule,
99 FormsModule,
100 HttpModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200101 LayoutModule,
102 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +0300103 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200104 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300105 CompositionPanelModule,
106 SdcUiComponentsModule,
107 AutomatedUpgradeModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200108 //We need to import them here since we use them in angular1
109 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200110 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200111 PropertyCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200112 PluginFrameModule,
Arielk802bd2a2018-04-16 15:37:39 +0300113 InterfaceOperationModule,
114 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200115 ServicePathCreatorModule,
116 ServicePathsListModule,
117 ServicePathModule,
miriamec2ce9142019-02-13 15:17:26 +0200118 ServicePathSelectorModule,
119 ServiceDependenciesModule,
miriame41ee9cb2019-03-04 13:49:15 +0200120 ServiceDependenciesEditorModule,
121 RequirementsEditorModule,
122 CapabilitiesEditorModule
Michael Landoed64b5e2017-06-09 03:19:04 +0300123 ],
124 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300125 entryComponents: [
126 // *** sdc-ui components to be used as downgraded:
miriame41ee9cb2019-03-04 13:49:15 +0200127 SdcUiComponents.SvgIconComponent
Michael Lando5b593492018-07-29 16:13:45 +0300128 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300129 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300130 WindowRef,
Michael Landoed64b5e2017-06-09 03:19:04 +0300131 DataTypesServiceProvider,
132 SharingServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300133 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300134 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200135 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300136 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200137 ScopeServiceFactory,
Michael Landob3d48982017-06-11 14:22:02 +0300138 CacheServiceProvider,
139 EventListenerServiceProvider,
Michael Landoa5445102018-03-04 14:53:33 +0200140 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300141 ModalsHandlerProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300142 AuthenticationService,
143 Cookie2Service,
144 ConfigService,
145 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200146 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200147 ModalService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300148 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300149 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300150 WorkflowServiceNg2,
miriame41ee9cb2019-03-04 13:49:15 +0200151 ToscaTypesServiceNg2,
Avi Zivf5854fd2017-07-31 15:50:46 +0300152 HttpService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200153 UserService,
Michael Landoa5445102018-03-04 14:53:33 +0200154 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300155 GroupsService,
Michael Landoa5445102018-03-04 14:53:33 +0200156 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200157 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300158 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300159 ComponentInstanceServiceNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200160 TranslationServiceConfig,
Idan Amiteedaaf92018-01-31 13:27:33 +0200161 PluginsService,
Michael Lando5b593492018-07-29 16:13:45 +0300162 ArchiveService,
Idan Amit71904f22018-02-13 10:38:16 +0200163 EventBusService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300164 {
165 provide: APP_INITIALIZER,
166 useFactory: configServiceFactory,
167 deps: [ConfigService],
168 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300169 },
Michael Lando5b593492018-07-29 16:13:45 +0300170 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300171 bootstrap: [AppComponent]
172})
173
174
175export class AppModule {
Michael Lando5b593492018-07-29 16:13:45 +0300176 constructor(public upgrade: UpgradeModule, public eventBusService:EventBusService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300177
Michael Landoed64b5e2017-06-09 03:19:04 +0300178 }
179}