blob: b94ba61f752389df7689d681e947eedd6d53a544 [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
ys969316a9fce2020-01-19 13:50:02 +020021import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
Michael Lando5b593492018-07-29 16:13:45 +030022import { BrowserModule } from '@angular/platform-browser';
23import { NgModule, APP_INITIALIZER } from '@angular/core';
24import { FormsModule } from '@angular/forms';
25import { forwardRef } from '@angular/core';
26import { AppComponent } from './app.component';
27import { UpgradeAdapter } from '@angular/upgrade';
28import { UpgradeModule } from '@angular/upgrade/static';
ys969316a9fce2020-01-19 13:50:02 +020029import { SdcUiComponentsModule, SdcUiComponents } from 'onap-ui-angular';
Michael Lando5b593492018-07-29 16:13:45 +030030import { PropertiesAssignmentModule } from './pages/properties-assignment/properties-assignment.module';
Michael Landoed64b5e2017-06-09 03:19:04 +030031import {
ys969316a9fce2020-01-19 13:50:02 +020032 DataTypesServiceProvider, CookieServiceProvider, StateServiceFactory,
33 StateParamsServiceFactory, ScopeServiceFactory,
Michael Lando5b593492018-07-29 16:13:45 +030034 NotificationServiceProvider, ComponentFactoryProvider
ys969316a9fce2020-01-19 13:50:02 +020035} from './utils/ng1-upgraded-provider';
36import { ConfigService } from './services/config.service';
Michael Lando5b593492018-07-29 16:13:45 +030037import { AuthenticationService } from './services/authentication.service';
ys969316a9fce2020-01-19 13:50:02 +020038import { Cookie2Service } from './services/cookie.service';
39import { ComponentServiceNg2 } from './services/component-services/component.service';
40import { ComponentServiceFactoryNg2 } from './services/component-services/component.service.factory';
41import { ServiceServiceNg2 } from './services/component-services/service.service';
42import { ComponentInstanceServiceNg2 } from './services/component-instance-services/component-instance.service';
43import { ModalService } from './services/modal.service';
44import { UiElementsModule } from './components/ui/ui-elements.module';
45import { ConnectionWizardModule } from './pages/composition/graph/connection-wizard/connection-wizard.module';
46import { InterfaceOperationModule } from './pages/interface-operation/interface-operation.module';
47import { OperationCreatorModule } from './pages/interface-operation/operation-creator/operation-creator.module';
48import { LayoutModule } from './components/layout/layout.module';
49import { UserService } from './services/user.service';
50import { DynamicComponentService } from './services/dynamic-component.service';
51import { SdcConfig } from './config/sdc-config.config';
52import { SdcMenu } from './config/sdc-menu.config';
53import { TranslateModule } from './shared/translator/translate.module';
54import { TranslationServiceConfig } from './config/translation.service.config';
55import { MultilineEllipsisModule } from './shared/multiline-ellipsis/multiline-ellipsis.module';
56import { ServicePathCreatorModule } from './pages/composition/graph/service-path-creator/service-path-creator.module';
57import { ServicePathsListModule } from './pages/composition/graph/service-paths-list/service-paths-list.module';
58import { ServicePathSelectorModule } from 'app/ng2/pages/composition/graph/service-path-selector/service-path-selector.module';
59import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/composition-panel.module';
60import { CatalogModule } from './pages/catalog/catalog.module';
61import { HomeModule } from './pages/home/home.module';
62import { WindowRef } from './services/window.service';
63import { CatalogService } from './services/catalog.service';
Michael Lando5b593492018-07-29 16:13:45 +030064import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
ys969316a9fce2020-01-19 13:50:02 +020065import { PluginFrameModule } from './components/ui/plugin/plugin-frame.module';
66import { PluginsService } from './services/plugins.service';
67import { EventBusService } from './services/event-bus.service';
68import { GroupsService } from './services/groups.service';
69import { PoliciesService } from './services/policies.service';
70import { AutomatedUpgradeService } from './pages/automated-upgrade/automated-upgrade.service';
71import { AutomatedUpgradeModule } from './pages/automated-upgrade/automated-upgrade.module';
72import {WorkspaceModule} from './pages/workspace/workspace.module';
73import { ModalsModule } from './components/modals/modals.module';
74import { SharingService, CacheService, HomeService } from 'app/services-ng2';
andre.schmidcd6f9332020-01-29 17:25:21 +000075import { ArtifactConfigService } from "./services/artifact-config.service";
ys969316a9fce2020-01-19 13:50:02 +020076import { IUserProperties } from 'app/models';
77import { PluginsModule } from './pages/plugins/plugins-module';
78import {WorkspaceNg1BridgeService} from './pages/workspace/workspace-ng1-bridge-service';
79import {NgxsModule} from '@ngxs/store';
80import {NgxsLoggerPluginModule} from '@ngxs/logger-plugin';
81import {NgxsReduxDevtoolsPluginModule} from '@ngxs/devtools-plugin';
82import {EventListenerService} from '../services/event-listener-service';
83import { HttpClientModule } from '@angular/common/http';
84import { httpInterceptorProviders } from './http-interceptor';
85import { HttpHelperService } from './services/http-hepler.service';
86import { ModulesService } from "./services/modules.service";
87import { TranslateService } from 'app/ng2/shared/translator/translate.service';
88import { FileUtilsService } from './services/file-utils.service';
89import { ImportVSPService } from './components/modals/onboarding-modal/import-vsp.service';
90import { OnboardingService } from './services/onboarding.service';
91import { ServiceConsumptionCreatorModule } from './pages/service-consumption-editor/service-consumption-editor.module';
92import { ServiceDependenciesModule } from './components/logic/service-dependencies/service-dependencies.module';
93import { ServiceDependenciesEditorModule } from './pages/service-dependencies-editor/service-dependencies-editor.module';
94import { PropertyCreatorModule } from './pages/properties-assignment/property-creator/property-creator.module';
95import { DeclareListModule } from './pages/properties-assignment/declare-list/declare-list.module';
96import { WorkflowServiceNg2 } from './services/workflow.service';
97import { ToscaTypesServiceNg2 } from "./services/tosca-types.service";
aribeiro1ae28c32020-10-05 10:45:11 +010098import {CapabilitiesFilterPropertiesEditorComponentModule} from "./pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.module";
ys969316a9fce2020-01-19 13:50:02 +020099
100
101declare const __ENV__: string;
Michael Landoed64b5e2017-06-09 03:19:04 +0300102
103export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
104
ys969316a9fce2020-01-19 13:50:02 +0200105export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300106
ys969316a9fce2020-01-19 13:50:02 +0200107 return () => {
108 return authService.authenticate().toPromise()
109 .then((userInfo: IUserProperties) => {
110 authService.setLoggedinUser(userInfo);
111 return Promise.all([
112 config.loadSdcSetupData(),
113 config.loadValidationConfiguration(),
114 config.loadPluginsConfiguration(),
115 ])
116 }).then(() => {
117 eventListener.notifyObservers('ON_FINISH_LOADING');
118 })
119 .catch(() => {
120 console.log('AUTH FAILED! from app module');
121 });
122 };
123}
Michael Landoed64b5e2017-06-09 03:19:04 +0300124
125@NgModule({
126 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +0200127 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +0300128 ],
129 imports: [
ys969316a9fce2020-01-19 13:50:02 +0200130 BrowserAnimationsModule,
Michael Landoed64b5e2017-06-09 03:19:04 +0300131 BrowserModule,
132 UpgradeModule,
133 FormsModule,
ys969316a9fce2020-01-19 13:50:02 +0200134 HttpClientModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200135 LayoutModule,
136 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +0300137 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200138 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300139 CompositionPanelModule,
140 SdcUiComponentsModule,
141 AutomatedUpgradeModule,
ys969316a9fce2020-01-19 13:50:02 +0200142
143 // We need to import them here since we use them in angular1
Tal Gitelman51d50f02017-12-10 18:55:03 +0200144 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200145 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200146 PropertyCreatorModule,
Toshimichi Fukuda51411ac2019-04-18 21:38:46 +0900147 DeclareListModule,
Michael Landoa5445102018-03-04 14:53:33 +0200148 PluginFrameModule,
ys969316a9fce2020-01-19 13:50:02 +0200149 PluginsModule,
Arielk802bd2a2018-04-16 15:37:39 +0300150 InterfaceOperationModule,
151 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200152 ServicePathCreatorModule,
153 ServicePathsListModule,
miriamec2ce9142019-02-13 15:17:26 +0200154 ServicePathSelectorModule,
ojasdubey4192e3c2019-03-18 14:15:03 +0530155 ServiceConsumptionCreatorModule,
miriamec2ce9142019-02-13 15:17:26 +0200156 ServiceDependenciesModule,
miriame41ee9cb2019-03-04 13:49:15 +0200157 ServiceDependenciesEditorModule,
aribeiro1ae28c32020-10-05 10:45:11 +0100158 CapabilitiesFilterPropertiesEditorComponentModule,
ys969316a9fce2020-01-19 13:50:02 +0200159 WorkspaceModule,
160 ModalsModule,
161 CatalogModule,
162 HomeModule,
163 NgxsModule.forRoot([]),
164 NgxsLoggerPluginModule.forRoot({ logger: console, collapsed: false }),
165 NgxsReduxDevtoolsPluginModule.forRoot({
166 disabled: __ENV__ === 'prod'
167 })
Michael Landoed64b5e2017-06-09 03:19:04 +0300168 ],
169 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300170 entryComponents: [
Michael Lando5b593492018-07-29 16:13:45 +0300171 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300172 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300173 WindowRef,
ys969316a9fce2020-01-19 13:50:02 +0200174 httpInterceptorProviders,
Michael Landoed64b5e2017-06-09 03:19:04 +0300175 DataTypesServiceProvider,
ys969316a9fce2020-01-19 13:50:02 +0200176 SharingService,
177 CacheService,
178 HomeService,
andre.schmidcd6f9332020-01-29 17:25:21 +0000179 ArtifactConfigService,
Michael Lando5b593492018-07-29 16:13:45 +0300180 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300181 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200182 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300183 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200184 ScopeServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200185 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300186 ModalsHandlerProvider,
ys969316a9fce2020-01-19 13:50:02 +0200187 UserService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300188 Cookie2Service,
189 ConfigService,
190 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200191 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200192 ModalService,
ys969316a9fce2020-01-19 13:50:02 +0200193 ImportVSPService,
194 OnboardingService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300195 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300196 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300197 WorkflowServiceNg2,
miriame41ee9cb2019-03-04 13:49:15 +0200198 ToscaTypesServiceNg2,
ys969316a9fce2020-01-19 13:50:02 +0200199 WorkspaceNg1BridgeService,
200 HttpHelperService,
201 AuthenticationService,
Michael Landoa5445102018-03-04 14:53:33 +0200202 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300203 GroupsService,
ys969316a9fce2020-01-19 13:50:02 +0200204 ModulesService,
Michael Landoa5445102018-03-04 14:53:33 +0200205 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200206 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300207 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300208 ComponentInstanceServiceNg2,
ys969316a9fce2020-01-19 13:50:02 +0200209 EventListenerService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200210 TranslationServiceConfig,
ys969316a9fce2020-01-19 13:50:02 +0200211 TranslateService,
Idan Amiteedaaf92018-01-31 13:27:33 +0200212 PluginsService,
ys969316a9fce2020-01-19 13:50:02 +0200213 CatalogService,
Idan Amit71904f22018-02-13 10:38:16 +0200214 EventBusService,
ys969316a9fce2020-01-19 13:50:02 +0200215 FileUtilsService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300216 {
217 provide: APP_INITIALIZER,
218 useFactory: configServiceFactory,
ys969316a9fce2020-01-19 13:50:02 +0200219 deps: [ConfigService, AuthenticationService, EventListenerService],
Michael Landoed64b5e2017-06-09 03:19:04 +0300220 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300221 },
Michael Lando5b593492018-07-29 16:13:45 +0300222 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300223 bootstrap: [AppComponent]
224})
225
Michael Landoed64b5e2017-06-09 03:19:04 +0300226export class AppModule {
ys969316a9fce2020-01-19 13:50:02 +0200227 constructor(public upgrade: UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300228
Michael Landoed64b5e2017-06-09 03:19:04 +0300229 }
230}