blob: b3c12a5f1153cd0859a72e2a26feaec9eca7fa77 [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";
98
99
100declare const __ENV__: string;
Michael Landoed64b5e2017-06-09 03:19:04 +0300101
102export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
103
ys969316a9fce2020-01-19 13:50:02 +0200104export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300105
ys969316a9fce2020-01-19 13:50:02 +0200106 return () => {
107 return authService.authenticate().toPromise()
108 .then((userInfo: IUserProperties) => {
109 authService.setLoggedinUser(userInfo);
110 return Promise.all([
111 config.loadSdcSetupData(),
112 config.loadValidationConfiguration(),
113 config.loadPluginsConfiguration(),
114 ])
115 }).then(() => {
116 eventListener.notifyObservers('ON_FINISH_LOADING');
117 })
118 .catch(() => {
119 console.log('AUTH FAILED! from app module');
120 });
121 };
122}
Michael Landoed64b5e2017-06-09 03:19:04 +0300123
124@NgModule({
125 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +0200126 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +0300127 ],
128 imports: [
ys969316a9fce2020-01-19 13:50:02 +0200129 BrowserAnimationsModule,
Michael Landoed64b5e2017-06-09 03:19:04 +0300130 BrowserModule,
131 UpgradeModule,
132 FormsModule,
ys969316a9fce2020-01-19 13:50:02 +0200133 HttpClientModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200134 LayoutModule,
135 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +0300136 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200137 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300138 CompositionPanelModule,
139 SdcUiComponentsModule,
140 AutomatedUpgradeModule,
ys969316a9fce2020-01-19 13:50:02 +0200141
142 // We need to import them here since we use them in angular1
Tal Gitelman51d50f02017-12-10 18:55:03 +0200143 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200144 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200145 PropertyCreatorModule,
Toshimichi Fukuda51411ac2019-04-18 21:38:46 +0900146 DeclareListModule,
Michael Landoa5445102018-03-04 14:53:33 +0200147 PluginFrameModule,
ys969316a9fce2020-01-19 13:50:02 +0200148 PluginsModule,
Arielk802bd2a2018-04-16 15:37:39 +0300149 InterfaceOperationModule,
150 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200151 ServicePathCreatorModule,
152 ServicePathsListModule,
miriamec2ce9142019-02-13 15:17:26 +0200153 ServicePathSelectorModule,
ojasdubey4192e3c2019-03-18 14:15:03 +0530154 ServiceConsumptionCreatorModule,
miriamec2ce9142019-02-13 15:17:26 +0200155 ServiceDependenciesModule,
miriame41ee9cb2019-03-04 13:49:15 +0200156 ServiceDependenciesEditorModule,
ys969316a9fce2020-01-19 13:50:02 +0200157 WorkspaceModule,
158 ModalsModule,
159 CatalogModule,
160 HomeModule,
161 NgxsModule.forRoot([]),
162 NgxsLoggerPluginModule.forRoot({ logger: console, collapsed: false }),
163 NgxsReduxDevtoolsPluginModule.forRoot({
164 disabled: __ENV__ === 'prod'
165 })
Michael Landoed64b5e2017-06-09 03:19:04 +0300166 ],
167 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300168 entryComponents: [
Michael Lando5b593492018-07-29 16:13:45 +0300169 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300170 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300171 WindowRef,
ys969316a9fce2020-01-19 13:50:02 +0200172 httpInterceptorProviders,
Michael Landoed64b5e2017-06-09 03:19:04 +0300173 DataTypesServiceProvider,
ys969316a9fce2020-01-19 13:50:02 +0200174 SharingService,
175 CacheService,
176 HomeService,
andre.schmidcd6f9332020-01-29 17:25:21 +0000177 ArtifactConfigService,
Michael Lando5b593492018-07-29 16:13:45 +0300178 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300179 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200180 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300181 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200182 ScopeServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200183 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300184 ModalsHandlerProvider,
ys969316a9fce2020-01-19 13:50:02 +0200185 UserService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300186 Cookie2Service,
187 ConfigService,
188 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200189 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200190 ModalService,
ys969316a9fce2020-01-19 13:50:02 +0200191 ImportVSPService,
192 OnboardingService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300193 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300194 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300195 WorkflowServiceNg2,
miriame41ee9cb2019-03-04 13:49:15 +0200196 ToscaTypesServiceNg2,
ys969316a9fce2020-01-19 13:50:02 +0200197 WorkspaceNg1BridgeService,
198 HttpHelperService,
199 AuthenticationService,
Michael Landoa5445102018-03-04 14:53:33 +0200200 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300201 GroupsService,
ys969316a9fce2020-01-19 13:50:02 +0200202 ModulesService,
Michael Landoa5445102018-03-04 14:53:33 +0200203 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200204 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300205 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300206 ComponentInstanceServiceNg2,
ys969316a9fce2020-01-19 13:50:02 +0200207 EventListenerService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200208 TranslationServiceConfig,
ys969316a9fce2020-01-19 13:50:02 +0200209 TranslateService,
Idan Amiteedaaf92018-01-31 13:27:33 +0200210 PluginsService,
ys969316a9fce2020-01-19 13:50:02 +0200211 CatalogService,
Idan Amit71904f22018-02-13 10:38:16 +0200212 EventBusService,
ys969316a9fce2020-01-19 13:50:02 +0200213 FileUtilsService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300214 {
215 provide: APP_INITIALIZER,
216 useFactory: configServiceFactory,
ys969316a9fce2020-01-19 13:50:02 +0200217 deps: [ConfigService, AuthenticationService, EventListenerService],
Michael Landoed64b5e2017-06-09 03:19:04 +0300218 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300219 },
Michael Lando5b593492018-07-29 16:13:45 +0300220 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300221 bootstrap: [AppComponent]
222})
223
Michael Landoed64b5e2017-06-09 03:19:04 +0300224export class AppModule {
ys969316a9fce2020-01-19 13:50:02 +0200225 constructor(public upgrade: UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300226
Michael Landoed64b5e2017-06-09 03:19:04 +0300227 }
228}