diff options
Diffstat (limited to 'portal-FE-common/src')
45 files changed, 2082 insertions, 30 deletions
diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html index 31f631eb..88d2ab94 100644 --- a/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html +++ b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html @@ -37,7 +37,7 @@ --> <div class="container"> - <div class="ecomp-main-view-title"> + <div class="onap-main-view-title"> <h1 class="heading-page">App Account Management</h1> </div> <button type="button" style="float: right;" class="btn btn-primary" (click)="openAddNewAccountModal('')"> diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html index 0d710f98..02dd70cb 100644 --- a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html @@ -46,11 +46,11 @@ <!--Modal Body goes here--> <div class="modal-body"> - <div class="c-ecomp-portal-abs-table contactus-manage-table"> + <div class="c-onap-portal-abs-table contactus-manage-table"> <table b2b-table id="table-main" table-data="contactUsList" current-page="ignoredCurrentPage"> <thead b2b-table-row type="header"> <tr> - <th id="th-users-0" b2b-table-header key="ecomp_function" default-sort="a">App Name</th> + <th id="th-users-0" b2b-table-header key="onap_function" default-sort="a">App Name</th> <th id="th-users-1" b2b-table-header key="app_name" sortable="true">Contact Name</th> <th id="th-users-2" b2b-table-header key="app_name" sortable="true">Contact Email</th> <th id="th-users-3" b2b-table-header key="role_name" sortable="true">Contact URL</th> diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us.component.html b/portal-FE-common/src/app/pages/contact-us/contact-us.component.html index 5930c382..f7f56463 100644 --- a/portal-FE-common/src/app/pages/contact-us/contact-us.component.html +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.html @@ -35,38 +35,38 @@ --> <div class="container"> - <div id="contact-us-title" class="w-ecomp-main-view-title"> + <div id="contact-us-title" class="w-onap-main-view-title"> <h1 class="heading-page">Contact Us</h1> </div> <button type="button" style="float: right;" class="btn btn-primary" (click)="editContactUsModal()"> <i class="icon ion-md-person-add"></i>Edit Contact Us </button> - <div class="w-ecomp-contactUs-home"> + <div class="w-onap-contactUs-home"> <div class="contactUs-home-container" id="page-content"> <div class="admins-page-main"> <div class="contactUs-general-div"> <span class="contactUs-txt"> - To report an issue with ECOMP Portal, open a ticket at the + To report an issue with ONAP Portal, open a ticket at the <a href="{{ush_TicketInfoUrl}}" target="_blank">User Self Help system</a>. </span><br /> </div> <div class="contactUs-general-div"> <span class="contactUs-txt"> - To give feedback to the ECOMP Portal team, send email to + To give feedback to the ONAP Portal team, send email to <a href="mailto:{{portalInfo_Address}}" target="_top">{{portalInfo_Address}}</a>. </span><br /> </div> <div class="contactUs-general-div"> <span class="contactUs-txt"> - To learn more about ECOMP Portal, visit the - <a href="{{feedback_Url}}" target="_blank">ECOMP Portal wiki</a> (may need to request access). + To learn more about ONAP Portal, visit the + <a href="{{feedback_Url}}" target="_blank">ONAP Portal wiki</a> (may need to request access). </span><br /> </div> <!-- Function Categories --> - <div id="appFunctionInfo" class="w-ecomp-main-view-title"> Application Functions + <div id="appFunctionInfo" class="w-onap-main-view-title"> Application Functions <br /> <div b2b-table table-data="contact.functionalTableData" class="b2b-table-div"> <table mat-table [dataSource]="dataSource" matSort> @@ -79,16 +79,16 @@ </ng-container> <!-- Application Name Column --> - <ng-container matColumnDef="eCOMPFunctions"> - <th id="col2" mat-header-cell *matHeaderCellDef> ECOMP Functions </th> - <td id="rowheader_t1_{{i}}-eCOMPFunctions" + <ng-container matColumnDef="onapFunctions"> + <th id="col2" mat-header-cell *matHeaderCellDef> ONAP Functions </th> + <td id="rowheader_t1_{{i}}-onapFunctions" mat-cell *matCellDef="let element; let i=index;"> {{element.functions}} </td> </ng-container> <!-- Application Name Column --> - <ng-container matColumnDef="eCOMPApplications"> - <th id="col2" mat-header-cell *matHeaderCellDef> ECOMP Applications </th> - <td id="rowheader_t1_{{i}}-eCOMPApplications" + <ng-container matColumnDef="onapApplications"> + <th id="col2" mat-header-cell *matHeaderCellDef> ONAP Applications </th> + <td id="rowheader_t1_{{i}}-onapApplications" mat-cell *matCellDef="let element; let i=index;"> <a href="javascript:void(0)" (click)="showApplicationInfo(element.app_Id)"> {{element.app_Name}} @@ -104,10 +104,10 @@ <!-- Display applicationInfo panels --> <div id="allAppInfo"> - <div class="w-ecomp-main-view-title"> All Applications</div> <br /> + <div class="w-onap-main-view-title"> All Applications</div> <br /> <div class="contactUs-general-div"> <div class="contact-us-table"> - <div class="c-ecomp-portal-abs-table default contactUs-table-ht"> + <div class="c-onap-portal-abs-table default contactUs-table-ht"> <div *ngFor="let rowData of appTable; index as i" class="contactUs-collapsible-panel"> <div id="{{rowData.app_Id}}" class="contactUs-table-ht" class="contactUs-panel-header" (click)="showApplicationInfo(rowData.app_Id)"> <span id="appId{{i}}" class="contactUs-table-spn">{{rowData.app_name}}</span> @@ -124,7 +124,7 @@ <div id="collapse{{rowData.app_Id}}" [hidden]="true" class="contactUs-collapsible-panel"> <div class="contactUs-txt" [hidden]="rowData.contact_name || rowData.contact_email || rowData.url_Info || rowData.desc"> <span class="contactUs-collapsible-panel-spn"> - No application information is available. Please use the links above to contact the ECOMP Portal team. + No application information is available. Please use the links above to contact the ONAP Portal team. </span> </div> <div class="contactUs-txt" *ngIf="rowData.contact_name || rowData.contact_email || rowData.url_Info || rowData.desc"> diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us.component.scss b/portal-FE-common/src/app/pages/contact-us/contact-us.component.scss index b3fb8d6a..5c7a74eb 100644 --- a/portal-FE-common/src/app/pages/contact-us/contact-us.component.scss +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.scss @@ -36,7 +36,7 @@ * * */ -.w-ecomp-contactUs-home .contactUs-txt { +.w-onap-contactUs-home .contactUs-txt { font-weight: 400; color: #666; font-size: 15px; @@ -44,7 +44,7 @@ margin: 10px; } -.w-ecomp-contactUs-home .contactUs-home-container .contactUs-general-div { +.w-onap-contactUs-home .contactUs-home-container .contactUs-general-div { margin: auto!important; padding-top: 15px; padding-bottom: 15px; @@ -55,7 +55,7 @@ width: 1170px; } -.w-ecomp-contactUs-home .w-ecomp-main-view-title { +.w-onap-contactUs-home .w-onap-main-view-title { font-family: Omnes-ECOMP-W02,Arial; font-size: 20px; } @@ -69,6 +69,6 @@ button#edit-button-contact-us { font-weight: bold; } -.w-ecomp-contactUs-home .contactUs-collapsible-panel { +.w-onap-contactUs-home .contactUs-collapsible-panel { margin: auto; } diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us.component.ts b/portal-FE-common/src/app/pages/contact-us/contact-us.component.ts index d58733bd..ec5d44ef 100644 --- a/portal-FE-common/src/app/pages/contact-us/contact-us.component.ts +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.ts @@ -62,7 +62,7 @@ export class ContactUsComponent implements OnInit { result: any; isEditMode: boolean = false; - displayedColumns: string[] = ['category', 'eCOMPFunctions','eCOMPApplications']; + displayedColumns: string[] = ['category', 'onapFunctions','onapApplications']; dataSource = new MatTableDataSource(this.functionalTableData); @ViewChild(MatSort) sort: MatSort; @ViewChild(MatPaginator) paginator: MatPaginator; diff --git a/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.scss b/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.scss index c716252e..cb1c7422 100644 --- a/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.scss +++ b/portal-FE-common/src/app/pages/functional-menu/functional-menu.component.scss @@ -56,7 +56,7 @@ background-color: #fff; } -.w-ecomp-main-view-title { +.w-onap-main-view-title { color: #191919; font-family: Omnes-ECOMP-W02-Medium,Arial; font-size: 24px; diff --git a/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.html b/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.html index 43065545..54070926 100644 --- a/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.html +++ b/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.html @@ -36,11 +36,11 @@ --> <div class="container"> - <div class="ecomp-main-view-title"> + <div class="onap-main-view-title"> <h1>Widget Onboarding</h1> </div> - <div class="c-ecomp-abs-select default"> + <div class="c-onap-abs-select default"> <div class="table-dropdown"> <mat-form-field class="widget-application-select"> <mat-label> Select Application </mat-label> diff --git a/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts b/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts new file mode 100644 index 00000000..5f789869 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { ApplicationCatalogService } from './application-catalog.service'; + +describe('ApplicationCatalogService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ApplicationCatalogService = TestBed.get(ApplicationCatalogService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.ts b/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.ts new file mode 100644 index 00000000..8dae2a67 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.ts @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { GridsterConfig, GridsterItem, DisplayGrid, GridType } from 'angular-gridster2'; +import { UUID } from 'angular2-uuid'; +import { CoreService } from '../core/core.service'; +import { Observable } from 'rxjs'; +import { IApplicationCatalog } from '../../model/application-catalog.model'; +import { environment } from 'src/environments/environment'; +import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class ApplicationCatalogService { + public options: GridsterConfig = { + minCols: 6, + maxCols: 6, + minRows: 7, + //maxRows: 4, + maxItemCols: 50, + minItemCols: 1, + maxItemRows: 50, + minItemRows: 1, + maxItemArea: 2500, + minItemArea: 1, + defaultItemCols: 1, + defaultItemRows: 1, + setGridSize: false, + fixedColWidth: 250, + fixedRowHeight: 250, + gridType: GridType.ScrollVertical, + swap: true, + dynamicColumns: true, + displayGrid: DisplayGrid.None, + itemChangeCallback: this.itemChange, + + + draggable: { + enabled: true + }, + pushItems: true, + resizable: { + enabled: true + } + }; + public layout: GridsterItem[] = []; + constructor(private api: HttpClient) { } + + addItem(appData: any): void { + this.layout.push(appData); + } + getAppCatalog(): Observable<any> { + return this.api.get(environment.api.appCatalog); + } + updateAppCatalog(appData: any): Observable<any> { + return this.api.put(environment.api.appCatalog, appData); + } + updateManualAppSort(appData: any): Observable<any> { + return this.api.put(environment.api.UpdateUserAppsSortManual, appData); + } + getuserAppRolesCatalog(appName: string): Observable<any> { + return this.api.get(environment.api.appCatalogRoles); + } + getAppsFullList(): Observable<any> { + return this.api.get(environment.api.appsFullList); + } + getUserAppsSortTypePreference(): Observable<any> { + const headers = new HttpHeaders().set('Content-Type','text/plain;charset=utf-8'); + return this.api.get(environment.api.userAppsSortTypePreference,{headers,responseType:'text'}); + } + getAppsOrderBySortPref(appSortPrefData: any): Observable<any> { + let httpParam = new HttpParams().set('mparams', appSortPrefData); + return this.api.get(environment.api.userAppsOrderBySortPref, {params: httpParam}); + } + saveAppsSortTypePreference(userPrefData: any): Observable<any> { + return this.api.put(environment.api.saveUserAppsSortingPreference, userPrefData); + } + itemChange(item, itemComponent) { + //console.info('itemChanged', item, itemComponent); + if(this.layout) + { + //console.log("check the layout value "+this.layout.values); + } + } + checkIfUserIsSuperAdmin(): Observable<any> { + let checkIfUserIsSuperAdminURL = environment.api.checkIfUserIsSuperAdmin; + return this.api.get(checkIfUserIsSuperAdminURL); + } + clearCatalog(): void { + this.layout =[]; + } + +} diff --git a/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts b/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts new file mode 100644 index 00000000..d7f33e92 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ExternalRequestAccessService } from './external-request-access.service'; + +describe('ExternalRequestAccessService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ExternalRequestAccessService = TestBed.get(ExternalRequestAccessService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.ts b/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.ts new file mode 100644 index 00000000..3d6447b9 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import { environment } from 'src/environments/environment'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class ExternalRequestAccessService { + + + + constructor(private api: HttpClient) { } + + getExternalRequestAccessServiceInfo(): Observable<any> { + return this.api.get(environment.api.externalRequestAccessSystem); + } + +} diff --git a/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts b/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts new file mode 100644 index 00000000..1280c084 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { FunctionalMenuService } from './functional-menu.service'; + +describe('FunctionalMenuService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: FunctionalMenuService = TestBed.get(FunctionalMenuService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.ts b/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.ts new file mode 100644 index 00000000..23029c30 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.ts @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { environment } from 'src/environments/environment'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class FunctionalMenuService { + + constructor(private http: HttpClient) { } + apiUrl = environment.api; + + getManagedRolesMenu(appId: any) { + return this.http.get(this.apiUrl.appRoles.replace(':appId', appId)); + } + + getAvailableApplications() { + return this.http.get(this.apiUrl.allAvailableApps); + } + + getFunctionalMenu(menuId: any) { + return this.http.get(this.apiUrl.functionalMenuItemDetails.replace(':menuId', menuId)); + } + + getManagedFunctionalMenu() { + return this.http.get(this.apiUrl.functionalMenuForEditing); + } + + getManagedFunctionalMenuForNotificationTree() { + return this.http.get(this.apiUrl.functionalMenuForNotificationTree); + } + + regenerateFunctionalMenuAncestors() { + return this.http.get(this.apiUrl.regenerateFunctionalMenuAncestors); + } + + saveEditedMenuItem(menuData: any) { + return this.http.put(this.apiUrl.functionalMenuItem, menuData); + } + + saveMenuItem(menuData: any) { + return this.http.post(this.apiUrl.functionalMenuItem, menuData); + } + + deleteMenuItem(menuId: any){ + return this.http.delete(this.apiUrl.functionalMenuItem + '/' + menuId); + } + + getFunctionalMenuRole(){ + return this.http.get(this.apiUrl.getFunctionalMenuRole); + } + + saveBulkFunction(appId, appFunction){ + return this.http.post(this.apiUrl.saveRoleFunction.replace(':appId', appId), appFunction); + } + + saveBulkRole(appId, appRole){ + return this.http.post(this.apiUrl.saveRole.replace(':appId', appId), appRole); + } + + updateBulkRoleFunction(appId, roleFunction){ + return this.http.post(this.apiUrl.uploadRoleFunction.replace(':appId', appId), roleFunction); + } + +} diff --git a/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts b/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts new file mode 100644 index 00000000..2f0c96a8 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { GetAccessService } from './get-access.service'; + +describe('GetAccessService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: GetAccessService = TestBed.get(GetAccessService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/get-access/get-access.service.ts b/portal-FE-common/src/app/shared/services/get-access/get-access.service.ts new file mode 100644 index 00000000..5de2412b --- /dev/null +++ b/portal-FE-common/src/app/shared/services/get-access/get-access.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; +import { environment } from 'src/environments/environment'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class GetAccessService { + + constructor(private http: HttpClient) { } + apiUrl = environment.api; + + getListOfApp() { + return this.http.get(this.apiUrl.listOfApp); + } +} diff --git a/portal-FE-common/src/app/shared/services/index.ts b/portal-FE-common/src/app/shared/services/index.ts new file mode 100644 index 00000000..2297d3ae --- /dev/null +++ b/portal-FE-common/src/app/shared/services/index.ts @@ -0,0 +1,57 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +export * from './sidebar/sidebar.service'; +export * from './portal-admins/portal-admin.service'; +export * from './admins/admins.service'; +export * from './users/users.service'; +export * from './role/role.service'; +export * from './applications/applications.service'; +export * from './functional-menu/functional-menu.service' +export * from './microservice/microservice.service'; +export * from './widget-onboarding/widget-onboarding.service'; +export * from './basic-auth-account/basic-auth-account.service'; +export * from './contact-us/contact-us.service'; +export * from './webAnalytics/web-analytics.service'; +export * from './user-profile/user-profile.service'; +export * from './notification/notification.service'; +export * from './menus/menus.service'; +export * from './manifest/manifest.service'; +export * from './get-access/get-access.service'; +export * from './userbar/userbar.service'; +export * from './scheduler/scheduler.service'; +export * from './utils/utils.service';
\ No newline at end of file diff --git a/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts b/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts new file mode 100644 index 00000000..a5ad81b1 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { ManifestService } from './manifest.service'; + +describe('ManifestService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ManifestService = TestBed.get(ManifestService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/manifest/manifest.service.ts b/portal-FE-common/src/app/shared/services/manifest/manifest.service.ts new file mode 100644 index 00000000..76a2f0f5 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/manifest/manifest.service.ts @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class ManifestService { + + api = environment.api; + constructor(public httpClient: HttpClient) { } + + getManifest() { + return this.httpClient.get(this.api.getManifest); + } +} diff --git a/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts b/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts new file mode 100644 index 00000000..b624236a --- /dev/null +++ b/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { MenusService } from './menus.service'; + +describe('MenusService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: MenusService = TestBed.get(MenusService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/menus/menus.service.ts b/portal-FE-common/src/app/shared/services/menus/menus.service.ts new file mode 100644 index 00000000..f0c16d68 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/menus/menus.service.ts @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { environment } from 'src/environments/environment'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class MenusService { + + apiUrl = environment.api; + constructor(private http: HttpClient) { } + + getFunctionalMenuForUser() { + return this.http.get(this.apiUrl.functionalMenuForAuthUser); + } + + getPortalTitle() { + return this.http.get(this.apiUrl.portalTitle); + } + + getFavoriteItems() { + return this.http.get(this.apiUrl.getFavoriteItems + '?date=' + new Date().getTime()); + } + + setFavoriteItem(menuId) { + return this.http.post(this.apiUrl.setFavoriteItem, menuId); + + } + + removeFavoriteItem(menuId) { + return this.http.delete(this.apiUrl.removeFavoriteItem.replace(':menuId', menuId)); + } + + logout(appStr) { + // this.$log.info('SessionService::logout from App'); + // this.$log.info('SessionService appStr: ', appStr); + + var eaccessPattern = '\https?\:\/\/[^/]+/[^/]+/[^/]+'; + var standardPattern = '\https?\:\/\/[^/]+/[^/]+'; + + if (appStr.includes('e-access')) { + standardPattern = eaccessPattern; + } + + var contextUrl = appStr.match(new RegExp(standardPattern)); + var logoutUrl = contextUrl + '/logout.htm'; + // this.$sce.trustAsResourceUrl(logoutUrl); + console.log('logoutUrl ' + logoutUrl); + jQuery('#reg-logout-div').append("<iframe style='display:none' src='" + logoutUrl + "' />"); + + } + +} diff --git a/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts b/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts new file mode 100644 index 00000000..b8f0d334 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { TestBed } from '@angular/core/testing'; + +import { NotificationService } from './notification.service'; + +describe('NotificationService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: NotificationService = TestBed.get(NotificationService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/notification/notification.service.ts b/portal-FE-common/src/app/shared/services/notification/notification.service.ts new file mode 100644 index 00000000..2dfe2396 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/notification/notification.service.ts @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from '../../../../environments/environment'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class NotificationService { + + api = environment.api; + + constructor(private http: HttpClient) { } + + getNotificationRate(): Observable<any>{ + let getNotificationRateURL = this.api.notificationUpdateRate; + return this.http.get(getNotificationRateURL); + } + + getNotification(): Observable<any>{ + let getNotificationURL = this.api.getNotifications; + return this.http.get(getNotificationURL); + } + + getNotificationHistory(): Observable<any>{ + let getNotificationHistoryURL = this.api.getNotificationHistory; + return this.http.get(getNotificationHistoryURL); + } + + getAdminNotification(): Observable<any>{ + let getAdminNotificationURL = this.api.getAdminNotifications; + return this.http.get(getAdminNotificationURL); + } + + getMessageRecipients(notificationId: any): Observable<any>{ + let getMessageRecipientsURL = this.api.getMessageRecipients+"?notificationId="+notificationId; + return this.http.get(getMessageRecipientsURL); + } + + getAppRoleIds(): Observable<any>{ + let getAppRoleIdsURL = this.api.getAllAppRoleIds; + return this.http.get(getAppRoleIdsURL); + } + + getNotificationRoles(notificationId: any): Observable<any>{ + let getNotificationRolesURL = this.api.getNotificationRoles + '/'+notificationId+'/roles'; + return this.http.get(getNotificationRolesURL); + } + + addAdminNotification(newAdminNotification: any): Observable<any>{ + let addAdminNotificationURL = this.api.saveNotification; + return this.http.post(addAdminNotificationURL, newAdminNotification); + } + + updateAdminNotification(adminNotification: any): Observable<any>{ + let updateAdminNotificationURL = this.api.saveNotification; + return this.http.post(updateAdminNotificationURL, adminNotification); + } + + setNotificationRead(notificationId: any): Observable<any>{ + let setNotificationReadURL = this.api.notificationRead+"?notificationId="+notificationId; + return this.http.get(setNotificationReadURL); + } + +} diff --git a/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts b/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts new file mode 100644 index 00000000..e984467e --- /dev/null +++ b/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { PortalAdminsService } from './portal-admin.service'; + +describe('AdminsService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: PortalAdminsService = TestBed.get(PortalAdminsService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.ts b/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.ts new file mode 100644 index 00000000..90ae5c30 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.ts @@ -0,0 +1,25 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class PortalAdminsService { + apiUrl = environment.api; + constructor(private http: HttpClient) { } + + getPortalAdmins() { + return this.http.get(this.apiUrl.portalAdmins); + } + + addPortalAdmin(selectedUser: string) { + return this.http.post(this.apiUrl.portalAdmin, selectedUser); + } + + removePortalAdmin(userId: number, orUserId: string) { + let userInfo = userId + "-" + orUserId; + return this.http.delete(this.apiUrl.portalAdmin + '/' + userInfo); + } + +} diff --git a/portal-FE-common/src/app/shared/services/role/role.service.spec.ts b/portal-FE-common/src/app/shared/services/role/role.service.spec.ts new file mode 100644 index 00000000..e5935616 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/role/role.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { RoleService } from './role.service'; + +describe('RoleService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: RoleService = TestBed.get(RoleService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/role/role.service.ts b/portal-FE-common/src/app/shared/services/role/role.service.ts new file mode 100644 index 00000000..b65a662d --- /dev/null +++ b/portal-FE-common/src/app/shared/services/role/role.service.ts @@ -0,0 +1,99 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { environment } from 'src/environments/environment'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ + providedIn: 'root' +}) +export class RoleService { + + api = environment.api; + + constructor(private http: HttpClient) { } + + getRoles(appId: string) { + return this.http.get(this.api.getRoles.replace(':appId', appId)); + } + + saveRoleFunction(appId: string) { + return this.http.post(this.api.saveRoleFunction.replace(':appId', appId), {}); + } + + getRoleFunctionList(appId) { + return this.http.get(this.api.getRoleFunctions.replace(':appId', appId)); + } + + getFnMenuItems() { + return this.http.get('admin_fn_menu'); + } + + getCacheRegions() { + return this.http.get('get_regions'); + } + + getUsageList() { + return this.http.get('get_usage_list'); + } + + getBroadcastList() { + return this.http.get('get_broadcast_list'); + } + + getBroadcast(messageLocationId, messageLocation, messageId) { + return this.http.get('get_broadcast?message_location_id=' + messageLocationId + '&message_location=' + messageLocation + ((messageId != null) ? '&message_id=' + messageId : '')); + } + + getCollaborateList() { + return this.http.get('get_collaborate_list'); + } + + getRole(appId, roleId) { + return this.http.get(this.api.getRole + '/' + appId + '/' + roleId); + } + + saveRole(appId) { + return this.http.post(this.api.saveRole.replace(':appId', appId), {}); + } + + getCentralizedApps(userId) { + return this.http.get(this.api.centralizedApps + '?userId=' + userId); + } + +} diff --git a/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts b/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts new file mode 100644 index 00000000..dbeb9b6a --- /dev/null +++ b/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { SchedulerService } from './scheduler.service'; + +describe('SchedulerService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: SchedulerService = TestBed.get(SchedulerService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.ts b/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.ts new file mode 100644 index 00000000..9bd3e821 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.ts @@ -0,0 +1,101 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { environment } from '../../../../environments/environment'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class SchedulerService { + + api = environment.api; + + constructor(private http: HttpClient) { } + + /** get scheduler uuID **/ + getStatusSchedulerId(schedulerInfo:any): Observable<any> { + let getStatusSchedulerByIdURL = this.api.getSchedulerId+'?r='+ Math.random(); + return this.http.post(getStatusSchedulerByIdURL,schedulerInfo); + } + + /** get time slots for Range scheduler **/ + getTimeslotsForScheduler(schedulerID:any): Observable<any> { + let getTimeslotsForSchedulerURL = this.api.getTimeslotsForScheduler + '/' + schedulerID + '?r=' + Math.random(); + return this.http.get(getTimeslotsForSchedulerURL); + } + + /** postSubmitForApprovedTimeslots **/ + postSubmitForApprovedTimeslots(approvedTimeSlotsObj:any): Observable<any> { + let getStatusSchedulerByIdURL = this.api.postSubmitForApprovedTimeslots+'?r='+ Math.random(); + return this.http.post(getStatusSchedulerByIdURL,approvedTimeSlotsObj); + } + + /** Get policy information from BE **/ + getPolicyInfo(): Observable<any> { + let getPolicyInfoURL = this.api.getPolicy+'?r='+ Math.random(); + return this.http.get<Map<String, any>>(getPolicyInfoURL); + } + + /** get Scheduler UI constants from BE **/ + getSchedulerConstants(): Observable<any> { + let getSchedulerConstantsURL = this.api.getSchedulerConstants; + return this.http.get(getSchedulerConstantsURL); + } + + /** getWidgetData **/ + getWidgetData(widgetId: any,widgetData: any, widgetParam: any){ + let widgetInfo={ + id: widgetId, + data: widgetData, + param: widgetParam + } + return widgetInfo; + } + + showWidget(widgetId: any,widgetData: any, widgetParam: any) { + let widgetInfo={ + id: widgetId, + data: widgetData, + param: widgetParam + } + //Need to open popup here + } +} diff --git a/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts b/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts new file mode 100644 index 00000000..065e6e56 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { SidebarService } from './sidebar.service'; + +describe('SidenavService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: SidebarService = TestBed.get(SidebarService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.ts b/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.ts new file mode 100644 index 00000000..b0b21b3b --- /dev/null +++ b/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.ts @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from '../../../../environments/environment' + +@Injectable({ + providedIn: 'root' +}) +export class SidebarService { + api = environment.api; + + constructor(private http: HttpClient) { } + getLeftMenu() { + return this.http.get(this.api.leftmenuItems); + + } + +} diff --git a/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts b/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts new file mode 100644 index 00000000..70ae8043 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { AddTabFunctionService } from './add-tab-function.service'; + +describe('AddTabFunctionService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: AddTabFunctionService = TestBed.get(AddTabFunctionService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.ts b/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.ts new file mode 100644 index 00000000..15ff6367 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.ts @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; +import { Subject } from 'rxjs/Subject'; + +@Injectable({ + providedIn: 'root' +}) +export class AddTabFunctionService { + + constructor() { } + + private _listners = new Subject<any>(); + + listen(): Observable<any> { + return this._listners.asObservable(); + } + + filter(filterBy: any) { + this._listners.next(filterBy); + } +} diff --git a/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts b/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts new file mode 100644 index 00000000..b1d5e6bd --- /dev/null +++ b/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { UserProfileService } from './user-profile.service'; + +describe('UserProfileService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: UserProfileService = TestBed.get(UserProfileService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.ts b/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.ts new file mode 100644 index 00000000..2b86c8d7 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.ts @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class UserProfileService { + + api = environment.api; + + constructor(private http: HttpClient) { } + + getUserProfile() { + return this.http.get(this.api.userProfile); + } + + getFunctionalMenuStaticInfo() { + return this.http.get(this.api.functionalMenuStaticInfo); + + } + + getActiveUser() { + return this.http.get(this.api.getActiveUser); + } + + + getUserAppRoles(userId) { + let httpParams = new HttpParams() + .set('userId', userId); + return this.http.get(this.api.userApplicationRoles, { params: httpParams }); + } +} diff --git a/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts b/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts new file mode 100644 index 00000000..24329626 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { UserbarService } from './userbar.service'; + +describe('UserbarService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: UserbarService = TestBed.get(UserbarService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/userbar/userbar.service.ts b/portal-FE-common/src/app/shared/services/userbar/userbar.service.ts new file mode 100644 index 00000000..de42ce36 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/userbar/userbar.service.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class UserbarService { + refreshCount: number; + maxCount: number; + apiUrl = environment.api; + constructor(public http: HttpClient) { + this.refreshCount = 0; + this.maxCount = 0; + } + + getRefreshCount() { + return this.refreshCount; + } + setRefreshCount(count) { + this.refreshCount = count; + } + setMaxRefreshCount(count) { + this.maxCount = count; + } + decrementRefreshCount() { + this.refreshCount = this.refreshCount - 1; + } + + getOnlineUserUpdateRate(){ + return this.http.get(this.apiUrl.onlineUserUpdateRate); + } +} diff --git a/portal-FE-common/src/app/shared/services/users/users.service.spec.ts b/portal-FE-common/src/app/shared/services/users/users.service.spec.ts new file mode 100644 index 00000000..c1f41d8a --- /dev/null +++ b/portal-FE-common/src/app/shared/services/users/users.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { UsersService } from './users.service'; + +describe('UsersService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: UsersService = TestBed.get(UsersService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/users/users.service.ts b/portal-FE-common/src/app/shared/services/users/users.service.ts new file mode 100644 index 00000000..38ebedd8 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/users/users.service.ts @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { environment } from '../../../../environments/environment' +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Observable, from } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class UsersService { + api = environment.api; + + constructor(private http: HttpClient) { } + + searchUsers(queryString: string) { + let httpParams = new HttpParams() + .set('search', queryString); + return this.http.get(this.api.queryUsers, { params: httpParams, responseType: 'json' }); + } + + getAccountUsers(appId: any) { + return this.http.get(this.api.accountUsers.replace(':appId', appId)); + } + + getUserAppRoles(appid: any, orgUserId: string, extRequestValue: any, isSystemUser: any) { + return this.http.get(this.api.userAppRoles, { params: { 'user': orgUserId, 'app': appid, 'externalRequest': extRequestValue, 'isSystemUser': isSystemUser } }); + } + + updateUserAppRoles(newUserAppRoles) { + return this.http.put(this.api.userAppRoles, newUserAppRoles); + } + + //Not used in dev.json + getLoggedInUser() { } + + //Not used in dev.jon + modifyLoggedInUser() { } + + getUserProfile(): Observable<any> { + return this.http.get(environment.api.userProfile); + } + + addNewUser(newUserData){ + console.log("User service : ", newUserData); + return this.http.post(this.api.saveNewUser, newUserData).subscribe((response)=>{ + }); + } + +} diff --git a/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts b/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts new file mode 100644 index 00000000..102bf3d4 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { UtilsService } from './utils.service'; + +describe('UtilsService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: UtilsService = TestBed.get(UtilsService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/utils/utils.service.ts b/portal-FE-common/src/app/shared/services/utils/utils.service.ts new file mode 100644 index 00000000..8d5eff10 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/utils/utils.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class UtilsService { + + constructor() { } + + isValidJSON(json) { + try { + var checkJSON = JSON.parse(JSON.stringify(json)); + if (checkJSON && typeof checkJSON === 'object' && checkJSON !== null) { + // this.$log.debug('UtilsService::isValidJSON: JSON is valid!'); + return true; + } + } catch (err) { + // this.$log.debug('UtilsService::isValidJSON: json passed is not valid: ' + JSON.stringify(err)); + } + return false; +} +} diff --git a/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts b/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts new file mode 100644 index 00000000..0c9b86bf --- /dev/null +++ b/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { TestBed } from '@angular/core/testing'; + +import { WebAnalyticsService } from './web-analytics.service'; + +describe('WebAnalyticsService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: WebAnalyticsService = TestBed.get(WebAnalyticsService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.ts b/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.ts new file mode 100644 index 00000000..0632a23c --- /dev/null +++ b/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.ts @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { environment } from '../../../../environments/environment'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class WebAnalyticsService { + + api = environment.api; + + constructor(private http: HttpClient) { } + + getWebAnalyticsAppReports(): Observable<any> { + let getWebAnalyticsAppReportsURL = this.api.getUserAppsWebAnalytics; + return this.http.get(getWebAnalyticsAppReportsURL, { withCredentials: true }); + } + + getWebAnalyticsReportOfApplication(appName: any) { + let httpParam = new HttpParams() + .append('appName', appName); + let getWebAnalyticsReportOfApplicationURL = this.api.getWebAnalyticsOfApp; + return this.http.get(getWebAnalyticsReportOfApplicationURL, {params: httpParam, withCredentials: true}); + } + + getUserJourneyList(appName: any){ + let httpParam = new HttpParams() + .append('appName', appName); + let getUserJourneyListURL = this.api.getUserJourneyAnalyticsReport + return this.http.get(getUserJourneyListURL, {params: httpParam, withCredentials: true}); + } + + save(reportSource: any): Observable<any> { + let saveURL = this.api.addWebAnalyticsReport; + return this.http.post(saveURL, reportSource, {withCredentials: true}) + } + + updateWebAnalyticsReport(reportSource: any): Observable<any> { + let updateWebAnalyticsReportURL = this.api.modifyWebAnalyticsReport; + return this.http.put(updateWebAnalyticsReportURL, reportSource, {withCredentials: true}) + } + + getAllWebAnalyticsReport(){ + let updateWebAnalyticsReportURL = this.api.getAllWebAnalytics; + return this.http.get(updateWebAnalyticsReportURL, { withCredentials: true }); + } + + deleteWebAnalyticsReport(webAnalyticsReport){ + let deleteWebAnalyticsReportURL = this.api.deleteWebAnalyticsReport +'?' + 'resourceId='+ webAnalyticsReport.resourceId; + return this.http.delete(deleteWebAnalyticsReportURL, { withCredentials: true }); + } + + getAllApplications(){ + let getAllApplicationsURL = this.api.appsFullList; + return this.http.get(getAllApplicationsURL, { withCredentials: true }); + } + +} diff --git a/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts b/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts new file mode 100644 index 00000000..fb87e8b9 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { TestBed } from '@angular/core/testing'; + +import { WidgetCatalogService } from './widget-catalog.service'; + +describe('WidgetCatalogService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: WidgetCatalogService = TestBed.get(WidgetCatalogService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.ts b/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.ts new file mode 100644 index 00000000..8cb31785 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.ts @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +import { Injectable } from '@angular/core'; +import { IWidgetCatalog } from '../../model/widget-catalog.model'; +import { Observable, from } from 'rxjs'; +import { GridsterConfig, GridsterItem, CompactType, DisplayGrid, GridType } from 'angular-gridster2'; +import { CoreService } from '../core/core.service'; +import { environment } from 'src/environments/environment'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; + + + +@Injectable({ + providedIn: 'root' +}) +export class WidgetCatalogService { + public options: GridsterConfig = { + minCols: 6, + maxCols: 6, + minRows: 7, + //maxRows: 4, + maxItemCols: 50, + minItemCols: 1, + maxItemRows: 50, + minItemRows: 1, + maxItemArea: 2500, + minItemArea: 1, + defaultItemCols: 2, + defaultItemRows: 2, + setGridSize: false, + fixedColWidth: 250, + fixedRowHeight: 250, + gridType: GridType.ScrollVertical, + swap: true, + dynamicColumns: true, + displayGrid: DisplayGrid.None, + + + draggable: { + enabled: true + }, + pushItems: true, + resizable: { + enabled: true + } + }; + public layout: GridsterItem[] = []; + constructor(private api: HttpClient) { } + addItem(widgetData: any): void { + this.layout.push(widgetData); + } + widgetCatalogData: IWidgetCatalog[] = [{ + widgetId: '1', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '2', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '3', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '4', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '5', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '6', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '7', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }, + { + widgetId: '8', + widgetName: 'TestData1', + widgetStatus: 'TestStatus1', + imageLink: 'week_1.png', + select: true + }]; + + + public getWidgetCatalog(): any { + const widgetCatalogObservable = new Observable(observer => { + setTimeout(() => { + observer.next(this.widgetCatalogData); + }, 1000); + }); + + return widgetCatalogObservable; + } + getUserWidgets(loginName: string): Observable<any> { + return this.api.get(environment.api.widgetCommon + '/widgetCatalog' + '/' + loginName); + } + getManagedWidgets(): Observable<any> { + return this.api.get(environment.api.widgetCommon + '/widgetCatalog'); + } + getUploadFlag(): Observable<any> { + return this.api.get(environment.api.widgetCommon + '/uploadFlag'); + } + // createWidget(newWidget: any, widgetNameparam: string): Observable<any> { + // return this.api.post(environment.api.widgetCommon + '/widgetCatalog', newWidget, widgetNameparam); + // } + + // updateWidgetWithFile(newWidget: any, widgetNameparam: string, widgetIdParam: string): Observable<any> { + // return this.api.post(environment.api.widgetCommon + '/widgetCatalog/' + widgetIdParam, newWidget, widgetNameparam); + // } + + updateWidget(newWidget: any, widgetIdParam: string): Observable<any> { + return this.api.put(environment.api.widgetCommon + '/widgetCatalog/' + widgetIdParam, newWidget); + } + updateWidgetCatalog(appData: any): Observable<any> { + const headers = new HttpHeaders().set('X-Widgets-Type','all'); + return this.api.put(environment.api.widgetCatalogSelection, appData,{headers}); + } +} diff --git a/portal-FE-common/src/styles/_spinner.scss b/portal-FE-common/src/styles/_spinner.scss index 406ca78a..f1ad5bc9 100644 --- a/portal-FE-common/src/styles/_spinner.scss +++ b/portal-FE-common/src/styles/_spinner.scss @@ -35,7 +35,7 @@ * * */ -.ecomp-spinner { +.onap-spinner { background: url('../assets/images/spinner.gif') top left no-repeat; width: 32px; height: 32px; @@ -43,7 +43,7 @@ top: 35%; left: calc(50% - 32px/2); } -.ecomp-save-spinner { +.onap-save-spinner { background: url('../assets/images/spinner.gif') top left no-repeat; width: 25px; height: 25px; @@ -52,7 +52,7 @@ left: -50px; top: 2px; } -.ecomp-small-spinner { +.onap-small-spinner { background: url('../assets/images/spinner.gif') top left no-repeat; width: 25px; height: 25px; |