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 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 21 | import {BrowserModule} from '@angular/platform-browser'; |
| 22 | import {NgModule, APP_INITIALIZER} from '@angular/core'; |
| 23 | import {FormsModule} from '@angular/forms'; |
| 24 | import {forwardRef} from '@angular/core'; |
| 25 | import {AppComponent} from './app.component'; |
| 26 | import {UpgradeAdapter} from '@angular/upgrade'; |
| 27 | import {UpgradeModule} from '@angular/upgrade/static'; |
| 28 | import {PropertiesAssignmentModule} from './pages/properties-assignment/properties-assignment.module'; |
| 29 | import { |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 30 | DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 31 | StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider, ScopeServiceFactory, |
| 32 | NotificationServiceProvider |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 33 | } from "./utils/ng1-upgraded-provider"; |
| 34 | import {ConfigService} from "./services/config.service"; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 35 | import {HttpModule} from '@angular/http'; |
Avi Ziv | f5854fd | 2017-07-31 15:50:46 +0300 | [diff] [blame] | 36 | import {HttpService} from './services/http.service'; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 37 | import {AuthenticationService} from './services/authentication.service'; |
| 38 | import {Cookie2Service} from "./services/cookie.service"; |
| 39 | import {ComponentServiceNg2} from "./services/component-services/component.service"; |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 40 | import {ComponentServiceFactoryNg2} from "./services/component-services/component.service.factory"; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 41 | import {ServiceServiceNg2} from "./services/component-services/service.service"; |
| 42 | import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service"; |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 43 | import {ModalService} from "./services/modal.service"; |
| 44 | import {UiElementsModule} from "./components/ui/ui-elements.module"; |
| 45 | import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module"; |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 46 | import {InterfaceOperationModule} from "./pages/interface-operation/interface-operation.module"; |
| 47 | import {OperationCreatorModule} from "./pages/interface-operation/operation-creator/operation-creator.module"; |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 48 | import {LayoutModule} from "./components/layout/layout.module"; |
| 49 | import {UserService} from "./services/user.service"; |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 50 | import {PoliciesService} from "./services/policies.service"; |
| 51 | import {DynamicComponentService} from "./services/dynamic-component.service"; |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 52 | import {SdcConfig} from "./config/sdc-config.config"; |
| 53 | import { TranslateModule } from "./shared/translator/translate.module"; |
| 54 | import { TranslationServiceConfig } from "./config/translation.service.config"; |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 55 | import {ServicePathCreatorModule} from './pages/service-path-creator/service-path-creator.module'; |
| 56 | import {ServicePathsListModule} from './pages/service-paths-list/service-paths-list.module'; |
Idan Amit | eedaaf9 | 2018-01-31 13:27:33 +0200 | [diff] [blame] | 57 | import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module"; |
| 58 | import {PluginsService} from "./services/plugins.service"; |
Idan Amit | 71904f2 | 2018-02-13 10:38:16 +0200 | [diff] [blame] | 59 | import {EventBusService} from "./services/event-bus.service"; |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 60 | import {ServicePathModule} from 'app/ng2/components/logic/service-path/service-path.module'; |
| 61 | import {ServicePathSelectorModule} from 'app/ng2/components/logic/service-path-selector/service-path-selector.module'; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 62 | |
| 63 | export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); |
| 64 | |
| 65 | export function configServiceFactory(config:ConfigService) { |
Idan Amit | 2c28572 | 2017-12-29 09:40:43 +0200 | [diff] [blame] | 66 | return () => { |
Idan Amit | f1039ca | 2018-05-21 16:09:35 +0300 | [diff] [blame^] | 67 | return Promise.all([ |
| 68 | config.loadValidationConfiguration(), |
| 69 | config.loadPluginsConfiguration() |
| 70 | ]); |
Idan Amit | 2c28572 | 2017-12-29 09:40:43 +0200 | [diff] [blame] | 71 | } |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 72 | } |
| 73 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 74 | |
| 75 | @NgModule({ |
| 76 | declarations: [ |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 77 | AppComponent |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 78 | ], |
| 79 | imports: [ |
| 80 | BrowserModule, |
| 81 | UpgradeModule, |
| 82 | FormsModule, |
| 83 | HttpModule, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 84 | LayoutModule, |
| 85 | TranslateModule, |
| 86 | UiElementsModule, |
| 87 | |
| 88 | //We need to import them here since we use them in angular1 |
| 89 | ConnectionWizardModule, |
Idan Amit | 5197c8b | 2018-01-15 14:31:42 +0200 | [diff] [blame] | 90 | PropertiesAssignmentModule, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 91 | PluginFrameModule, |
Arielk | 802bd2a | 2018-04-16 15:37:39 +0300 | [diff] [blame] | 92 | InterfaceOperationModule, |
| 93 | OperationCreatorModule, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 94 | ServicePathCreatorModule, |
| 95 | ServicePathsListModule, |
| 96 | ServicePathModule, |
| 97 | ServicePathSelectorModule |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 98 | ], |
| 99 | exports: [], |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 100 | entryComponents: [], |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 101 | providers: [ |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 102 | DataTypesServiceProvider, |
| 103 | SharingServiceProvider, |
| 104 | CookieServiceProvider, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 105 | StateServiceFactory, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 106 | StateParamsServiceFactory, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 107 | ScopeServiceFactory, |
Michael Lando | b3d4898 | 2017-06-11 14:22:02 +0300 | [diff] [blame] | 108 | CacheServiceProvider, |
| 109 | EventListenerServiceProvider, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 110 | NotificationServiceProvider, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 111 | AuthenticationService, |
| 112 | Cookie2Service, |
| 113 | ConfigService, |
| 114 | ComponentServiceNg2, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 115 | ComponentServiceFactoryNg2, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 116 | ModalService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 117 | ServiceServiceNg2, |
Avi Ziv | f5854fd | 2017-07-31 15:50:46 +0300 | [diff] [blame] | 118 | HttpService, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 119 | UserService, |
Michael Lando | a544510 | 2018-03-04 14:53:33 +0200 | [diff] [blame] | 120 | PoliciesService, |
| 121 | DynamicComponentService, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 122 | SdcConfig, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 123 | ComponentInstanceServiceNg2, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 124 | TranslationServiceConfig, |
Idan Amit | eedaaf9 | 2018-01-31 13:27:33 +0200 | [diff] [blame] | 125 | PluginsService, |
Idan Amit | 71904f2 | 2018-02-13 10:38:16 +0200 | [diff] [blame] | 126 | EventBusService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 127 | { |
| 128 | provide: APP_INITIALIZER, |
| 129 | useFactory: configServiceFactory, |
| 130 | deps: [ConfigService], |
| 131 | multi: true |
Tal Gitelman | ed7e1c3 | 2017-06-29 19:30:00 +0300 | [diff] [blame] | 132 | }, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 133 | ], |
| 134 | bootstrap: [AppComponent] |
| 135 | }) |
| 136 | |
| 137 | |
| 138 | export class AppModule { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 139 | |
Idan Amit | 71904f2 | 2018-02-13 10:38:16 +0200 | [diff] [blame] | 140 | constructor(public upgrade:UpgradeModule, eventBusService:EventBusService) { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 141 | } |
| 142 | } |