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 | b3d4898 | 2017-06-11 14:22:02 +0300 | [diff] [blame] | 31 | StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 32 | } from "./utils/ng1-upgraded-provider"; |
| 33 | import {ConfigService} from "./services/config.service"; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 34 | import {HttpModule} from '@angular/http'; |
Avi Ziv | f5854fd | 2017-07-31 15:50:46 +0300 | [diff] [blame] | 35 | import {HttpService} from './services/http.service'; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 36 | import {AuthenticationService} from './services/authentication.service'; |
| 37 | import {Cookie2Service} from "./services/cookie.service"; |
| 38 | import {ComponentServiceNg2} from "./services/component-services/component.service"; |
| 39 | import {ServiceServiceNg2} from "./services/component-services/service.service"; |
| 40 | import {ComponentInstanceServiceNg2} from "./services/component-instance-services/component-instance.service"; |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 41 | import {ModalService} from "./services/modal.service"; |
| 42 | import {UiElementsModule} from "./components/ui/ui-elements.module"; |
| 43 | import {ConnectionWizardModule} from "./pages/connection-wizard/connection-wizard.module"; |
| 44 | import {LayoutModule} from "./components/layout/layout.module"; |
| 45 | import {UserService} from "./services/user.service"; |
| 46 | import {SdcConfig} from "./config/sdc-config.config"; |
| 47 | import { TranslateModule } from "./shared/translator/translate.module"; |
| 48 | import { TranslationServiceConfig } from "./config/translation.service.config"; |
Idan Amit | 5197c8b | 2018-01-15 14:31:42 +0200 | [diff] [blame] | 49 | import {DesignerFrameModule} from "./components/ui/designer/designer-frame.module"; |
Idan Amit | ae4ab93 | 2018-01-23 15:53:11 +0200 | [diff] [blame^] | 50 | import {DesignersService} from "./services/designers.service"; |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 51 | |
| 52 | export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); |
| 53 | |
| 54 | export function configServiceFactory(config:ConfigService) { |
Idan Amit | 2c28572 | 2017-12-29 09:40:43 +0200 | [diff] [blame] | 55 | return () => { |
| 56 | config.loadValidationConfiguration(); |
| 57 | config.loadDesignersConfiguration(); |
| 58 | } |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 59 | } |
| 60 | |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 61 | |
| 62 | @NgModule({ |
| 63 | declarations: [ |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 64 | AppComponent |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 65 | ], |
| 66 | imports: [ |
| 67 | BrowserModule, |
| 68 | UpgradeModule, |
| 69 | FormsModule, |
| 70 | HttpModule, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 71 | LayoutModule, |
| 72 | TranslateModule, |
| 73 | UiElementsModule, |
| 74 | |
| 75 | //We need to import them here since we use them in angular1 |
| 76 | ConnectionWizardModule, |
Idan Amit | 5197c8b | 2018-01-15 14:31:42 +0200 | [diff] [blame] | 77 | PropertiesAssignmentModule, |
| 78 | DesignerFrameModule |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 79 | ], |
| 80 | exports: [], |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 81 | entryComponents: [], |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 82 | providers: [ |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 83 | DataTypesServiceProvider, |
| 84 | SharingServiceProvider, |
| 85 | CookieServiceProvider, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 86 | StateServiceFactory, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 87 | StateParamsServiceFactory, |
Michael Lando | b3d4898 | 2017-06-11 14:22:02 +0300 | [diff] [blame] | 88 | CacheServiceProvider, |
| 89 | EventListenerServiceProvider, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 90 | AuthenticationService, |
| 91 | Cookie2Service, |
| 92 | ConfigService, |
| 93 | ComponentServiceNg2, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 94 | ModalService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 95 | ServiceServiceNg2, |
Avi Ziv | f5854fd | 2017-07-31 15:50:46 +0300 | [diff] [blame] | 96 | HttpService, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 97 | UserService, |
| 98 | SdcConfig, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 99 | ComponentInstanceServiceNg2, |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 100 | TranslationServiceConfig, |
Idan Amit | ae4ab93 | 2018-01-23 15:53:11 +0200 | [diff] [blame^] | 101 | DesignersService, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 102 | { |
| 103 | provide: APP_INITIALIZER, |
| 104 | useFactory: configServiceFactory, |
| 105 | deps: [ConfigService], |
| 106 | multi: true |
Tal Gitelman | ed7e1c3 | 2017-06-29 19:30:00 +0300 | [diff] [blame] | 107 | }, |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 108 | ], |
| 109 | bootstrap: [AppComponent] |
| 110 | }) |
| 111 | |
| 112 | |
| 113 | export class AppModule { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 114 | |
Tal Gitelman | 51d50f0 | 2017-12-10 18:55:03 +0200 | [diff] [blame] | 115 | constructor(public upgrade:UpgradeModule) { |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 116 | |
| 117 | } |
| 118 | } |