blob: 707e328a52bb7d0b39f8a54df9a335c2d8afff77 [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';
vasraz4aff8f52022-03-24 18:31:14 +000048import {OperationCreatorInterfaceDefinitionModule} from './pages/interface-definition/operation-creator/operation-creator-interface-definition.module';
vasraz26e50292021-02-16 17:37:57 +000049import {LayoutModule} from './components/layout/layout.module';
50import {UserService} from './services/user.service';
51import {DynamicComponentService} from './services/dynamic-component.service';
52import {SdcConfig} from './config/sdc-config.config';
53import {SdcMenu} from './config/sdc-menu.config';
54import {TranslateModule} from './shared/translator/translate.module';
55import {TranslationServiceConfig} from './config/translation.service.config';
56import {MultilineEllipsisModule} from './shared/multiline-ellipsis/multiline-ellipsis.module';
57import {ServicePathCreatorModule} from './pages/composition/graph/service-path-creator/service-path-creator.module';
58import {ServicePathsListModule} from './pages/composition/graph/service-paths-list/service-paths-list.module';
ys969316a9fce2020-01-19 13:50:02 +020059import { ServicePathSelectorModule } from 'app/ng2/pages/composition/graph/service-path-selector/service-path-selector.module';
60import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/composition-panel.module';
vasraz26e50292021-02-16 17:37:57 +000061import {CatalogModule} from './pages/catalog/catalog.module';
62import {HomeModule} from './pages/home/home.module';
63import {WindowRef} from './services/window.service';
64import {CatalogService} from './services/catalog.service';
Michael Lando5b593492018-07-29 16:13:45 +030065import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider';
vasraz26e50292021-02-16 17:37:57 +000066import {PluginFrameModule} from './components/ui/plugin/plugin-frame.module';
67import {PluginsService} from './services/plugins.service';
68import {EventBusService} from './services/event-bus.service';
69import {GroupsService} from './services/groups.service';
70import {PoliciesService} from './services/policies.service';
71import {AutomatedUpgradeService} from './pages/automated-upgrade/automated-upgrade.service';
72import {AutomatedUpgradeModule} from './pages/automated-upgrade/automated-upgrade.module';
ys969316a9fce2020-01-19 13:50:02 +020073import {WorkspaceModule} from './pages/workspace/workspace.module';
vasraz26e50292021-02-16 17:37:57 +000074import {ModalsModule} from './components/modals/modals.module';
ys969316a9fce2020-01-19 13:50:02 +020075import { SharingService, CacheService, HomeService } from 'app/services-ng2';
vasraz26e50292021-02-16 17:37:57 +000076import {ArtifactConfigService} from "./services/artifact-config.service";
77import {IUserProperties} from 'app/models';
78import {PluginsModule} from './pages/plugins/plugins-module';
ys969316a9fce2020-01-19 13:50:02 +020079import {WorkspaceNg1BridgeService} from './pages/workspace/workspace-ng1-bridge-service';
80import {NgxsModule} from '@ngxs/store';
81import {NgxsLoggerPluginModule} from '@ngxs/logger-plugin';
82import {NgxsReduxDevtoolsPluginModule} from '@ngxs/devtools-plugin';
83import {EventListenerService} from '../services/event-listener-service';
vasraz26e50292021-02-16 17:37:57 +000084import {HttpClientModule} from '@angular/common/http';
85import {httpInterceptorProviders} from './http-interceptor';
86import {HttpHelperService} from './services/http-hepler.service';
87import {ModulesService} from "./services/modules.service";
88import {TranslateService} from 'app/ng2/shared/translator/translate.service';
89import {FileUtilsService} from './services/file-utils.service';
90import {ImportVSPService} from './components/modals/onboarding-modal/import-vsp.service';
91import {OnboardingService} from './services/onboarding.service';
92import {ServiceConsumptionCreatorModule} from './pages/service-consumption-editor/service-consumption-editor.module';
93import {ServiceDependenciesModule} from './components/logic/service-dependencies/service-dependencies.module';
94import {ServiceDependenciesEditorModule} from './pages/service-dependencies-editor/service-dependencies-editor.module';
95import {PropertyCreatorModule} from './pages/properties-assignment/property-creator/property-creator.module';
96import {DeclareListModule} from './pages/properties-assignment/declare-list/declare-list.module';
KrupaNagabhushanca309162022-05-09 20:03:56 +010097import { ToscaFunctionModule } from "./pages/properties-assignment/tosca-function/tosca-function.module";
vasraz26e50292021-02-16 17:37:57 +000098import {WorkflowServiceNg2} from './services/workflow.service';
99import {ToscaTypesServiceNg2} from "./services/tosca-types.service";
aribeiro1ae28c32020-10-05 10:45:11 +0100100import {CapabilitiesFilterPropertiesEditorComponentModule} from "./pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.module";
aribeiro5c1f5752020-11-19 13:28:43 +0000101import {InterfaceOperationHandlerModule} from "./pages/composition/interface-operatons/operation-creator/interface-operation-handler.module";
vasraz26e50292021-02-16 17:37:57 +0000102import {AttributesOutputsModule} from "./pages/attributes-outputs/attributes-outputs.module";
vasraza6ae7292021-03-21 20:48:30 +0000103import { ElementService } from "./services/element.service";
aribeiro53df9762021-06-16 23:21:04 +0100104import { ModelService } from "./services/model.service";
aribeiro1de16922021-10-01 11:30:49 +0100105import {ToscaArtifactService} from "./services/tosca-artifact.service";
aribeiroc2fa1b72022-01-13 14:33:25 +0000106import {InterfaceDefinitionModule} from "./pages/interface-definition/interface-definition.module";
ys969316a9fce2020-01-19 13:50:02 +0200107
ys969316a9fce2020-01-19 13:50:02 +0200108declare const __ENV__: string;
Michael Landoed64b5e2017-06-09 03:19:04 +0300109
110export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
111
ys969316a9fce2020-01-19 13:50:02 +0200112export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300113
vasraz26e50292021-02-16 17:37:57 +0000114 return () => {
115 return authService.authenticate().toPromise()
116 .then((userInfo: IUserProperties) => {
117 authService.setLoggedinUser(userInfo);
118 return Promise.all([
119 config.loadSdcSetupData(),
120 config.loadValidationConfiguration(),
121 config.loadPluginsConfiguration(),
122 ])
123 }).then(() => {
124 eventListener.notifyObservers('ON_FINISH_LOADING');
125 })
126 .catch(() => {
127 console.log('AUTH FAILED! from app module');
128 });
129 };
ys969316a9fce2020-01-19 13:50:02 +0200130}
Michael Landoed64b5e2017-06-09 03:19:04 +0300131
132@NgModule({
vasraz26e50292021-02-16 17:37:57 +0000133 declarations: [
134 AppComponent
135 ],
136 imports: [
137 BrowserAnimationsModule,
138 BrowserModule,
139 UpgradeModule,
140 FormsModule,
141 HttpClientModule,
142 LayoutModule,
143 TranslateModule,
144 MultilineEllipsisModule,
145 UiElementsModule,
146 CompositionPanelModule,
147 SdcUiComponentsModule,
148 AutomatedUpgradeModule,
ys969316a9fce2020-01-19 13:50:02 +0200149
vasraz26e50292021-02-16 17:37:57 +0000150 // We need to import them here since we use them in angular1
151 ConnectionWizardModule,
152 PropertiesAssignmentModule,
153 AttributesOutputsModule,
154 PropertyCreatorModule,
155 DeclareListModule,
KrupaNagabhushanca309162022-05-09 20:03:56 +0100156 ToscaFunctionModule,
vasraz26e50292021-02-16 17:37:57 +0000157 PluginFrameModule,
158 PluginsModule,
159 InterfaceOperationModule,
aribeiroc2fa1b72022-01-13 14:33:25 +0000160 InterfaceDefinitionModule,
vasraz26e50292021-02-16 17:37:57 +0000161 OperationCreatorModule,
vasraz4aff8f52022-03-24 18:31:14 +0000162 OperationCreatorInterfaceDefinitionModule,
aribeiroc2fa1b72022-01-13 14:33:25 +0000163 InterfaceOperationHandlerModule,
vasraz26e50292021-02-16 17:37:57 +0000164 ServicePathCreatorModule,
165 ServicePathsListModule,
166 ServicePathSelectorModule,
167 ServiceConsumptionCreatorModule,
168 ServiceDependenciesModule,
169 ServiceDependenciesEditorModule,
170 CapabilitiesFilterPropertiesEditorComponentModule,
171 WorkspaceModule,
172 ModalsModule,
173 CatalogModule,
174 HomeModule,
175 NgxsModule.forRoot([]),
176 NgxsLoggerPluginModule.forRoot({logger: console, collapsed: false}),
177 NgxsReduxDevtoolsPluginModule.forRoot({
178 disabled: __ENV__ === 'prod'
179 })
180 ],
181 exports: [],
182 entryComponents: [],
183 providers: [
184 WindowRef,
185 httpInterceptorProviders,
186 DataTypesServiceProvider,
187 SharingService,
188 CacheService,
189 HomeService,
190 ArtifactConfigService,
191 ComponentFactoryProvider,
192 CookieServiceProvider,
193 StateServiceFactory,
194 StateParamsServiceFactory,
195 ScopeServiceFactory,
196 NotificationServiceProvider,
197 ModalsHandlerProvider,
198 UserService,
199 Cookie2Service,
200 ConfigService,
201 ComponentServiceNg2,
202 ComponentServiceFactoryNg2,
203 ModalService,
204 ImportVSPService,
205 OnboardingService,
vasraza6ae7292021-03-21 20:48:30 +0000206 ElementService,
aribeiro53df9762021-06-16 23:21:04 +0100207 ModelService,
aribeiro1de16922021-10-01 11:30:49 +0100208 ToscaArtifactService,
vasraz26e50292021-02-16 17:37:57 +0000209 ServiceServiceNg2,
210 AutomatedUpgradeService,
211 WorkflowServiceNg2,
212 ToscaTypesServiceNg2,
213 WorkspaceNg1BridgeService,
214 HttpHelperService,
215 AuthenticationService,
216 PoliciesService,
217 GroupsService,
218 ModulesService,
219 DynamicComponentService,
220 SdcConfig,
221 SdcMenu,
222 ComponentInstanceServiceNg2,
223 EventListenerService,
224 TranslationServiceConfig,
225 TranslateService,
226 PluginsService,
227 CatalogService,
228 EventBusService,
229 FileUtilsService,
230 {
231 provide: APP_INITIALIZER,
232 useFactory: configServiceFactory,
233 deps: [ConfigService, AuthenticationService, EventListenerService],
234 multi: true
235 },
236 ],
237 bootstrap: [AppComponent]
Michael Landoed64b5e2017-06-09 03:19:04 +0300238})
239
Michael Landoed64b5e2017-06-09 03:19:04 +0300240export class AppModule {
vasraz26e50292021-02-16 17:37:57 +0000241 constructor(public upgrade: UpgradeModule) {
Michael Landoed64b5e2017-06-09 03:19:04 +0300242
vasraz26e50292021-02-16 17:37:57 +0000243 }
Michael Landoed64b5e2017-06-09 03:19:04 +0300244}