Michael Lando | dd60339 | 2017-07-12 00:54:52 +0300 | [diff] [blame] | 1 | /*- |
| 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 Amit | 2c28572 | 2017-12-29 09:40:43 +0200 | [diff] [blame] | 10 | * |
Michael Lando | dd60339 | 2017-07-12 00:54:52 +0300 | [diff] [blame] | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
Idan Amit | 2c28572 | 2017-12-29 09:40:43 +0200 | [diff] [blame] | 12 | * |
Michael Lando | dd60339 | 2017-07-12 00:54:52 +0300 | [diff] [blame] | 13 | * 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 | |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 21 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 22 | import { BrowserModule } from '@angular/platform-browser'; |
| 23 | import { NgModule, APP_INITIALIZER } from '@angular/core'; |
| 24 | import { FormsModule } from '@angular/forms'; |
| 25 | import { forwardRef } from '@angular/core'; |
| 26 | import { AppComponent } from './app.component'; |
| 27 | import { UpgradeAdapter } from '@angular/upgrade'; |
| 28 | import { UpgradeModule } from '@angular/upgrade/static'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 29 | import { SdcUiComponentsModule, SdcUiComponents } from 'onap-ui-angular'; |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 30 | import { PropertiesAssignmentModule } from './pages/properties-assignment/properties-assignment.module'; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 31 | import { |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 32 | DataTypesServiceProvider, CookieServiceProvider, StateServiceFactory, |
| 33 | StateParamsServiceFactory, ScopeServiceFactory, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 34 | NotificationServiceProvider, ComponentFactoryProvider |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 35 | } from './utils/ng1-upgraded-provider'; |
| 36 | import { ConfigService } from './services/config.service'; |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 37 | import { AuthenticationService } from './services/authentication.service'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 38 | import { Cookie2Service } from './services/cookie.service'; |
| 39 | import { ComponentServiceNg2 } from './services/component-services/component.service'; |
| 40 | import { ComponentServiceFactoryNg2 } from './services/component-services/component.service.factory'; |
| 41 | import { ServiceServiceNg2 } from './services/component-services/service.service'; |
| 42 | import { ComponentInstanceServiceNg2 } from './services/component-instance-services/component-instance.service'; |
| 43 | import { ModalService } from './services/modal.service'; |
| 44 | import { UiElementsModule } from './components/ui/ui-elements.module'; |
| 45 | import { ConnectionWizardModule } from './pages/composition/graph/connection-wizard/connection-wizard.module'; |
| 46 | import { InterfaceOperationModule } from './pages/interface-operation/interface-operation.module'; |
| 47 | import { OperationCreatorModule } from './pages/interface-operation/operation-creator/operation-creator.module'; |
| 48 | import { LayoutModule } from './components/layout/layout.module'; |
| 49 | import { UserService } from './services/user.service'; |
| 50 | import { DynamicComponentService } from './services/dynamic-component.service'; |
| 51 | import { SdcConfig } from './config/sdc-config.config'; |
| 52 | import { SdcMenu } from './config/sdc-menu.config'; |
| 53 | import { TranslateModule } from './shared/translator/translate.module'; |
| 54 | import { TranslationServiceConfig } from './config/translation.service.config'; |
| 55 | import { MultilineEllipsisModule } from './shared/multiline-ellipsis/multiline-ellipsis.module'; |
| 56 | import { ServicePathCreatorModule } from './pages/composition/graph/service-path-creator/service-path-creator.module'; |
| 57 | import { ServicePathsListModule } from './pages/composition/graph/service-paths-list/service-paths-list.module'; |
| 58 | import { ServicePathSelectorModule } from 'app/ng2/pages/composition/graph/service-path-selector/service-path-selector.module'; |
| 59 | import { CompositionPanelModule } from 'app/ng2/pages/composition/panel/composition-panel.module'; |
| 60 | import { CatalogModule } from './pages/catalog/catalog.module'; |
| 61 | import { HomeModule } from './pages/home/home.module'; |
| 62 | import { WindowRef } from './services/window.service'; |
| 63 | import { CatalogService } from './services/catalog.service'; |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 64 | import { ModalsHandlerProvider } from './utils/ng1-upgraded-provider'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 65 | import { PluginFrameModule } from './components/ui/plugin/plugin-frame.module'; |
| 66 | import { PluginsService } from './services/plugins.service'; |
| 67 | import { EventBusService } from './services/event-bus.service'; |
| 68 | import { GroupsService } from './services/groups.service'; |
| 69 | import { PoliciesService } from './services/policies.service'; |
| 70 | import { AutomatedUpgradeService } from './pages/automated-upgrade/automated-upgrade.service'; |
| 71 | import { AutomatedUpgradeModule } from './pages/automated-upgrade/automated-upgrade.module'; |
| 72 | import {WorkspaceModule} from './pages/workspace/workspace.module'; |
| 73 | import { ModalsModule } from './components/modals/modals.module'; |
| 74 | import { SharingService, CacheService, HomeService } from 'app/services-ng2'; |
andre.schmid | cd6f933 | 2020-01-29 17:25:21 +0000 | [diff] [blame] | 75 | import { ArtifactConfigService } from "./services/artifact-config.service"; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 76 | import { IUserProperties } from 'app/models'; |
| 77 | import { PluginsModule } from './pages/plugins/plugins-module'; |
| 78 | import {WorkspaceNg1BridgeService} from './pages/workspace/workspace-ng1-bridge-service'; |
| 79 | import {NgxsModule} from '@ngxs/store'; |
| 80 | import {NgxsLoggerPluginModule} from '@ngxs/logger-plugin'; |
| 81 | import {NgxsReduxDevtoolsPluginModule} from '@ngxs/devtools-plugin'; |
| 82 | import {EventListenerService} from '../services/event-listener-service'; |
| 83 | import { HttpClientModule } from '@angular/common/http'; |
| 84 | import { httpInterceptorProviders } from './http-interceptor'; |
| 85 | import { HttpHelperService } from './services/http-hepler.service'; |
| 86 | import { ModulesService } from "./services/modules.service"; |
| 87 | import { TranslateService } from 'app/ng2/shared/translator/translate.service'; |
| 88 | import { FileUtilsService } from './services/file-utils.service'; |
| 89 | import { ImportVSPService } from './components/modals/onboarding-modal/import-vsp.service'; |
| 90 | import { OnboardingService } from './services/onboarding.service'; |
| 91 | import { ServiceConsumptionCreatorModule } from './pages/service-consumption-editor/service-consumption-editor.module'; |
| 92 | import { ServiceDependenciesModule } from './components/logic/service-dependencies/service-dependencies.module'; |
| 93 | import { ServiceDependenciesEditorModule } from './pages/service-dependencies-editor/service-dependencies-editor.module'; |
| 94 | import { PropertyCreatorModule } from './pages/properties-assignment/property-creator/property-creator.module'; |
| 95 | import { DeclareListModule } from './pages/properties-assignment/declare-list/declare-list.module'; |
| 96 | import { WorkflowServiceNg2 } from './services/workflow.service'; |
| 97 | import { ToscaTypesServiceNg2 } from "./services/tosca-types.service"; |
aribeiro | 1ae28c3 | 2020-10-05 10:45:11 +0100 | [diff] [blame] | 98 | import {CapabilitiesFilterPropertiesEditorComponentModule} from "./pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.module"; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 99 | |
| 100 | |
| 101 | declare const __ENV__: string; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 102 | |
| 103 | export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); |
| 104 | |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 105 | export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 106 | |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 107 | 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 Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 124 | |
| 125 | @NgModule({ |
| 126 | declarations: [ |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 127 | AppComponent |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 128 | ], |
| 129 | imports: [ |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 130 | BrowserAnimationsModule, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 131 | BrowserModule, |
| 132 | UpgradeModule, |
| 133 | FormsModule, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 134 | HttpClientModule, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 135 | LayoutModule, |
| 136 | TranslateModule, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 137 | MultilineEllipsisModule, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 138 | UiElementsModule, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 139 | CompositionPanelModule, |
| 140 | SdcUiComponentsModule, |
| 141 | AutomatedUpgradeModule, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 142 | |
| 143 | // We need to import them here since we use them in angular1 |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 144 | ConnectionWizardModule, |
Idan Amit | 5197c8b | 2018-01-15 14:31:42 +0200 | [diff] [blame] | 145 | PropertiesAssignmentModule, |
Talio | 0953785 | 2019-01-31 18:00:36 +0200 | [diff] [blame] | 146 | PropertyCreatorModule, |
Toshimichi Fukuda | 51411ac | 2019-04-18 21:38:46 +0900 | [diff] [blame] | 147 | DeclareListModule, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 148 | PluginFrameModule, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 149 | PluginsModule, |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 150 | InterfaceOperationModule, |
| 151 | OperationCreatorModule, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 152 | ServicePathCreatorModule, |
| 153 | ServicePathsListModule, |
miriame | c2ce914 | 2019-02-13 15:17:26 +0200 | [diff] [blame] | 154 | ServicePathSelectorModule, |
ojasdubey | 4192e3c | 2019-03-18 14:15:03 +0530 | [diff] [blame] | 155 | ServiceConsumptionCreatorModule, |
miriame | c2ce914 | 2019-02-13 15:17:26 +0200 | [diff] [blame] | 156 | ServiceDependenciesModule, |
miriame | 41ee9cb | 2019-03-04 13:49:15 +0200 | [diff] [blame] | 157 | ServiceDependenciesEditorModule, |
aribeiro | 1ae28c3 | 2020-10-05 10:45:11 +0100 | [diff] [blame] | 158 | CapabilitiesFilterPropertiesEditorComponentModule, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 159 | 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 Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 168 | ], |
| 169 | exports: [], |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 170 | entryComponents: [ |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 171 | ], |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 172 | providers: [ |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 173 | WindowRef, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 174 | httpInterceptorProviders, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 175 | DataTypesServiceProvider, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 176 | SharingService, |
| 177 | CacheService, |
| 178 | HomeService, |
andre.schmid | cd6f933 | 2020-01-29 17:25:21 +0000 | [diff] [blame] | 179 | ArtifactConfigService, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 180 | ComponentFactoryProvider, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 181 | CookieServiceProvider, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 182 | StateServiceFactory, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 183 | StateParamsServiceFactory, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 184 | ScopeServiceFactory, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 185 | NotificationServiceProvider, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 186 | ModalsHandlerProvider, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 187 | UserService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 188 | Cookie2Service, |
| 189 | ConfigService, |
| 190 | ComponentServiceNg2, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 191 | ComponentServiceFactoryNg2, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 192 | ModalService, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 193 | ImportVSPService, |
| 194 | OnboardingService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 195 | ServiceServiceNg2, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 196 | AutomatedUpgradeService, |
Arielk | eaaf801 | 2018-07-31 12:59:36 +0300 | [diff] [blame] | 197 | WorkflowServiceNg2, |
miriame | 41ee9cb | 2019-03-04 13:49:15 +0200 | [diff] [blame] | 198 | ToscaTypesServiceNg2, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 199 | WorkspaceNg1BridgeService, |
| 200 | HttpHelperService, |
| 201 | AuthenticationService, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 202 | PoliciesService, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 203 | GroupsService, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 204 | ModulesService, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 205 | DynamicComponentService, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 206 | SdcConfig, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 207 | SdcMenu, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 208 | ComponentInstanceServiceNg2, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 209 | EventListenerService, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 210 | TranslationServiceConfig, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 211 | TranslateService, |
Idan Amit | eedaaf9 | 2018-01-31 13:27:33 +0200 | [diff] [blame] | 212 | PluginsService, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 213 | CatalogService, |
Idan Amit | 71904f2 | 2018-02-13 10:38:16 +0200 | [diff] [blame] | 214 | EventBusService, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 215 | FileUtilsService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 216 | { |
| 217 | provide: APP_INITIALIZER, |
| 218 | useFactory: configServiceFactory, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 219 | deps: [ConfigService, AuthenticationService, EventListenerService], |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 220 | multi: true |
Tal Gitelman | ed7e1c3 | 2017-06-29 19:30:00 +0300 | [diff] [blame] | 221 | }, |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 222 | ], |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 223 | bootstrap: [AppComponent] |
| 224 | }) |
| 225 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 226 | export class AppModule { |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 227 | constructor(public upgrade: UpgradeModule) { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 228 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 229 | } |
| 230 | } |