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 | |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 21 | import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; |
| 22 | import {BrowserModule} from '@angular/platform-browser'; |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 23 | import { NgModule, APP_INITIALIZER } from '@angular/core'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 24 | import {FormsModule} from '@angular/forms'; |
Michael Lando | 5b59349 | 2018-07-29 16:13:45 +0300 | [diff] [blame] | 25 | import { forwardRef } from '@angular/core'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 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'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [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'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 36 | import {ConfigService} from './services/config.service'; |
| 37 | import {AuthenticationService} from './services/authentication.service'; |
| 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'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 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'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 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'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [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'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 72 | import {WorkspaceModule} from './pages/workspace/workspace.module'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 73 | import {ModalsModule} from './components/modals/modals.module'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 74 | import { SharingService, CacheService, HomeService } from 'app/services-ng2'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 75 | import {ArtifactConfigService} from "./services/artifact-config.service"; |
| 76 | import {IUserProperties} from 'app/models'; |
| 77 | import {PluginsModule} from './pages/plugins/plugins-module'; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 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'; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 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'; |
KrupaNagabhushan | 6d65fde | 2021-01-12 13:41:59 +0000 | [diff] [blame] | 96 | import { InputListModule } from "./pages/properties-assignment/input-list/input-list.module"; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 97 | import {WorkflowServiceNg2} from './services/workflow.service'; |
| 98 | import {ToscaTypesServiceNg2} from "./services/tosca-types.service"; |
aribeiro | 1ae28c3 | 2020-10-05 10:45:11 +0100 | [diff] [blame] | 99 | import {CapabilitiesFilterPropertiesEditorComponentModule} from "./pages/composition/capabilities-filter-properties-editor/capabilities-filter-properties-editor.module"; |
aribeiro | 5c1f575 | 2020-11-19 13:28:43 +0000 | [diff] [blame] | 100 | import {InterfaceOperationHandlerModule} from "./pages/composition/interface-operatons/operation-creator/interface-operation-handler.module"; |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 101 | import {AttributesOutputsModule} from "./pages/attributes-outputs/attributes-outputs.module"; |
vasraz | a6ae729 | 2021-03-21 20:48:30 +0000 | [diff] [blame] | 102 | import { ElementService } from "./services/element.service"; |
aribeiro | 53df976 | 2021-06-16 23:21:04 +0100 | [diff] [blame] | 103 | import { ModelService } from "./services/model.service"; |
aribeiro | 1de1692 | 2021-10-01 11:30:49 +0100 | [diff] [blame] | 104 | import {ToscaArtifactService} from "./services/tosca-artifact.service"; |
aribeiro | c2fa1b7 | 2022-01-13 14:33:25 +0000 | [diff] [blame] | 105 | import {InterfaceDefinitionModule} from "./pages/interface-definition/interface-definition.module"; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 106 | |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 107 | declare const __ENV__: string; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 108 | |
| 109 | export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); |
| 110 | |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 111 | export function configServiceFactory(config: ConfigService, authService: AuthenticationService, eventListener: EventListenerService) { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 112 | |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 113 | return () => { |
| 114 | return authService.authenticate().toPromise() |
| 115 | .then((userInfo: IUserProperties) => { |
| 116 | authService.setLoggedinUser(userInfo); |
| 117 | return Promise.all([ |
| 118 | config.loadSdcSetupData(), |
| 119 | config.loadValidationConfiguration(), |
| 120 | config.loadPluginsConfiguration(), |
| 121 | ]) |
| 122 | }).then(() => { |
| 123 | eventListener.notifyObservers('ON_FINISH_LOADING'); |
| 124 | }) |
| 125 | .catch(() => { |
| 126 | console.log('AUTH FAILED! from app module'); |
| 127 | }); |
| 128 | }; |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 129 | } |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 130 | |
| 131 | @NgModule({ |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 132 | declarations: [ |
| 133 | AppComponent |
| 134 | ], |
| 135 | imports: [ |
| 136 | BrowserAnimationsModule, |
| 137 | BrowserModule, |
| 138 | UpgradeModule, |
| 139 | FormsModule, |
| 140 | HttpClientModule, |
| 141 | LayoutModule, |
| 142 | TranslateModule, |
| 143 | MultilineEllipsisModule, |
| 144 | UiElementsModule, |
| 145 | CompositionPanelModule, |
| 146 | SdcUiComponentsModule, |
| 147 | AutomatedUpgradeModule, |
ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 148 | |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 149 | // We need to import them here since we use them in angular1 |
| 150 | ConnectionWizardModule, |
| 151 | PropertiesAssignmentModule, |
| 152 | AttributesOutputsModule, |
| 153 | PropertyCreatorModule, |
| 154 | DeclareListModule, |
KrupaNagabhushan | 6d65fde | 2021-01-12 13:41:59 +0000 | [diff] [blame] | 155 | InputListModule, |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 156 | PluginFrameModule, |
| 157 | PluginsModule, |
| 158 | InterfaceOperationModule, |
aribeiro | c2fa1b7 | 2022-01-13 14:33:25 +0000 | [diff] [blame] | 159 | InterfaceDefinitionModule, |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 160 | OperationCreatorModule, |
aribeiro | c2fa1b7 | 2022-01-13 14:33:25 +0000 | [diff] [blame] | 161 | InterfaceOperationHandlerModule, |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 162 | ServicePathCreatorModule, |
| 163 | ServicePathsListModule, |
| 164 | ServicePathSelectorModule, |
| 165 | ServiceConsumptionCreatorModule, |
| 166 | ServiceDependenciesModule, |
| 167 | ServiceDependenciesEditorModule, |
| 168 | CapabilitiesFilterPropertiesEditorComponentModule, |
| 169 | WorkspaceModule, |
| 170 | ModalsModule, |
| 171 | CatalogModule, |
| 172 | HomeModule, |
| 173 | NgxsModule.forRoot([]), |
| 174 | NgxsLoggerPluginModule.forRoot({logger: console, collapsed: false}), |
| 175 | NgxsReduxDevtoolsPluginModule.forRoot({ |
| 176 | disabled: __ENV__ === 'prod' |
| 177 | }) |
| 178 | ], |
| 179 | exports: [], |
| 180 | entryComponents: [], |
| 181 | providers: [ |
| 182 | WindowRef, |
| 183 | httpInterceptorProviders, |
| 184 | DataTypesServiceProvider, |
| 185 | SharingService, |
| 186 | CacheService, |
| 187 | HomeService, |
| 188 | ArtifactConfigService, |
| 189 | ComponentFactoryProvider, |
| 190 | CookieServiceProvider, |
| 191 | StateServiceFactory, |
| 192 | StateParamsServiceFactory, |
| 193 | ScopeServiceFactory, |
| 194 | NotificationServiceProvider, |
| 195 | ModalsHandlerProvider, |
| 196 | UserService, |
| 197 | Cookie2Service, |
| 198 | ConfigService, |
| 199 | ComponentServiceNg2, |
| 200 | ComponentServiceFactoryNg2, |
| 201 | ModalService, |
| 202 | ImportVSPService, |
| 203 | OnboardingService, |
vasraz | a6ae729 | 2021-03-21 20:48:30 +0000 | [diff] [blame] | 204 | ElementService, |
aribeiro | 53df976 | 2021-06-16 23:21:04 +0100 | [diff] [blame] | 205 | ModelService, |
aribeiro | 1de1692 | 2021-10-01 11:30:49 +0100 | [diff] [blame] | 206 | ToscaArtifactService, |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 207 | ServiceServiceNg2, |
| 208 | AutomatedUpgradeService, |
| 209 | WorkflowServiceNg2, |
| 210 | ToscaTypesServiceNg2, |
| 211 | WorkspaceNg1BridgeService, |
| 212 | HttpHelperService, |
| 213 | AuthenticationService, |
| 214 | PoliciesService, |
| 215 | GroupsService, |
| 216 | ModulesService, |
| 217 | DynamicComponentService, |
| 218 | SdcConfig, |
| 219 | SdcMenu, |
| 220 | ComponentInstanceServiceNg2, |
| 221 | EventListenerService, |
| 222 | TranslationServiceConfig, |
| 223 | TranslateService, |
| 224 | PluginsService, |
| 225 | CatalogService, |
| 226 | EventBusService, |
| 227 | FileUtilsService, |
| 228 | { |
| 229 | provide: APP_INITIALIZER, |
| 230 | useFactory: configServiceFactory, |
| 231 | deps: [ConfigService, AuthenticationService, EventListenerService], |
| 232 | multi: true |
| 233 | }, |
| 234 | ], |
| 235 | bootstrap: [AppComponent] |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 236 | }) |
| 237 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 238 | export class AppModule { |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 239 | constructor(public upgrade: UpgradeModule) { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 240 | |
vasraz | 26e5029 | 2021-02-16 17:37:57 +0000 | [diff] [blame] | 241 | } |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 242 | } |