7ccb3f95e2b87a181636f93db32e5a709f81dfab
[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 } 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 { UserDetailsFormComponent } from './users/user-details-form/user-details-form.component';
100
101
102 @NgModule({
103   declarations: [
104     PagesComponent,
105     DashboardComponent,
106     PortalAdminsComponent,
107     AccountOnboardingComponent,
108     FunctionalMenuComponent,
109     MicroserviceOnboardingComponent,
110     NotificationHistoryComponent,
111     RoleComponent,
112     SchedulerComponent,
113     UserNotificationAdminComponent,
114     UsersComponent,
115     WidgetCatalogComponent,
116     WidgetOnboardingComponent,
117     WidgetsComponent,
118     WebAnalyticsComponent,
119     NewAdminComponent,
120     NewUserModalComponent,
121     BulkUserComponent,
122     SearchUsersComponent,
123     InformationModalComponent,
124     ConfirmationModalComponent,
125     AdminsComponent,
126     NewPortalAdminComponent,
127     SchedulerComponent,
128     UserNotificationAdminComponent,
129     WidgetCatalogComponent,
130     ApplicationOnboardingComponent,
131     AccountOnboardingComponent,
132     ApplicationDetailsDialogComponent,
133     ContactUsComponent,
134     ContactUsManageComponent,
135     WebAnalyticsDetailsDialogComponent,
136     ApplicationCatalogComponent,
137     WidgetCatalogComponent,
138     CatalogModalComponent,
139     DynamicWidgetComponent,
140     BulkUploadRoleComponent,
141     AddRoleComponent,
142     RoleFunctionsComponent,
143     RoleFunctionModalComponent,
144     NewNotificationModalComponent,
145     AccountAddDetailsComponent,
146     MicroserviceAddDetailsComponent,
147     WidgetDetailsDialogComponent,
148     DashboardApplicationCatalogComponent,
149     DashboardWidgetCatalogComponent,
150     FunctionalMenuDialogComponent,
151     GetAccessComponent,
152     UserDetailsFormComponent
153   ],
154   imports: [
155     CommonModule,
156     NgMaterialModule,
157     ReactiveFormsModule,
158     FormsModule,
159     PagesRoutingModule,
160     ApplicationPipesModule,
161     NgbModule,
162     GridsterModule,
163     MatIconModule,
164     MatCheckboxModule,
165     FormsModule,
166     PluginModule
167   ],
168   entryComponents: [
169     SchedulerComponent,
170     InformationModalComponent,
171     SearchUsersComponent,
172     ConfirmationModalComponent,
173     NewPortalAdminComponent,
174     NewAdminComponent,
175     BulkUserComponent,
176     NewUserModalComponent,
177     ApplicationDetailsDialogComponent,
178     ContactUsManageComponent,
179     CatalogModalComponent,
180     WebAnalyticsDetailsDialogComponent,
181     AddRoleComponent,
182     BulkUploadRoleComponent,
183     RoleFunctionModalComponent,
184     NewNotificationModalComponent,
185     AccountAddDetailsComponent,
186     MicroserviceAddDetailsComponent,
187     WidgetDetailsDialogComponent,
188     FunctionalMenuDialogComponent
189   ],
190   providers: [
191     {
192       provide: HTTP_INTERCEPTORS,
193       useClass: HeaderInterceptor,
194       multi: true,
195     }],
196
197
198 })
199 export class PagesModule {
200
201   constructor(public ngbModalService: NgbModal) {
202     this.addSchdulerEventListners();
203   }
204
205
206   addSchdulerEventListners() {
207     let eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
208     let eventer = window[eventMethod];
209     let messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
210
211     eventer(messageEvent, function (e) {
212       if (e.data != null && e.data['widgetName'] == 'Portal-Common-Scheduler') {
213         this.openAddSchedulerModal(e.data);
214       }
215     }.bind(this), false);
216
217   }
218
219   openAddSchedulerModal(rowData: any) {
220     const modalRef = this.ngbModalService.open(SchedulerComponent, { size: 'lg' });
221     modalRef.componentInstance.title = 'Scheduler Change';
222     console.log("selectedData in parent", rowData);
223     if (rowData != 'undefined' && rowData) {
224       modalRef.componentInstance.payload = rowData;
225     } else {
226       modalRef.componentInstance.payload = {};
227     }
228
229   }
230 }