Change designer to plugin in code
[sdc.git] / catalog-ui / src / app / ng2 / app.module.ts
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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
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 {
30     DataTypesServiceProvider, SharingServiceProvider, CookieServiceProvider, StateServiceFactory,
31     StateParamsServiceFactory, CacheServiceProvider, EventListenerServiceProvider
32 } from "./utils/ng1-upgraded-provider";
33 import {ConfigService} from "./services/config.service";
34 import {HttpModule} from '@angular/http';
35 import {HttpService} from './services/http.service';
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";
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";
49 import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module";
50 import {PluginsService} from "./services/plugins.service";
51
52 export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
53
54 export function configServiceFactory(config:ConfigService) {
55     return () => {
56         config.loadValidationConfiguration();
57         config.loadPluginsConfiguration();
58     }
59 }
60
61
62 @NgModule({
63     declarations: [
64         AppComponent
65     ],
66     imports: [
67         BrowserModule,
68         UpgradeModule,
69         FormsModule,
70         HttpModule,
71         LayoutModule,
72         TranslateModule,
73         UiElementsModule,
74
75         //We need to import them here since we use them in angular1
76         ConnectionWizardModule,
77         PropertiesAssignmentModule,
78         PluginFrameModule
79     ],
80     exports: [],
81     entryComponents: [],
82     providers: [
83         DataTypesServiceProvider,
84         SharingServiceProvider,
85         CookieServiceProvider,
86         StateServiceFactory,
87         StateParamsServiceFactory,
88         CacheServiceProvider,
89         EventListenerServiceProvider,
90         AuthenticationService,
91         Cookie2Service,
92         ConfigService,
93         ComponentServiceNg2,
94         ModalService,
95         ServiceServiceNg2,
96         HttpService,
97         UserService,
98         SdcConfig,
99         ComponentInstanceServiceNg2,
100         TranslationServiceConfig,
101         PluginsService,
102         {
103             provide: APP_INITIALIZER,
104             useFactory: configServiceFactory,
105             deps: [ConfigService],
106             multi: true
107         },
108      ],
109     bootstrap: [AppComponent]
110 })
111
112
113 export class AppModule {
114
115     constructor(public upgrade:UpgradeModule) {
116
117     }
118 }