From 89498fdaf633640c04f9179e0d1514a89f36a18e Mon Sep 17 00:00:00 2001 From: Sudarshan Kumar Date: Thu, 12 Dec 2019 18:36:51 +0530 Subject: [PATCH 1/1] Added Contact-Us Component and Service Added Contact-Us Component and Service Issue-ID: PORTAL-795 Change-Id: Iee3fc35385aada55ab37a809a55b0ba254d84c89 Signed-off-by: Sudarshan Kumar --- .../contact-us-manage.component.html | 156 ++++++++++++++++ .../contact-us-manage.component.scss | 79 +++++++++ .../contact-us-manage.component.spec.ts | 63 +++++++ .../contact-us-manage.component.ts | 182 +++++++++++++++++++ .../app/pages/contact-us/contact-us.component.html | 163 +++++++++++++++++ .../app/pages/contact-us/contact-us.component.scss | 74 ++++++++ .../pages/contact-us/contact-us.component.spec.ts | 63 +++++++ .../app/pages/contact-us/contact-us.component.ts | 196 +++++++++++++++++++++ .../services/contact-us/contact-us.service.spec.ts | 50 ++++++ .../services/contact-us/contact-us.service.ts | 96 ++++++++++ 10 files changed, 1122 insertions(+) create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us.component.html create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us.component.scss create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us.component.spec.ts create mode 100644 portal-FE-common/src/app/pages/contact-us/contact-us.component.ts create mode 100644 portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts create mode 100644 portal-FE-common/src/app/shared/services/contact-us/contact-us.service.ts 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 new file mode 100644 index 00000000..0d710f98 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.html @@ -0,0 +1,156 @@ + +
+ + + + + + + +
\ No newline at end of file diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss new file mode 100644 index 00000000..bff240e2 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.scss @@ -0,0 +1,79 @@ +/*- + * ============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============================================ + * + * + */ + ::ng-deep .modal-dialog { + max-width: 1200px; + width: 1200px; + overflow-x: auto; + overflow-y: auto; +} + +.addApplicationContactInfo{ + display: inline-flex; +} + +.addApplicationContactInfo input[type="text"] { + width: 22em; + margin-right: 8px; +} + +.property-label-desc-txtarea { + overflow: auto; + resize: vertical; + width: 67em; +} + +.divider-line{ + border-bottom-style: solid; + border-bottom-width: 1px; + padding-bottom: 50px; +} + +.edit-contactus-title { + margin-top: 28px; + margin-bottom: 1rem; + font-size: 23px; +} + +.required:before { + color: #cf2a2a; + margin-right: 2px; + content: "* "; + position: absolute; + top: 45px; + left: 28px; +} diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts new file mode 100644 index 00000000..06b6995a --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.spec.ts @@ -0,0 +1,63 @@ +/*- + * ============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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ContactUsManageComponent } from './contact-us-manage.component'; + +describe('ContactUsManageComponent', () => { + let component: ContactUsManageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ContactUsManageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ContactUsManageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts new file mode 100644 index 00000000..e04ccb77 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us-manage/contact-us-manage.component.ts @@ -0,0 +1,182 @@ +/*- + * ============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 { Component, OnInit, Input} from '@angular/core'; +import { ContactUsService } from '../../../shared/services/index'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +@Component({ + selector: 'app-contact-us-manage', + templateUrl: './contact-us-manage.component.html', + styleUrls: ['./contact-us-manage.component.scss'] +}) +export class ContactUsManageComponent implements OnInit { + + contactUsList = []; + contactUsAllAppList = []; + result: any; + selectedApp: any; + showEdit: boolean = false; + newContactUs ={ + appId:'', + appName:'', + description:'', + contactName:'', + contactEmail:'', + url:'' , + activeYN:'' + }; + + + constructor(public activeModal: NgbActiveModal, public ngbModal: NgbModal, public contactUsService: ContactUsService) { } + + ngOnInit() { + + this.getContactUsList(); + this.getListOfApp(); + } + + getContactUsList(){ + console.log("getContactUsList called..."); + this.contactUsService.getContactUs() + .subscribe( _data => { + this.result = _data; + console.log("getContactUsList Data :: ", _data); + if (this.result.response == null || this.result.response == 'undefined') { + console.log('ContactUsService::getContactUsList Failed: Result or result.data is null'); + }else{ + for(var i=0; i{ + console.log(error); + }); + } + + getListOfApp(){ + console.log("getListOfApp called..."); + this.contactUsService.getListOfApp() + .subscribe( _data => { + this.result = _data; + console.log("getListOfApp Data :: ", _data); + if (this.result == null || this.result == 'undefined') { + console.log('ContactUsService::getListOfApp Failed: Result or result.data is null'); + }else{ + let res1 = this.result; + let realAppIndex = 0; + this.contactUsAllAppList.length=0; + console.log("this.contactUsList ",this.contactUsList) + for (var i = 1; i <= res1.length; i++) { + if (!res1[i - 1].restrictedApp) { + var okToAdd = true; + for(var j =0; j{ + console.log(error); + }); + } + + addNewContactUs(){ + console.log("Calling addNewContactUs"); + let selectedApplication = this.selectedApp; + this.newContactUs.appId = selectedApplication.value; + this.newContactUs.appName = selectedApplication.title; + console.log("newContactUsObj ",this.newContactUs); + this.contactUsService.addContactUs(this.newContactUs) + .subscribe( _data => { + this.result = _data; + console.log("addContactUs response :: ", _data); + this.contactUsList.push(this.newContactUs); + },error =>{ + console.log(error); + }); + } + + editContactUs(contactObj: any){ + + var contactUsObj={ + appId:contactObj.appId, + appName:contactObj.appName, + description:contactObj.description, + contactName:contactObj.contactName, + contactEmail:contactObj.contactEmail, + url:contactObj.url, + }; + + this.contactUsService.modifyContactUs(contactUsObj) + .subscribe( _data => { + this.result = _data; + console.log("editContactUsFun response :: ", _data); + this.showEdit=false; + },error =>{ + console.log(error); + }); + } + + delContactUs(appObj: any){ + this.contactUsService.removeContactUs(appObj.appId) + .subscribe( _data => { + this.result = _data; + console.log("delContactUsFun response :: ", _data); + this.contactUsList.splice(appObj, 1); + },error =>{ + console.log(error); + }); + } + +} 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 new file mode 100644 index 00000000..5930c382 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.html @@ -0,0 +1,163 @@ + +
+
+

Contact Us

+
+ +
+
+
+
+ + To report an issue with ECOMP Portal, open a ticket at the + User Self Help system. +
+
+ +
+ + To give feedback to the ECOMP Portal team, send email to + {{portalInfo_Address}}. +
+
+ +
+ + To learn more about ECOMP Portal, visit the + ECOMP Portal wiki (may need to request access). +
+
+ + +
Application Functions +
+
+ + + + + + + + + + + + + + + + + + + + + +
Category {{element.category}} + ECOMP Functions {{element.functions}} ECOMP Applications + + {{element.app_Name}} + +
+
+

+ + +
+
All Applications

+
+
+
+
+
+ {{rowData.app_name}} +    + + +    + + + + + +
+
+
+ + No application information is available. Please use the links above to contact the ECOMP Portal team. + +
+
+ + + + + + + + + + + + + + + + + + + + + +
Contact:{{rowData.contact_name}}
Email:{{rowData.contact_email}}
Info URL:{{rowData.url_Info}}
Description:{{rowData.desc}}
Get access:Click for application and role information
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file 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 new file mode 100644 index 00000000..b3fb8d6a --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.scss @@ -0,0 +1,74 @@ + +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2017 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============================================ + * + * + */ +.w-ecomp-contactUs-home .contactUs-txt { + font-weight: 400; + color: #666; + font-size: 15px; + font-family: Omnes-ECOMP-W02-Medium,Arial; + margin: 10px; +} + +.w-ecomp-contactUs-home .contactUs-home-container .contactUs-general-div { + margin: auto!important; + padding-top: 15px; + padding-bottom: 15px; + margin-top: 0; + margin-right: 0; + margin-left: 0; + margin-bottom: 0; + width: 1170px; +} + +.w-ecomp-contactUs-home .w-ecomp-main-view-title { + font-family: Omnes-ECOMP-W02,Arial; + font-size: 20px; +} + +button#edit-button-contact-us { + float: right; +} + +.container th{ + padding-bottom: 15px; + font-weight: bold; +} + +.w-ecomp-contactUs-home .contactUs-collapsible-panel { + margin: auto; +} diff --git a/portal-FE-common/src/app/pages/contact-us/contact-us.component.spec.ts b/portal-FE-common/src/app/pages/contact-us/contact-us.component.spec.ts new file mode 100644 index 00000000..db77e078 --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.spec.ts @@ -0,0 +1,63 @@ +/*- + * ============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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ContactUsComponent } from './contact-us.component'; + +describe('ContactUsComponent', () => { + let component: ContactUsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ContactUsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ContactUsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); 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 new file mode 100644 index 00000000..d58733bd --- /dev/null +++ b/portal-FE-common/src/app/pages/contact-us/contact-us.component.ts @@ -0,0 +1,196 @@ +/*- + * ============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 { Component, OnInit, ViewChild, Input } from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; +import { MatSort, MatPaginator } from '@angular/material'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { ContactUsService } from '../../shared/services/index'; +import { ContactUsManageComponent } from './contact-us-manage/contact-us-manage.component'; + +@Component({ + selector: 'app-contact-us', + templateUrl: './contact-us.component.html', + styleUrls: ['./contact-us.component.scss'] +}) +export class ContactUsComponent implements OnInit { + + contactUsList: Array = []; + appTable: Array = []; + functionalTableData: Array = []; + + ush_TicketInfoUrl: string; + portalInfo_Address: string; + feedback_Url: string; + showUp: boolean = true; + showDown: boolean = false; + + result: any; + isEditMode: boolean = false; + displayedColumns: string[] = ['category', 'eCOMPFunctions','eCOMPApplications']; + dataSource = new MatTableDataSource(this.functionalTableData); + @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor(public contactUsService: ContactUsService, public ngbModal: NgbModal) { } + + ngOnInit() { + this.appTable=[]; + this.functionalTableData=[]; + + this.getContactUSPortalDetails(); + this.updateContactUsTable(); + this.getAppCategoryFunctions() + } + + getContactUSPortalDetails(){ + console.log("getContactUSPortalDetails called..."); + this.contactUsService.getContactUSPortalDetails() + .subscribe( _data => { + this.result = _data; + console.log("getContactUSPortalDetails Data :: ", _data); + if (this.result.response == null || this.result.response == 'undefined') { + console.log('ContactUsService::getContactUSPortalDetails Failed: Result or result.data is null'); + }else{ + var source = JSON.parse(this.result.response); + this.ush_TicketInfoUrl = source.ush_ticket_url; + this.portalInfo_Address = source.feedback_email_address; + this.feedback_Url = source.portal_info_url; + } + },error =>{ + console.log(error); + }); + } + + updateContactUsTable(){ + console.log("updateContactUsTable called..."); + this.contactUsService.getAppsAndContacts() + .subscribe( _data => { + this.result = _data; + console.log("getAppsAndContacts Data :: ", _data); + if (this.result.response == null || this.result.response == 'undefined') { + console.log('ContactUsService::getAppsAndContacts Failed: Result or result.data is null'); + }else{ + var tableData=[]; + var source = this.result.response; + for(var i=0; i{ + console.log(error); + }); + } + + getAppCategoryFunctions(){ + console.log("getAppCategoryFunctions called"); + this.contactUsService.getAppCategoryFunctions() + .subscribe( _data => { + this.result = _data; + console.log("getAppCategoryFunctions Data :: ", _data); + if (this.result.response == null || this.result.response == 'undefined') { + console.log('ContactUsService::getAppCategoryFunctions Failed: Result or result.data is null'); + }else{ + var tablefunctionalData=[]; + var source = this.result.response; + for(var i=0;i{ + console.log(error); + }); + } + + populateTableData(functionalTableData: Array){ + this.dataSource = new MatTableDataSource(functionalTableData); + this.dataSource.sort = this.sort; + this.dataSource.paginator = this.paginator; + } + + editContactUsModal() { + const modalRef = this.ngbModal.open(ContactUsManageComponent, { size: 'lg' }); + } + + showApplicationInfo(appId: any){ + console.log("AppId Contact US...",appId); + let appInfoDiv = document.getElementById('collapse'+appId); + let uparrowDiv = document.getElementById('arrowup'+appId); + let downarrowDiv = document.getElementById('arrowdown'+appId); + + if(!appInfoDiv.getAttribute('hidden')){ + appInfoDiv.setAttribute("hidden","true"); + uparrowDiv.setAttribute("hidden", "true"); + downarrowDiv.removeAttribute("hidden"); + }else if(appInfoDiv.getAttribute('hidden')){ + appInfoDiv.removeAttribute("hidden"); + uparrowDiv.removeAttribute("hidden"); + downarrowDiv.setAttribute("hidden","true"); + } + } + + goGetAccess(app_name: any){ + console.log("Get Access :: goGetAccess method implemetation is pending... appName : ",app_name); + } + +} diff --git a/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts b/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts new file mode 100644 index 00000000..03d55d05 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/contact-us/contact-us.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 { ContactUsService } from './contact-us.service'; + +describe('ContactUsService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + const service: ContactUsService = TestBed.get(ContactUsService); + expect(service).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.ts b/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.ts new file mode 100644 index 00000000..c46abab2 --- /dev/null +++ b/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.ts @@ -0,0 +1,96 @@ +/*- + * ============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'; +import * as uuid from 'uuid'; + +@Injectable({ + providedIn: 'root' +}) +export class ContactUsService { + + api = environment.api; + resp:string; + headerParams = {'X-Widgets-Type': 'all', 'X-ECOMP-RequestID': uuid.v4() }; + + constructor(private http: HttpClient) { } + + getListOfApp(): Observable{ + let getListOfAppURL = this.api.availableApps; + return this.http.get(getListOfAppURL , { withCredentials: true } ); + } + + getContactUs(): Observable{ + let getContactUsURL = this.api.getContactUS; + return this.http.get(getContactUsURL , { withCredentials: true } ); + } + + getAppsAndContacts(): Observable{ + let getAppsAndContactsURL = this.api.getAppsAndContacts; + return this.http.get(getAppsAndContactsURL , { withCredentials: true } ); + } + + getContactUSPortalDetails(): Observable{ + let getContactUSPortalDetailsURL = this.api.getContactUSPortalDetails; + return this.http.get(getContactUSPortalDetailsURL , { withCredentials: true } ); + } + + getAppCategoryFunctions(): Observable{ + let getAppCategoryFunctionsURL = this.api.getAppCategoryFunctions; + return this.http.get(getAppCategoryFunctionsURL , { withCredentials: true } ); + } + + addContactUs(newContactUs: any): Observable{ + let addContactUsURL = this.api.saveContactUS; + return this.http.post(addContactUsURL, newContactUs, { withCredentials: true }); + } + + modifyContactUs(contactUsObj: any): Observable{ + let modifyContactUsURL = this.api.saveContactUS; + return this.http.post(modifyContactUsURL, contactUsObj, { withCredentials: true }); + } + + removeContactUs(id: any): Observable{ + let removeContactUsURL = this.api.deleteContactUS + '/' + id; + return this.http.post(removeContactUsURL, { withCredentials: true }); + } + +} -- 2.16.6