blob: 3f43feb7b2944bff727bef0ee0510abe543e8629 [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';
75import { IUserProperties } from 'app/models';
76import { PluginsModule } from './pages/plugins/plugins-module';
77import {WorkspaceNg1BridgeService} from './pages/workspace/workspace-ng1-bridge-service';
78import {NgxsModule} from '@ngxs/store';
79import {NgxsLoggerPluginModule} from '@ngxs/logger-plugin';
80import {NgxsReduxDevtoolsPluginModule} from '@ngxs/devtools-plugin';
81import {EventListenerService} from '../services/event-listener-service';
82import { HttpClientModule } from '@angular/common/http';
83import { httpInterceptorProviders } from './http-interceptor';
84import { HttpHelperService } from './services/http-hepler.service';
85import { ModulesService } from "./services/modules.service";
86import { TranslateService } from 'app/ng2/shared/translator/translate.service';
87import { FileUtilsService } from './services/file-utils.service';
88import { ImportVSPService } from './components/modals/onboarding-modal/import-vsp.service';
89import { OnboardingService } from './services/onboarding.service';
90import { ServiceConsumptionCreatorModule } from './pages/service-consumption-editor/service-consumption-editor.module';
91import { ServiceDependenciesModule } from './components/logic/service-dependencies/service-dependencies.module';
92import { ServiceDependenciesEditorModule } from './pages/service-dependencies-editor/service-dependencies-editor.module';
93import { PropertyCreatorModule } from './pages/properties-assignment/property-creator/property-creator.module';
94import { DeclareListModule } from './pages/properties-assignment/declare-list/declare-list.module';
95import { WorkflowServiceNg2 } from './services/workflow.service';
96import { ToscaTypesServiceNg2 } from "./services/tosca-types.service";
97
98
99declare const __ENV__: string;
Michael Landoed64b5e2017-06-09 03:19:04 +0300100
101export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
102
ys969316a9fce2020-01-19 13:50:02 +0200103export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300104
ys969316a9fce2020-01-19 13:50:02 +0200105 return () => {
106 return authService.authenticate().toPromise()
107 .then((userInfo: IUserProperties) => {
108 authService.setLoggedinUser(userInfo);
109 return Promise.all([
110 config.loadSdcSetupData(),
111 config.loadValidationConfiguration(),
112 config.loadPluginsConfiguration(),
113 ])
114 }).then(() => {
115 eventListener.notifyObservers('ON_FINISH_LOADING');
116 })
117 .catch(() => {
118 console.log('AUTH FAILED! from app module');
119 });
120 };
121}
Michael Landoed64b5e2017-06-09 03:19:04 +0300122
123@NgModule({
124 declarations: [
Tal Gitelman51d50f02017-12-10 18:55:03 +0200125 AppComponent
Michael Landoed64b5e2017-06-09 03:19:04 +0300126 ],
127 imports: [
ys969316a9fce2020-01-19 13:50:02 +0200128 BrowserAnimationsModule,
Michael Landoed64b5e2017-06-09 03:19:04 +0300129 BrowserModule,
130 UpgradeModule,
131 FormsModule,
ys969316a9fce2020-01-19 13:50:02 +0200132 HttpClientModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200133 LayoutModule,
134 TranslateModule,
Michael Lando5b593492018-07-29 16:13:45 +0300135 MultilineEllipsisModule,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200136 UiElementsModule,
Michael Lando5b593492018-07-29 16:13:45 +0300137 CompositionPanelModule,
138 SdcUiComponentsModule,
139 AutomatedUpgradeModule,
ys969316a9fce2020-01-19 13:50:02 +0200140
141 // We need to import them here since we use them in angular1
Tal Gitelman51d50f02017-12-10 18:55:03 +0200142 ConnectionWizardModule,
Idan Amit5197c8b2018-01-15 14:31:42 +0200143 PropertiesAssignmentModule,
Talio09537852019-01-31 18:00:36 +0200144 PropertyCreatorModule,
Toshimichi Fukuda51411ac2019-04-18 21:38:46 +0900145 DeclareListModule,
Michael Landoa5445102018-03-04 14:53:33 +0200146 PluginFrameModule,
ys969316a9fce2020-01-19 13:50:02 +0200147 PluginsModule,
Arielk802bd2a2018-04-16 15:37:39 +0300148 InterfaceOperationModule,
149 OperationCreatorModule,
Michael Landoa5445102018-03-04 14:53:33 +0200150 ServicePathCreatorModule,
151 ServicePathsListModule,
miriamec2ce9142019-02-13 15:17:26 +0200152 ServicePathSelectorModule,
ojasdubey4192e3c2019-03-18 14:15:03 +0530153 ServiceConsumptionCreatorModule,
miriamec2ce9142019-02-13 15:17:26 +0200154 ServiceDependenciesModule,
miriame41ee9cb2019-03-04 13:49:15 +0200155 ServiceDependenciesEditorModule,
ys969316a9fce2020-01-19 13:50:02 +0200156 WorkspaceModule,
157 ModalsModule,
158 CatalogModule,
159 HomeModule,
160 NgxsModule.forRoot([]),
161 NgxsLoggerPluginModule.forRoot({ logger: console, collapsed: false }),
162 NgxsReduxDevtoolsPluginModule.forRoot({
163 disabled: __ENV__ === 'prod'
164 })
Michael Landoed64b5e2017-06-09 03:19:04 +0300165 ],
166 exports: [],
Michael Lando5b593492018-07-29 16:13:45 +0300167 entryComponents: [
Michael Lando5b593492018-07-29 16:13:45 +0300168 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300169 providers: [
Michael Lando5b593492018-07-29 16:13:45 +0300170 WindowRef,
ys969316a9fce2020-01-19 13:50:02 +0200171 httpInterceptorProviders,
Michael Landoed64b5e2017-06-09 03:19:04 +0300172 DataTypesServiceProvider,
ys969316a9fce2020-01-19 13:50:02 +0200173 SharingService,
174 CacheService,
175 HomeService,
Michael Lando5b593492018-07-29 16:13:45 +0300176 ComponentFactoryProvider,
Michael Landoed64b5e2017-06-09 03:19:04 +0300177 CookieServiceProvider,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200178 StateServiceFactory,
Michael Landoed64b5e2017-06-09 03:19:04 +0300179 StateParamsServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200180 ScopeServiceFactory,
Michael Landoa5445102018-03-04 14:53:33 +0200181 NotificationServiceProvider,
Michael Lando5b593492018-07-29 16:13:45 +0300182 ModalsHandlerProvider,
ys969316a9fce2020-01-19 13:50:02 +0200183 UserService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300184 Cookie2Service,
185 ConfigService,
186 ComponentServiceNg2,
Michael Landoa5445102018-03-04 14:53:33 +0200187 ComponentServiceFactoryNg2,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200188 ModalService,
ys969316a9fce2020-01-19 13:50:02 +0200189 ImportVSPService,
190 OnboardingService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300191 ServiceServiceNg2,
Michael Lando5b593492018-07-29 16:13:45 +0300192 AutomatedUpgradeService,
Arielkeaaf8012018-07-31 12:59:36 +0300193 WorkflowServiceNg2,
miriame41ee9cb2019-03-04 13:49:15 +0200194 ToscaTypesServiceNg2,
ys969316a9fce2020-01-19 13:50:02 +0200195 WorkspaceNg1BridgeService,
196 HttpHelperService,
197 AuthenticationService,
Michael Landoa5445102018-03-04 14:53:33 +0200198 PoliciesService,
Michael Lando5b593492018-07-29 16:13:45 +0300199 GroupsService,
ys969316a9fce2020-01-19 13:50:02 +0200200 ModulesService,
Michael Landoa5445102018-03-04 14:53:33 +0200201 DynamicComponentService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200202 SdcConfig,
Michael Lando5b593492018-07-29 16:13:45 +0300203 SdcMenu,
Michael Landoed64b5e2017-06-09 03:19:04 +0300204 ComponentInstanceServiceNg2,
ys969316a9fce2020-01-19 13:50:02 +0200205 EventListenerService,
Tal Gitelman51d50f02017-12-10 18:55:03 +0200206 TranslationServiceConfig,
ys969316a9fce2020-01-19 13:50:02 +0200207 TranslateService,
Idan Amiteedaaf92018-01-31 13:27:33 +0200208 PluginsService,
ys969316a9fce2020-01-19 13:50:02 +0200209 CatalogService,
Idan Amit71904f22018-02-13 10:38:16 +0200210 EventBusService,
ys969316a9fce2020-01-19 13:50:02 +0200211 FileUtilsService,
Michael Landoed64b5e2017-06-09 03:19:04 +0300212 {
213 provide: APP_INITIALIZER,
214 useFactory: configServiceFactory,
ys969316a9fce2020-01-19 13:50:02 +0200215 deps: [ConfigService, AuthenticationService, EventListenerService],
Michael Landoed64b5e2017-06-09 03:19:04 +0300216 multi: true
Tal Gitelmaned7e1c32017-06-29 19:30:00 +0300217 },
Michael Lando5b593492018-07-29 16:13:45 +0300218 ],
Michael Landoed64b5e2017-06-09 03:19:04 +0300219 bootstrap: [AppComponent]
220})
221
Michael Landoed64b5e2017-06-09 03:19:04 +0300222export class AppModule {
ys969316a9fce2020-01-19 13:50:02 +0200223 constructor(public upgrade: UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300224
Michael Landoed64b5e2017-06-09 03:19:04 +0300225 }
226}