blob: bb1119953bb14891713f3fd75c4c25935d168bce [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
vasraz26e50292021-02-16 17:37:57 +000021import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
22import {BrowserModule} from '@angular/platform-browser';
Michael Lando5b593492018-07-29 16:13:45 +030023import { NgModule, APP_INITIALIZER } from '@angular/core';
vasraz26e50292021-02-16 17:37:57 +000024import {FormsModule} from '@angular/forms';
Michael Lando5b593492018-07-29 16:13:45 +030025import { forwardRef } from '@angular/core';
vasraz26e50292021-02-16 17:37:57 +000026import {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';
vasraz26e50292021-02-16 17:37:57 +000030import {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';
vasraz26e50292021-02-16 17:37:57 +000036import {ConfigService} from './services/config.service';
37import {AuthenticationService} from './services/authentication.service';
38import {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';
ys969316a9fce2020-01-19 13:50:02 +020058import { 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';
vasraz26e50292021-02-16 17:37:57 +000060import {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';
vasraz26e50292021-02-16 17:37:57 +000065import {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';
ys969316a9fce2020-01-19 13:50:02 +020072import {WorkspaceModule} from './pages/workspace/workspace.module';
vasraz26e50292021-02-16 17:37:57 +000073import {ModalsModule} from './components/modals/modals.module';
ys969316a9fce2020-01-19 13:50:02 +020074import { SharingService, CacheService, HomeService } from 'app/services-ng2';
vasraz26e50292021-02-16 17:37:57 +000075import {ArtifactConfigService} from "./services/artifact-config.service";
76import {IUserProperties} from 'app/models';
77import {PluginsModule} from './pages/plugins/plugins-module';
ys969316a9fce2020-01-19 13:50:02 +020078import {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';
vasraz26e50292021-02-16 17:37:57 +000083import {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';
KrupaNagabhushan6d65fde2021-01-12 13:41:59 +000096import { InputListModule } from "./pages/properties-assignment/input-list/input-list.module";
vasraz26e50292021-02-16 17:37:57 +000097import {WorkflowServiceNg2} from './services/workflow.service';
98import {ToscaTypesServiceNg2} from "./services/tosca-types.service";
aribeiro1ae28c32020-10-05 10:45:11 +010099import {CapabilitiesFilterPropertiesEditorComponentModule} from "./pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.module";
aribeiro5c1f5752020-11-19 13:28:43 +0000100import {InterfaceOperationHandlerModule} from "./pages/composition/interface-operatons/operation-creator/interface-operation-handler.module";
vasraz26e50292021-02-16 17:37:57 +0000101import {AttributesOutputsModule} from "./pages/attributes-outputs/attributes-outputs.module";
vasraza6ae7292021-03-21 20:48:30 +0000102import { ElementService } from "./services/element.service";
aribeiro53df9762021-06-16 23:21:04 +0100103import { ModelService } from "./services/model.service";
ys969316a9fce2020-01-19 13:50:02 +0200104
105
106declare const __ENV__: string;
Michael Landoed64b5e2017-06-09 03:19:04 +0300107
108export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
109
ys969316a9fce2020-01-19 13:50:02 +0200110export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300111
vasraz26e50292021-02-16 17:37:57 +0000112 return () => {
113 return authService.authenticate().toPromise()
114 .then((userInfo: IUserProperties) => {
115 authService.setLoggedinUser(userInfo);
116 return Promise.all([
117 config.loadSdcSetupData(),
118 config.loadValidationConfiguration(),
119 config.loadPluginsConfiguration(),
120 ])
121 }).then(() => {
122 eventListener.notifyObservers('ON_FINISH_LOADING');
123 })
124 .catch(() => {
125 console.log('AUTH FAILED! from app module');
126 });
127 };
ys969316a9fce2020-01-19 13:50:02 +0200128}
Michael Landoed64b5e2017-06-09 03:19:04 +0300129
130@NgModule({
vasraz26e50292021-02-16 17:37:57 +0000131 declarations: [
132 AppComponent
133 ],
134 imports: [
135 BrowserAnimationsModule,
136 BrowserModule,
137 UpgradeModule,
138 FormsModule,
139 HttpClientModule,
140 LayoutModule,
141 TranslateModule,
142 MultilineEllipsisModule,
143 UiElementsModule,
144 CompositionPanelModule,
145 SdcUiComponentsModule,
146 AutomatedUpgradeModule,
ys969316a9fce2020-01-19 13:50:02 +0200147
vasraz26e50292021-02-16 17:37:57 +0000148 // We need to import them here since we use them in angular1
149 ConnectionWizardModule,
150 PropertiesAssignmentModule,
151 AttributesOutputsModule,
152 PropertyCreatorModule,
153 DeclareListModule,
KrupaNagabhushan6d65fde2021-01-12 13:41:59 +0000154 InputListModule,
vasraz26e50292021-02-16 17:37:57 +0000155 PluginFrameModule,
156 PluginsModule,
157 InterfaceOperationModule,
158 OperationCreatorModule,
aribeiro5c1f5752020-11-19 13:28:43 +0000159 InterfaceOperationHandlerModule,
vasraz26e50292021-02-16 17:37:57 +0000160 ServicePathCreatorModule,
161 ServicePathsListModule,
162 ServicePathSelectorModule,
163 ServiceConsumptionCreatorModule,
164 ServiceDependenciesModule,
165 ServiceDependenciesEditorModule,
166 CapabilitiesFilterPropertiesEditorComponentModule,
167 WorkspaceModule,
168 ModalsModule,
169 CatalogModule,
170 HomeModule,
171 NgxsModule.forRoot([]),
172 NgxsLoggerPluginModule.forRoot({logger: console, collapsed: false}),
173 NgxsReduxDevtoolsPluginModule.forRoot({
174 disabled: __ENV__ === 'prod'
175 })
176 ],
177 exports: [],
178 entryComponents: [],
179 providers: [
180 WindowRef,
181 httpInterceptorProviders,
182 DataTypesServiceProvider,
183 SharingService,
184 CacheService,
185 HomeService,
186 ArtifactConfigService,
187 ComponentFactoryProvider,
188 CookieServiceProvider,
189 StateServiceFactory,
190 StateParamsServiceFactory,
191 ScopeServiceFactory,
192 NotificationServiceProvider,
193 ModalsHandlerProvider,
194 UserService,
195 Cookie2Service,
196 ConfigService,
197 ComponentServiceNg2,
198 ComponentServiceFactoryNg2,
199 ModalService,
200 ImportVSPService,
201 OnboardingService,
vasraza6ae7292021-03-21 20:48:30 +0000202 ElementService,
aribeiro53df9762021-06-16 23:21:04 +0100203 ModelService,
vasraz26e50292021-02-16 17:37:57 +0000204 ServiceServiceNg2,
205 AutomatedUpgradeService,
206 WorkflowServiceNg2,
207 ToscaTypesServiceNg2,
208 WorkspaceNg1BridgeService,
209 HttpHelperService,
210 AuthenticationService,
211 PoliciesService,
212 GroupsService,
213 ModulesService,
214 DynamicComponentService,
215 SdcConfig,
216 SdcMenu,
217 ComponentInstanceServiceNg2,
218 EventListenerService,
219 TranslationServiceConfig,
220 TranslateService,
221 PluginsService,
222 CatalogService,
223 EventBusService,
224 FileUtilsService,
225 {
226 provide: APP_INITIALIZER,
227 useFactory: configServiceFactory,
228 deps: [ConfigService, AuthenticationService, EventListenerService],
229 multi: true
230 },
231 ],
232 bootstrap: [AppComponent]
Michael Landoed64b5e2017-06-09 03:19:04 +0300233})
234
Michael Landoed64b5e2017-06-09 03:19:04 +0300235export class AppModule {
vasraz26e50292021-02-16 17:37:57 +0000236 constructor(public upgrade: UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300237
vasraz26e50292021-02-16 17:37:57 +0000238 }
Michael Landoed64b5e2017-06-09 03:19:04 +0300239}