b7163da327d2d012f32d0b3b0ded79995996abcc
[portal.git] / portal-FE-os / src / app / pages / pages.module.ts
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  *
37  */
38 import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
39 import { CommonModule } from '@angular/common';
40 import { ReactiveFormsModule, FormsModule } from '@angular/forms';
41 import { MatIconModule } from '@angular/material/icon';
42 import { MatCheckboxModule } from '@angular/material/checkbox';
43
44 import { AdminsComponent } from './admins/admins.component';
45 import { ApplicationCatalogComponent } from './application-catalog/application-catalog.component';
46 import { ApplicationOnboardingComponent } from './application-onboarding/application-onboarding.component';
47 import { ApplicationDetailsDialogComponent } from './application-onboarding/application-details-dialog/application-details-dialog.component';
48 import { AccountOnboardingComponent } from './account-onboarding/account-onboarding.component';
49 import { ApplicationCatalogService } from '../shared/services/application-catalog/application-catalog.service';
50 import { ContactUsComponent } from './contact-us/contact-us.component';
51 import { ContactUsManageComponent } from './contact-us/contact-us-manage/contact-us-manage.component';
52 import { ConfirmationModalComponent } from '../modals/confirmation-modal/confirmation-modal.component';
53 import { CatalogModalComponent } from './catalog-modal/catalog-modal.component';
54 import { DashboardComponent } from '../pages/dashboard/dashboard.component';
55 import { FunctionalMenuComponent } from './functional-menu/functional-menu.component';
56 import { GridsterModule } from 'angular-gridster2';
57 import { InformationModalComponent } from '../modals/information-modal/information-modal.component';
58 import { NgMaterialModule } from '../ng-material-module';
59 import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
60 import { NewPortalAdminComponent } from './portal-admins/new-portal-admin/new-portal-admin.component';
61 import { NotificationHistoryComponent } from './notification-history/notification-history.component';
62 import { PagesComponent } from './pages.component';
63 import { PagesRoutingModule } from './pages-routing.module';
64 import { PortalAdminsComponent } from './portal-admins/portal-admins.component';
65 import { RoleComponent } from './role/role.component';
66 import { SearchUsersComponent } from '../layout/components/search-users/search-users.component';
67 import { SchedulerComponent } from './scheduler/scheduler.component';
68 import { UserNotificationAdminComponent } from './user-notification-admin/user-notification-admin.component';
69 import { WidgetsComponent } from './widgets/widgets.component';
70 import { WidgetCatalogComponent } from './widget-catalog/widget-catalog.component';
71 import { WebAnalyticsComponent } from './web-analytics/web-analytics.component';
72 import { NewAdminComponent } from './admins/new-admin/new-admin.component';
73 import { ExternalRequestAccessService } from '../shared/services/external-request-access-service/external-request-access.service';
74 import { UsersService } from '../shared/services/users/users.service';
75 import { DynamicWidgetComponent } from './dynamic-widget/dynamic-widget.component';
76 import { MicroserviceOnboardingComponent } from './microservice-onboarding/microservice-onboarding.component';
77 import { WidgetOnboardingComponent } from './widget-onboarding/widget-onboarding.component';
78 import { WebAnalyticsDetailsDialogComponent } from './web-analytics/web-analytics-details-dialog/web-analytics-details-dialog.component';
79 import { BulkUploadRoleComponent } from './role/bulk-upload-role/bulk-upload-role.component';
80 import { AddRoleComponent } from './role/add-role/add-role.component';
81 import { RoleFunctionsComponent } from './role/role-functions/role-functions.component';
82 import { RoleFunctionModalComponent } from './role/role-functions/role-function-modal/role-function-modal.component';
83 import { NewNotificationModalComponent } from './user-notification-admin/new-notification-modal/new-notification-modal.component';
84 import { AccountAddDetailsComponent } from './account-onboarding/account-add-details/account-add-details.component';
85 import { MicroserviceAddDetailsComponent } from './microservice-onboarding/microservice-add-details/microservice-add-details.component';
86 import { DashboardApplicationCatalogComponent } from './dashboard-application-catalog/dashboard-application-catalog.component';
87 import { DashboardWidgetCatalogComponent } from './dashboard-widget-catalog/dashboard-widget-catalog.component';
88 import { WidgetDetailsDialogComponent } from './widget-onboarding/widget-details-dialog/widget-details-dialog.component';
89 import { FunctionalMenuDialogComponent } from './functional-menu/functional-menu-dialog/functional-menu-dialog.component';
90 import { GetAccessComponent } from './get-access/get-access.component';
91 import { PluginModule } from '../shared/plugin/plugin.module';
92 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
93 import { HTTP_INTERCEPTORS } from '@angular/common/http';
94 import { HeaderInterceptor } from '../shared/interceptors/header-interceptor';
95 import { ApplicationPipesModule } from '../shared/pipes/application-pipes.module';
96 import { UsersComponent } from './users/users.component';
97 import { NewUserModalComponent } from './users/new-user-modal/new-user-modal.component';
98 import { BulkUserComponent } from './users/bulk-user/bulk-user.component';
99 import { InformationTooltipComponent } from './information-tooltip/information-tooltip.component';
100 import { UserDetailsFormComponent } from './users/user-details-form/user-details-form.component';
101 import { MatTooltipModule } from '@angular/material';
102
103
104 @NgModule({
105   declarations: [
106     PagesComponent,
107     DashboardComponent,
108     PortalAdminsComponent,
109     AccountOnboardingComponent,
110     FunctionalMenuComponent,
111     MicroserviceOnboardingComponent,
112     NotificationHistoryComponent,
113     RoleComponent,
114     SchedulerComponent,
115     UserNotificationAdminComponent,
116     UsersComponent,
117     WidgetCatalogComponent,
118     WidgetOnboardingComponent,
119     WidgetsComponent,
120     WebAnalyticsComponent,
121     NewAdminComponent,
122     NewUserModalComponent,
123     BulkUserComponent,
124     SearchUsersComponent,
125     InformationModalComponent,
126     ConfirmationModalComponent,
127     AdminsComponent,
128     NewPortalAdminComponent,
129     SchedulerComponent,
130     UserNotificationAdminComponent,
131     WidgetCatalogComponent,
132     ApplicationOnboardingComponent,
133     AccountOnboardingComponent,
134     ApplicationDetailsDialogComponent,
135     ContactUsComponent,
136     ContactUsManageComponent,
137     WebAnalyticsDetailsDialogComponent,
138     ApplicationCatalogComponent,
139     WidgetCatalogComponent,
140     CatalogModalComponent,
141     DynamicWidgetComponent,
142     BulkUploadRoleComponent,
143     AddRoleComponent,
144     RoleFunctionsComponent,
145     RoleFunctionModalComponent,
146     NewNotificationModalComponent,
147     AccountAddDetailsComponent,
148     MicroserviceAddDetailsComponent,
149     WidgetDetailsDialogComponent,
150     DashboardApplicationCatalogComponent,
151     DashboardWidgetCatalogComponent,
152     FunctionalMenuDialogComponent,
153     GetAccessComponent,
154     UserDetailsFormComponent,
155     InformationTooltipComponent
156   ],
157   imports: [
158     CommonModule,
159     NgMaterialModule,
160     ReactiveFormsModule,
161     FormsModule,
162     PagesRoutingModule,
163     ApplicationPipesModule,
164     NgbModule,
165     GridsterModule,
166     MatIconModule,
167     MatCheckboxModule,
168     FormsModule,
169     PluginModule,
170     MatTooltipModule
171   ],
172   entryComponents: [
173     SchedulerComponent,
174     InformationModalComponent,
175     SearchUsersComponent,
176     ConfirmationModalComponent,
177     NewPortalAdminComponent,
178     NewAdminComponent,
179     BulkUserComponent,
180     NewUserModalComponent,
181     ApplicationDetailsDialogComponent,
182     ContactUsManageComponent,
183     CatalogModalComponent,
184     WebAnalyticsDetailsDialogComponent,
185     AddRoleComponent,
186     BulkUploadRoleComponent,
187     RoleFunctionModalComponent,
188     NewNotificationModalComponent,
189     AccountAddDetailsComponent,
190     MicroserviceAddDetailsComponent,
191     WidgetDetailsDialogComponent,
192     FunctionalMenuDialogComponent
193   ],
194   providers: [
195     {
196       provide: HTTP_INTERCEPTORS,
197       useClass: HeaderInterceptor,
198       multi: true,
199     }],
200     schemas: [
201       CUSTOM_ELEMENTS_SCHEMA
202     ]
203
204 })
205 export class PagesModule {
206
207   constructor(public ngbModalService: NgbModal) {
208     this.addSchdulerEventListners();
209   }
210
211
212   addSchdulerEventListners() {
213     let eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
214     let eventer = window[eventMethod];
215     let messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
216
217     eventer(messageEvent, function (e) {
218       if (e.data != null && e.data['widgetName'] == 'Portal-Common-Scheduler') {
219         this.openAddSchedulerModal(e.data);
220       }
221     }.bind(this), false);
222
223   }
224
225   openAddSchedulerModal(rowData: any) {
226     const modalRef = this.ngbModalService.open(SchedulerComponent, { size: 'lg' });
227     modalRef.componentInstance.title = 'Scheduler Change';
228     console.log("selectedData in parent", rowData);
229     if (rowData != 'undefined' && rowData) {
230       modalRef.componentInstance.payload = rowData;
231     } else {
232       modalRef.componentInstance.payload = {};
233     }
234
235   }
236 }