From d23e700cde07aaab62c69db9d9cdec2af3ba0b79 Mon Sep 17 00:00:00 2001 From: Muni Mohan Kunchi Date: Thu, 6 Feb 2020 15:06:17 -0500 Subject: Adding missed sdk files Adding missed sdk files Issue-ID: PORTAL-830 Signed-off-by: Muni Mohan Kunchi Change-Id: I784f49cb3cf724c4bacd3d4aaf5ae444fca5ba35 --- .../src/main/webapp/assets/images/spinner.gif | Bin 0 -> 4178 bytes ecomp-sdk/epsdk-app-os/src/main/webapp/spinner.gif | Bin 0 -> 4178 bytes .../confirmation-modal.component.html | 52 ++++ .../confirmation-modal.component.scss | 38 +++ .../confirmation-modal.component.spec.ts | 62 +++++ .../confirmation-modal.component.ts | 55 ++++ .../src/app/pages/admin/menus/menus.service.ts | 139 ++++++++++ .../admin/menus/new-menu/new-menu.component.html | 137 +++++++++ .../admin/menus/new-menu/new-menu.component.scss | 71 +++++ .../menus/new-menu/new-menu.component.spec.ts | 63 +++++ .../admin/menus/new-menu/new-menu.component.ts | 275 ++++++++++++++++++ .../new-role-function.component.html | 101 +++++++ .../new-role-function.component.scss | 40 +++ .../new-role-function.component.spec.ts | 62 +++++ .../new-role-function.component.ts | 174 ++++++++++++ .../admin/role-functions/role-functions.service.ts | 34 +++ .../admin/roles/new-role/new-role.component.html | 106 +++++++ .../admin/roles/new-role/new-role.component.scss | 74 +++++ .../roles/new-role/new-role.component.spec.ts | 63 +++++ .../admin/roles/new-role/new-role.component.ts | 250 +++++++++++++++++ .../pages/ext/profile/search/search.component.html | 99 +++++++ .../pages/ext/profile/search/search.component.scss | 69 +++++ .../ext/profile/search/search.component.spec.ts | 63 +++++ .../pages/ext/profile/search/search.component.ts | 129 +++++++++ .../app/pages/ext/profile/search/search.module.ts | 11 + .../app/pages/ext/profile/self/self.component.html | 227 +++++++++++++++ .../app/pages/ext/profile/self/self.component.scss | 78 ++++++ .../pages/ext/profile/self/self.component.spec.ts | 63 +++++ .../app/pages/ext/profile/self/self.component.ts | 306 +++++++++++++++++++++ .../app/shared/interceptors/header-interceptor.ts | 70 +++++ .../webapp/ngapp/src/app/shared/utils/utils.js | 43 +++ .../webapp/ngapp/src/assets/images/spinner.gif | Bin 0 -> 4178 bytes .../src/main/webapp/ngapp/src/styles/_spinner.scss | 67 +++++ 33 files changed, 3021 insertions(+) create mode 100644 ecomp-sdk/epsdk-app-os/src/main/webapp/assets/images/spinner.gif create mode 100644 ecomp-sdk/epsdk-app-os/src/main/webapp/spinner.gif create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.html create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.scss create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.html create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.scss create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.html create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.scss create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.html create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.scss create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.html create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.scss create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.module.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.scss create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/utils/utils.js create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/assets/images/spinner.gif create mode 100644 ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/styles/_spinner.scss diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/assets/images/spinner.gif b/ecomp-sdk/epsdk-app-os/src/main/webapp/assets/images/spinner.gif new file mode 100644 index 00000000..c97ec6ea Binary files /dev/null and b/ecomp-sdk/epsdk-app-os/src/main/webapp/assets/images/spinner.gif differ diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/spinner.gif b/ecomp-sdk/epsdk-app-os/src/main/webapp/spinner.gif new file mode 100644 index 00000000..c97ec6ea Binary files /dev/null and b/ecomp-sdk/epsdk-app-os/src/main/webapp/spinner.gif differ diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.html new file mode 100644 index 00000000..64b6bbd7 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.html @@ -0,0 +1,52 @@ + + +
+ + + +
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.scss new file mode 100644 index 00000000..3c1a547b --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.scss @@ -0,0 +1,38 @@ +/*- + * ============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 '../../pages/pages.component'; \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.spec.ts new file mode 100644 index 00000000..bc3516e8 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.spec.ts @@ -0,0 +1,62 @@ +/*- + * ============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 { ConfirmationModalComponent } from './confirmation-modal.component'; + +describe('ConfirmationModalComponent', () => { + let component: ConfirmationModalComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfirmationModalComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmationModalComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.ts new file mode 100644 index 00000000..774cff23 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/modals/confirmation-modal/confirmation-modal.component.ts @@ -0,0 +1,55 @@ +/*- + * ============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 { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +@Component({ + selector: 'app-confirmation-modal', + templateUrl: './confirmation-modal.component.html', + styleUrls: ['./confirmation-modal.component.scss'] +}) +export class ConfirmationModalComponent implements OnInit { + + @Input() title: string; + @Input() message: string; + constructor(public activeModal: NgbActiveModal) { } + + ngOnInit() { + } + +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts new file mode 100644 index 00000000..1b22cf28 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts @@ -0,0 +1,139 @@ + +/* + * ============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 { RdpCrudInterface } from 'portalsdk-tag-lib'; +import { environment } from 'src/environments/environment'; +import { AdminService } from '../admin.service'; + +@Injectable({ + providedIn: 'root' +}) +export class MenusService implements RdpCrudInterface { + + parentDataList: any; + constructor(private http: HttpClient, private adminService: AdminService) { + + } + + + menu = { + action: null, + active: false, + activeAsString: "false", + auditTrail: null, + auditUserId: null, + childMenus: [], + created: null, + createdId: null, + externalUrl: null, + functionCd: null, + id: null, + imageSrc: null, + label: null, + menuLevel: null, + menuSetCode: null, + modified: null, + modifiedId: null, + parentId: null, + parentIdAsString: null, + parentMenu: null, + queryString: null, + rowNum: null, + separator: false, + separatorAsString: false, + servlet: null, + sortOrder: null, + target: null + }; + + add(data: any) { + console.log("Add method is getting called from AppServie data:: ", data); + } + + + update(data: any) { + data.active = this.updateStatus(data.active); + data.separator = this.updateStatus(data.separator); + let keys = Object.keys(data); + keys.forEach(element => { + if (data[element] != null || data[element] != undefined) { + if (element == 'parentId') { + this.menu[element] = 1; + } else { + this.menu[element] = data[element]; + } + } + }); + let result = { availableFnMenuItem: this.menu }; + let postData = JSON.stringify(result); + console.log("postData >>>>>>", postData); + this.adminService.updateFnMenuItem(postData) + .subscribe(_data => { + console.log("Response : ", _data); + }, error => { + console.log("Error : ", error); + }); + + } + + delete(data: any) { + console.log("Delete method is getting called from AppServie data::>> " + JSON.stringify(data)); + console.log(data.active); + data.active = this.updateStatus(data.active); + data.separator = this.updateStatus(data.separator); + let result = { availableFnMenuItem: data }; + this.adminService.deleteMenu(result).subscribe(response => { + console.log("Response ", response); + }) + } + + private updateStatus(data) { + if (data == 'N') { + return false; + } else { + return true; + } + } + + get(data: any) { + console.log("get method is getting called from AppServie data:: ", data); + } +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.html new file mode 100644 index 00000000..6a5426a8 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.html @@ -0,0 +1,137 @@ + + +
+ + + + + + + +
+ \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.scss new file mode 100644 index 00000000..a8b5f966 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.scss @@ -0,0 +1,71 @@ +/* + * ============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============================================ + * + * + */ + +::ng-deep .modal-dialog { + max-width: 1200px; + width: 883px; + overflow-x: auto; + overflow-y: auto; +} + +table { + width: 100%; +} + +body { + font-family: Roboto, Arial, sans-serif; + margin: 0; +} + +.elementsContainer{ + display: inline-flex; +} + +.groupItem{ + margin-right: 11px; + margin-bottom: 10px; +} + +.form-field{ + height: 30px; + width: 198px +} + +.item-label{ + margin-bottom: 1px; +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts new file mode 100644 index 00000000..860c0169 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts @@ -0,0 +1,63 @@ +/* + * ============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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NewMenuComponent } from './new-menu.component'; + +describe('NewMenuComponent', () => { + let component: NewMenuComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NewMenuComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NewMenuComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.ts new file mode 100644 index 00000000..4acf2252 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.ts @@ -0,0 +1,275 @@ +/* + * ============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 { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { AdminService } from '../../admin.service'; +import { SidebarComponent } from 'src/app/layout/components/sidebar/sidebar.component'; +import { Router } from '@angular/router'; +import { SidebarService } from 'src/app/shared/services'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { CookieService } from 'ngx-cookie-service'; + +@Component({ + selector: 'app-new-menu', + templateUrl: './new-menu.component.html', + styleUrls: ['./new-menu.component.scss'] +}) +export class NewMenuComponent implements OnInit { + + menu = { + action: null, + active: false, + activeAsString: "false", + auditTrail: null, + auditUserId: null, + childMenus: [], + created: null, + createdId: null, + externalUrl: null, + functionCd: null, + id: null, + imageSrc: null, + label: null, + menuLevel: null, + menuSetCode: null, + modified: null, + modifiedId: null, + parentId: null, + parentIdAsString: null, + parentMenu: null, + queryString: null, + rowNum: null, + separator: false, + separatorAsString: false, + servlet: null, + sortOrder: null, + target: null + } + showSpinner: boolean; + result: any; + //menu: any; + @Input() selectedMenu: any; + @Input() isEditMode: boolean; + @Output() passEntry: EventEmitter = new EventEmitter(); + + statusOptions = [ + {index: 0, value: 'true', title: 'Y'}, + {index: 1, value: 'false', title: 'N'} + ]; + selectedValue = this.statusOptions[0]; + separator = { + availableOptions:[ + {value: 'true', name: 'Y'}, + {value: 'false', name: 'N'} + ], + selectedOption: {value: 'true', name: 'Y'} + } + + activeStatusOptions = [ + {index: 0, value: 'true', title: 'Y'}, + {index: 1, value: 'false', title: 'N'} + ]; + activeSelectedValue = this.activeStatusOptions[0]; + + separatorStatusOptions = [ + {index: 0, value: 'true', title: 'Y'}, + {index: 1, value: 'false', title: 'N'} + ]; + separatorSelectedValue = this.separatorStatusOptions[1]; + + active = { + availableOptions:[ + {value: 'true', name: 'Y'}, + {value: 'false', name: 'N'} + ], + selectedOption: {value: 'true', name: 'Y'} + }; + + functionCDselectData = []; + parentListSelectData = []; + childListSelectData = []; + + constructor(public adminService: AdminService, public activeModal: NgbActiveModal, + public ngmodel: NgbModal, public router: Router, public sidebarService: SidebarService,public cookieService:CookieService) { } + + ngOnInit() { + if(this.selectedMenu){ + this.menu = this.selectedMenu; + }else{ + this.menu.menuSetCode='APP'; + } + //console.log("selected menu >>>>",this.menu); + this.getFunctionCDselectData(); + this.getParentData(); + } + + getParentData(){ + this.showSpinner = true; + this.adminService.getParentData() + .subscribe( _data => { + //console.log("getParentData :: _data ",_data); + this.result = _data; + if(_data){ + this.parentListSelectData= _data; // data from server + let menuItems = this.parentListSelectData; + var heirarchicalMenuItems = []; + var children = []; + for ( var i=0; i { + this.showSpinner = false; + console.log(error); + }); + } + + sortItems(prop){ + return function(a, b) { + if (a[prop] > b[prop]) { + return 1; + } else if (a[prop] < b[prop]) { + return -1; + } + return 0; + } + } + + getParentLabel(parentId, parentListSelectData){ + var element; + element = parentListSelectData[0]; + for (var i=0; i>>>>>",postData); + this.adminService.updateFnMenuItem(postData) + .subscribe( _data => { + this.result = _data; + this.passEntry.emit(this.result); + this.ngmodel.dismissAll(); + }, error => { + this.showSpinner = false; + console.log(error); + this.openConfirmationModal("Error",error); + }); + this.getLeftMenuItems(); + } + + } + + getLeftMenuItems(){ + //console.log("getLeftMenuItems called after update menu"); + let sidebarComponent = new SidebarComponent(this.router, this.sidebarService,this.cookieService); + sidebarComponent.ngOnInit(); + } + + getFunctionCDselectData = function(){ + this.adminService.getFunctionCdList() + .subscribe( _data => { + this.result = _data; + if(_data){ + this.functionCDselectData = _data; + } + }, error => { + this.showSpinner = false; + console.log(error); + this.openConfirmationModal("","Function Code Data not available !"); + }); + } + + openConfirmationModal(_title: string, _message: string) { + const modalInfoRef = this.ngmodel.open(ConfirmationModalComponent); + modalInfoRef.componentInstance.title = _title; + modalInfoRef.componentInstance.message = _message; + } + +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.html new file mode 100644 index 00000000..888deca8 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.html @@ -0,0 +1,101 @@ + + +
+ + + +
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.scss new file mode 100644 index 00000000..56cb1aa3 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.scss @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal - SDK + * =================================================================== + * 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============================================ + * + * + */ + .ecomp-spinner{ + z-index: 9999; +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts new file mode 100644 index 00000000..8ea56afc --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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 { NewRoleFunctionComponent } from './new-role-function.component'; + +describe('NewRoleFunctionComponent', () => { + let component: NewRoleFunctionComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NewRoleFunctionComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NewRoleFunctionComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.ts new file mode 100644 index 00000000..82d353d1 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.ts @@ -0,0 +1,174 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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, Output, EventEmitter } from '@angular/core'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; +import { RoleFunction } from '../role-function'; +import { HttpClient } from '@angular/common/http'; +import { AdminService } from '../../admin.service'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; + +@Component({ + selector: 'app-new-role-function', + templateUrl: './new-role-function.component.html', + styleUrls: ['./new-role-function.component.scss'] +}) +export class NewRoleFunctionComponent implements OnInit { + + @Input() title: string; + @Input() appId: any; + @Input() dialogState: number; + @Input() currentRoleFunctions: any; + @Input() editRoleFunction: RoleFunction; + @Output() passBackRoleFunctionPopup: EventEmitter = new EventEmitter(); + roleFunction: RoleFunction; + otherTypeValue: string; + typeOptions: string[] = ['menu', 'url', 'other']; + api = ''; + isEditing: any; + editDisable: boolean; + showSpinner: boolean; + selectedType: string; + createOrUpdate: string; + constructor(public adminService: AdminService, public activeModal: NgbActiveModal, public ngbModal: NgbModal, public http: HttpClient) { } + + ngOnInit() { + this.createOrUpdate = 'create'; + this.selectedType = 'menu'; + this.roleFunction = new RoleFunction(this.selectedType, '', '*', ''); + this.otherTypeValue = ''; + if (this.editRoleFunction) { + this.createOrUpdate = 'update'; + this.editDisable = true; + if (this.editRoleFunction.type !== 'menu' && this.editRoleFunction.type !== 'url') { + this.selectedType = 'other'; + this.otherTypeValue = this.editRoleFunction.type; + }else{ + this.selectedType = this.editRoleFunction.type; + } + this.roleFunction = new RoleFunction(this.editRoleFunction.type, this.editRoleFunction.code, this.editRoleFunction.action, this.editRoleFunction.name); + } + } + + saveRoleFunction() { + if (/[^a-zA-Z0-9\-\.\_]/.test(this.roleFunction.type)) { + this.openConfirmationModal('Confirmation', 'Type can only contain alphanumeric characters, dots(.) and underscores(_)'); + return; + } + if (this.roleFunction.action !== '*' && /[^a-zA-Z0-9\-\.\_]/.test(this.roleFunction.action)) { + this.openConfirmationModal('Confirmation', 'Action can only contain alphanumeric characters, hyphens(-), dots(.) and underscores(_) and single asterisk character(*)'); + return; + } + if (/[^a-zA-Z0-9\-\:\_\./*]/.test(this.roleFunction.code)) { + this.openConfirmationModal('Confirmation', 'Instance can only contain alphanumeric characters, hyphens(-), dots(.), colons(:), forwardSlash(/) , asterisk(*) and underscores(_)'); + return; + } + const modalInfoRef = this.ngbModal.open(InformationModalComponent); + modalInfoRef.componentInstance.title = 'Confirmation'; + modalInfoRef.componentInstance.message = 'You are about to ' + this.createOrUpdate + ' the role function ' + this.roleFunction.name + '. Do you want to continue?'; + modalInfoRef.result.then((_res) => { + if (_res === 'Ok') { + this.showSpinner = true; + var exists = false, x; + for (x in this.currentRoleFunctions) { + if (this.currentRoleFunctions[x].type == this.roleFunction.type + && this.currentRoleFunctions[x].code == this.roleFunction.code + && this.currentRoleFunctions[x].action == this.roleFunction.action + && this.currentRoleFunctions[x].name == this.roleFunction.name) { + this.openConfirmationModal('Confirmation', "Role Function already exist."); + exists = true; + this.showSpinner = false; + break; + } + if (!this.editDisable) { + if (this.currentRoleFunctions[x].type == this.roleFunction.type + && this.currentRoleFunctions[x].code == this.roleFunction.code + && this.currentRoleFunctions[x].action == this.roleFunction.action + ) { + this.openConfirmationModal('Confirmation', "Please make sure code, type and action is unique. Please create a role function with a different code or type or action to proceed."); + exists = true; + this.showSpinner = false; + break; + } + } + } + + if (this.selectedType === 'other'){ + this.roleFunction.type = this.otherTypeValue; + }else{ + this.roleFunction.type = this.selectedType; + } + + if (!exists && this.roleFunction.name.trim() != '' && this.roleFunction.code.trim() != '') { + var postData = this.roleFunction; + console.log("saveRoleFunction post data :: ",postData); + this.adminService.saveRoleFunction(JSON.stringify(postData)) + .subscribe(_data => { + this.showSpinner = false; + console.log("saveRoleFunction response",_data); + if (this.editRoleFunction) { + this.editRoleFunction.name = this.roleFunction.name; + this.passBackRoleFunctionPopup.emit(this.editRoleFunction); + } else{ + this.passBackRoleFunctionPopup.emit(this.roleFunction); + } + if (this.editRoleFunction) { + this.openConfirmationModal('Success', "Role function updated successfully."); + }else{ + this.openConfirmationModal('Success', "Role function created successfully."); + } + }, error =>{ + console.log(error); + this.showSpinner = false; + this.openConfirmationModal('Error', error.message); + }); + } + } + }, (_dismiss) => { + + }) + } + + + openConfirmationModal(_title: string, _message: string) { + const modalInfoRef = this.ngbModal.open(ConfirmationModalComponent); + modalInfoRef.componentInstance.title = _title; + modalInfoRef.componentInstance.message = _message; + } + +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts new file mode 100644 index 00000000..9d931d1d --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts @@ -0,0 +1,34 @@ +import { Injectable } from '@angular/core'; +import { RdpCrudInterface } from 'portalsdk-tag-lib'; +import { AdminService } from '../admin.service'; + +@Injectable({ + providedIn: 'root' +}) +export class RoleFunctionsService implements RdpCrudInterface { + + constructor(private adminService: AdminService) { } + + add(data: any) { + console.log("Add method is getting called from AppServie data:: ", data); + } + + + update(data: any) { + console.log("Update method is getting called from MenusService data:: ", data); + this.adminService.saveRoleFunction(data).subscribe(response => { + console.log(response); + }) + } + + delete(data: any) { + console.log("Delete method is getting called from AppServie data::>> " + JSON.stringify(data)); + this.adminService.deleteRoleFunction(data).subscribe(response => { + console.log("Repsonse : ",response); + }) + } + + get(data: any) { + console.log("get method is getting called from AppServie data:: ", data); + } +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.html new file mode 100644 index 00000000..f3a7f8ea --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.html @@ -0,0 +1,106 @@ + +
+ + + + + + + +
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.scss new file mode 100644 index 00000000..972094c7 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.scss @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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: 700px; + width: 700px; + overflow-x: auto; + overflow-y: auto; +} + +::ng-deep .mat-column-roleFunctionName { + width: 38em !important; +} + + +.role-properties-main input[type="text"] { + width: 18em; +} + +.role-properties-main .role-name{ + margin-right: 35px; +} + +.elementsDiv{ + display: inline-flex; +} + +.role-functions-title{ + margin-top: 2em; +} + +.manageRoleFunction{ + margin-top: 2em; +} + +.rolefunctionTable{ + overflow-y: auto; + height: 440px; +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts new file mode 100644 index 00000000..2049b859 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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 { NewRoleComponent } from './new-role.component'; + +describe('NewRoleComponent', () => { + let component: NewRoleComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NewRoleComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NewRoleComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.ts new file mode 100644 index 00000000..6b1470fa --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.ts @@ -0,0 +1,250 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * 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, Output, EventEmitter, ViewChild } from '@angular/core'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { AdminService } from '../../admin.service'; +import { UserService } from 'src/app/shared/services/user/user.service'; +import { MatSort } from '@angular/material/sort'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; + + +@Component({ + selector: 'app-new-role', + templateUrl: './new-role.component.html', + styleUrls: ['./new-role.component.scss'] +}) +export class NewRoleComponent implements OnInit { + + showSpinner: boolean; + result: any; + @Input() role: any; + @Input() isEditMode: boolean; + @Input() availableRoles : any; + @Input() ociavailableRoleFunctions: any; + roleFunctionTableHeaders: Array = []; + roleFunctions: Array = []; + roleFunctionsLenght: any; + finalSelectedRoleFunctions: any; + availableRoleFunctions: any; + @Output() passEntry: EventEmitter = new EventEmitter(); + @ViewChild(MatPaginator, {}) paginator: MatPaginator; + @ViewChild(MatSort, {}) sort: MatSort; + roleFunctionDataSource = new MatTableDataSource(this.roleFunctions); + + constructor(public adminService:AdminService, public userService: UserService, public activeModal: NgbActiveModal, public ngbModal: NgbModal) { } + + ngOnInit() { + this.roleFunctionTableHeaders = ["roleFunctionName","active"]; + this.finalSelectedRoleFunctions = []; + this.availableRoleFunctions = []; + if(this.isEditMode && this.ociavailableRoleFunctions && this.ociavailableRoleFunctions.length > 0){ + this.availableRoleFunctions = this.setSelectedRoleFucntions(this.ociavailableRoleFunctions); + this.populateTableData(this.availableRoleFunctions) + } + } + + setSelectedRoleFucntions(ociavailableRoleFunctions: any) { + for (var i = 0; i < this.ociavailableRoleFunctions.length; i++) { + var availableRoleFunction = this.ociavailableRoleFunctions[i]; + availableRoleFunction['selected'] = false; + for (var j = 0; j < this.role.roleFunctions.length; j++) { + if (availableRoleFunction.code === this.role.roleFunctions[j].code + && availableRoleFunction.type === this.role.roleFunctions[j].type + && availableRoleFunction.action === this.role.roleFunctions[j].action) { + availableRoleFunction.selected = true; + } + } + this.availableRoleFunctions.push(availableRoleFunction); + } + return this.availableRoleFunctions; + } + + + toggleRoleFunction(_element) { + if (this.ociavailableRoleFunctions) { + for (var i = 0; i < this.ociavailableRoleFunctions.length; i++) { + var availableRoleFunction = this.ociavailableRoleFunctions[i]; + if (availableRoleFunction.selected && !this.finalSelectedRoleFunctions.includes(availableRoleFunction)) { + this.finalSelectedRoleFunctions.push(availableRoleFunction); + } + } + } + if (!_element.selected) { + for (var i = 0; i < this.finalSelectedRoleFunctions.length; i++) { + var availableRoleFunction = this.finalSelectedRoleFunctions[i]; + if (availableRoleFunction.code == _element.code + && availableRoleFunction.type == _element.type + && availableRoleFunction.action == _element.action) { + this.finalSelectedRoleFunctions.splice(i, 1); + } + } + } + } + + delRoleFunctionConfirmPopUp(roleFunction: any, roleId: any){ + const modalRef = this.ngbModal.open(InformationModalComponent); + modalRef.componentInstance.title = "Confirmation"; + modalRef.componentInstance.message = 'You are about to delete this Role Function : ' + roleFunction.name+ '. Click OK to continue.'; + modalRef.result.then((result) => { + if (result === 'Ok') { + let temproleFunctions = this.role.roleFunctions; + let index = 0; + for(let i=0; i { + this.result = _data + this.passEntry.emit(this.result); + }, error =>{ + this.openConfirmationModal('Error', error.message); + }); + } + }, (resut) => { + this.openConfirmationModal('Error', resut); + return; + }) + } + + populateTableData(roleFunctionsList: any){ + this.roleFunctionDataSource = new MatTableDataSource(roleFunctionsList); + this.roleFunctionDataSource.sort = this.sort; + this.roleFunctionDataSource.paginator = this.paginator; + } + + //Add Or Update Account. + saveChanges(){ + if(this.isEditMode){ + if (this.role.priority && this.role.priority != '' && isNaN(parseInt(this.role.priority))) { + let errorMsg = 'Priority must be an integer.'; + this.openConfirmationModal('Error', errorMsg); + } + //update the role object + this.showSpinner = true + this.role.roleFunctions = this.finalSelectedRoleFunctions; + let postData={ + role: this.role, + childRoles: this.role.childRoles, + roleFunctions : this.role.roleFunctions + }; + this.adminService.saveRole(postData, this.role.id) + .subscribe(_data => { + this.showSpinner = false; + this.result = _data + this.passEntry.emit(this.result); + this.ngbModal.dismissAll(); + }, error =>{ + this.openConfirmationModal('Error', error.message); + }); + }else{ + //create new Role Object + if (this.role.priority && this.role.priority != '' && isNaN(parseInt(this.role.priority))) { + let errorMsg = 'Priority must be an integer.'; + this.openConfirmationModal('Error', errorMsg); + } + let newRoleObj = { + 'id':null, + 'created':null, + 'modified':null, + 'createdId':null, + 'modifiedId':null, + 'rowNum':null, + 'auditUserId':null, + 'auditTrail':null, + 'name':this.role.name, + 'active':true, + 'priority':this.role.priority, + 'roleFunctions':null, + 'childRoles':null, + 'toggleActiveAltText':"Click to Activate Role ", + 'toggleActiveImage':" / static fusion images inactive.png ", + 'editUrl':" role.htm ? role_id = null", + }; + if(this.isRoleAlreadyExist(this.role.name)){ + //msg Role already exit + let errorMsg = "Role Name " + this.role.name +" is already present." + this.openConfirmationModal('Error', errorMsg); + }else{ + this.showSpinner = true + newRoleObj.childRoles = []; + newRoleObj.roleFunctions = []; + let postData={ + role: newRoleObj, + childRoles: newRoleObj.childRoles, + roleFunctions : newRoleObj.roleFunctions + }; + this.adminService.saveRole(postData, newRoleObj.id) + .subscribe(_data => { + this.showSpinner = false; + this.result = _data + this.passEntry.emit(this.result); + this.ngbModal.dismissAll(); + }, error =>{ + this.openConfirmationModal('Error', error.message); + }); + } + } + } + + isRoleAlreadyExist(currentRoleName: any){ + let roles = this.availableRoles; + if(roles && roles.length > 0){ + for(let i=0; i +
+
+

Profile Search

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
User ID {{rowData.id}} {{userHeaders[1]}} {{rowData.lastName}} {{userHeaders[2]}} {{rowData.firstName}} {{userHeaders[3]}} {{rowData.email}} {{userHeaders[4]}} {{rowData.orgUserId}} {{userHeaders[5]}} {{rowData.orgManagerUserId}} {{userHeaders[6]}} + + + + {{userHeaders[7]}} + +
+ + +
+
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.scss new file mode 100644 index 00000000..f35a92a7 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.scss @@ -0,0 +1,69 @@ +/* + * ============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============================================ + * + * + */ + +table { + width: 100%; + } + + .mat-form-field { + font-size: 14px; + width: 100%; + } + + td, th { + width: 25%; + } + .mat-form-field[_ngcontent-c4] { + font-size: 14px; + width: 20%; + float: right; + } + + /*td.mat-cell, td.mat-footer-cell{ + padding: 0; + border-bottom-width: 1px; + border-bottom-style: solid; + border-right-style: solid; + border-right-color: rgba(0,0,0,.12); + border-right-width: 1px; + } +*/ + +td[_ngcontent-c4], th[_ngcontent-c4] { + width: 15%; +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts new file mode 100644 index 00000000..094e52b2 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.spec.ts @@ -0,0 +1,63 @@ +/* + * ============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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SearchComponent } from './search.component'; + +describe('SearchComponent', () => { + let component: SearchComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SearchComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SearchComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.ts new file mode 100644 index 00000000..7bebd04c --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.component.ts @@ -0,0 +1,129 @@ +/* + * ============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 { Component, OnInit, ViewChild } from '@angular/core'; +import { ProfileService } from '../profile.service'; +import { MatTableDataSource } from '@angular/material/table'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; + +@Component({ + selector: 'app-search', + templateUrl: './search.component.html', + styleUrls: ['./search.component.scss'] +}) +export class SearchComponent implements OnInit { + + showSpinner:boolean =false; + response: any; + result: any; + profileList:any; + userHeaders = ["User ID","Last Name","First Name","Email","ORG ID","Manager ORG ID","Edit","Active?"]; + constructor(public profileservice:ProfileService, public ngbModal: NgbModal) { } + dataSource: MatTableDataSource<[]>; + + @ViewChild(MatPaginator, {}) paginator: MatPaginator; + @ViewChild(MatSort, {}) sort: MatSort; + + + ngOnInit() { + this.getUsers(); + } + + getUsers(){ + this.showSpinner = true; + let response; + this.response = this.profileservice.getUserPagination(); + this.response.subscribe(data => { + response = data; + this.result = JSON.parse(response.data); + this.profileList = JSON.parse(this.result.profileList); + this.dataSource = new MatTableDataSource(this.profileList); + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; + this.showSpinner = false; + }); + } + + toggleUserActive(user){ + let activeOrInactive = (user.active) ? 'activate' : 'inactivate'; + let confirmationMsg = 'You are about to ' + activeOrInactive + ' the user ' + user.firstName +" "+user.lastName+ '. Do you want to continue?'; + const modalInfoRef = this.ngbModal.open(InformationModalComponent); + modalInfoRef.componentInstance.title = 'Confirmation'; + modalInfoRef.componentInstance.message = confirmationMsg; + modalInfoRef.result.then((_res) => { + if (_res === 'Ok') { + this.showSpinner = true; + this.profileservice.toggleProfileActive(user.id) + .subscribe( _data => { + this.result = _data; + this.openConfirmationModal("Success",'Record updated successfully.'); + this.showSpinner = false; + }, error => { + this.showSpinner = false; + console.log(error); + this.openConfirmationModal("Error",error); + }); + } else { + user.active = !user.active; + } + }, (result) => { + + }) + } + + applyFilter(filterValue: string) { + this.dataSource.filter = filterValue.trim().toLowerCase(); + } + + openConfirmationModal(_title: string, _message: string) { + const modalInfoRef = this.ngbModal.open(ConfirmationModalComponent); + modalInfoRef.componentInstance.title = _title; + modalInfoRef.componentInstance.message = _message; + } + + openInformationModal(_title: string, _message: string){ + const modalInfoRef = this.ngbModal.open(InformationModalComponent); + modalInfoRef.componentInstance.title = _title; + modalInfoRef.componentInstance.message = _message; + return modalInfoRef; + } +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.module.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.module.ts new file mode 100644 index 00000000..1574e028 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/search/search.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { SearchComponent } from './search.component'; + +@NgModule({ + declarations: [SearchComponent], + imports: [ + CommonModule + ] +}) +export class SearchModule { } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html new file mode 100644 index 00000000..c0611493 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html @@ -0,0 +1,227 @@ + +
+
+

Self Profile Detail

+

Please use Portal for access + management

+

Please edit the profile details below:

+
+
+
+
+ +
+ Last name is Required +
+
+
+ + +
+ First name is Required +
+
+
+   + + +
+
+ +   + + +
+
+
+
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + +
+ + +
+ + +
+ +
+ +
+
+ +
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+ + +
+ +
+ + States + + {{state.label}} + + +
+ +
+ + +
+ +
+ + Country + + {{country.label}} + + + +
+
+
+
+
+ + TimeZones + + {{timeZone.label}} + + + +
+
+
+ +
+
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + +
Name {{rowData.name}} Active ? + +
+ +
+
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.scss new file mode 100644 index 00000000..31b56d72 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.scss @@ -0,0 +1,78 @@ +/* + * ============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============================================ + * + * + */ + +table { + width: 100%; +} + +.input-group-first { + position: relative; + display: flex; + /* flex-wrap: wrap; */ + align-items: stretch; + width: 100%; +} + +.form-row { + display: flex; + flex-wrap: wrap; + margin-right: -5px; + margin-left: 20px; +} + +.field-group { + position: relative; + display: block; +} + +body { + font-family: Roboto, Arial, sans-serif; + margin: 0; +} + +.basic-container { + padding: 30px; +} + +.version-info { + font-size: 8pt; + float: right; +} +.assignedRoles{ + margin-left: 10px; +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts new file mode 100644 index 00000000..2e91c188 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts @@ -0,0 +1,63 @@ +/* + * ============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 { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SelfComponent } from './self.component'; + +describe('SelfComponent', () => { + let component: SelfComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SelfComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SelfComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts new file mode 100644 index 00000000..23a2bb07 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts @@ -0,0 +1,306 @@ +/* + * ============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 { Component, OnInit } from '@angular/core'; +import { UserService } from 'src/app/shared/services/user/user.service'; +import { User } from 'src/app/shared/services/user/user'; +import { ProfileService } from '../profile.service'; +import { MatTableDataSource } from '@angular/material'; +import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; +import { ErrorModalComponent } from 'src/app/modals/error-modal/error-modal.component'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; + +@Component({ + selector: 'app-self', + templateUrl: './self.component.html', + styleUrls: ['./self.component.scss'] +}) +export class SelfComponent implements OnInit { + + constructor(public userService: UserService, public profileService: ProfileService, private ngModal: NgbModal) { } + + user: User; + isAppCentralized; + response; + result; + postData: { + profile: any, + selectedCountry: any, + selectedState: any, + selectedTimeZone: any + } = { profile: "", selectedCountry: "", selectedState: "", selectedTimeZone: "" }; + + profile: { + lastName: any, firstName: any, orgUserId: any, orgManagerUserId: any, loginId: any,loginPwd: any,phone: any,fax: any,cellular: any, + email: any;address1: any,address2: any,city: any,state :any,zipCode: any,country: any,timeZoneId: any,id: any,roles: any + } = { + lastName: "", firstName: "", orgUserId: "", orgManagerUserId: "", loginId: "",loginPwd: "",phone: "",fax: "", + cellular: "", email: "",address1: "",address2: "",city: "",state:"" ,zipCode: "",country: "",timeZoneId: "",id: "",roles: "" + }; + + oriProfile; + profileId; + ociavailableRoles; + ociTimeZones; + ociCountries; + stateList; + isUserSystemAdmin; + availableRoles: Array = []; + dataSource: MatTableDataSource; + showSpinner:boolean; + + userRolesHeader = ["name", "active"]; + closeResult: string; + selectedCountry; + selectedState; + selectedTimeZone; + finalSelectedRoles: any; + + + ngOnInit() { + this.showSpinner = false; + this.finalSelectedRoles = []; + let result = this.userService.getFunctionalMenuStaticDetailSession(); + let user; + result.subscribe(user => { + this.user = user; + this.isAppCentralized = this.user.isAppCentralized; + }); + this.getSelfProfileDetail(); + } + + /** + * Get Self Profile Details + */ + getSelfProfileDetail() { + this.showSpinner = true; + this.response = this.profileService.getSelfProfile(); + this.response.subscribe(data => { + let res; + res = data; + this.result = JSON.parse(res.data); + this.profile = JSON.parse(this.result.profile); + this.oriProfile = JSON.parse(this.result.profile); /*original value*/ + + this.profileId = this.profile.id; + this.ociavailableRoles = JSON.parse(this.result.availableRoles); + this.ociTimeZones = JSON.parse(this.result.timeZones); + this.ociCountries = JSON.parse(this.result.countries); + this.stateList = JSON.parse(this.result.stateList); + + for( let state of this.stateList) + { + if(state.value == this.profile.state){ + this.profile.state= state.value; + } + } + + for( let country of this.ociCountries) + { + if(country.value == this.profile.country){ + this.profile.country= country.value; + } + } + + for( let timeZone of this.ociTimeZones) + { + if(timeZone.value == this.profile.timeZoneId){ + this.profile.timeZoneId= timeZone.value; + } + } + + this.dataSource = new MatTableDataSource(this.ociavailableRoles); + + if (this.ociavailableRoles != null) { + for (let role of this.ociavailableRoles) { + role.selected = false; + for (let profileRole of this.profile.roles) { + if (profileRole.id === role.id) { + role.selected = true; + } + if (role.id === 1) { + this.isUserSystemAdmin = true; + } + } + this.availableRoles.push(role); + } + } + + }); + this.showSpinner = false; + } + + /** + * Remove Role + * @param role + */ + removeRole(role: any) { + const modalRef = this.ngModal.open(InformationModalComponent); + modalRef.componentInstance.title = 'Confirmation'; + modalRef.componentInstance.message = `Are you sure you want to remove ${role.name} ?`; + modalRef.result.then((result) => { + if (result === 'Ok') { + this.profileService.removeRole(role, this.profileId).subscribe(data => { + this.getSelfProfileDetail(); + }) + } + }, (reason) => { + this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; + }); + } + + /** + * Add User Role + * @param role + */ + addUserRole(role: any) { + const modalRef = this.ngModal.open(InformationModalComponent); + modalRef.componentInstance.title = 'Confirmation'; + modalRef.componentInstance.message = `Are you sure you want to add ${role.name} ?`; + modalRef.result.then((result) => { + if (result === 'Ok') { + this.profileService.addUserRole(role, this.profileId).subscribe(data => { + this.getSelfProfileDetail(); + }) + } + }, (reason) => { + this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; + }); + } + + private getDismissReason(reason: any): string { + if (reason === ModalDismissReasons.ESC) { + return 'by pressing ESC'; + } else if (reason === ModalDismissReasons.BACKDROP_CLICK) { + return 'by clicking on a backdrop'; + } else { + return `with: ${reason}`; + } + + } + + /** + * Save User Profile + */ + saveProfile() { + + if (this.oriProfile.loginId != this.profile.loginId) { + const modalRef = this.ngModal.open(ErrorModalComponent); + modalRef.componentInstance.message = `Login ID cannot be changed?`; + return; + } + if (this.oriProfile.loginPwd != this.profile.loginPwd) { + const modalRef = this.ngModal.open(ErrorModalComponent); + modalRef.componentInstance.message = `Login pwd cannot be changed?`; + return; + } + + this.postData.profile = this.profile; + this.postData.selectedCountry = this.profile.country != null ? this.profile.country : ""; + this.postData.selectedState = this.profile.state != null ? this.profile.state : ""; + this.postData.selectedTimeZone = this.profile.timeZoneId != null ? this.profile.timeZoneId : ""; + + + for( let state of this.stateList) + { + if(state.value == this.profile.state){ + this.postData.selectedState = state.value; + } + } + + for( let country of this.ociCountries) + { + if(country.value == this.profile.country){ + this.postData.selectedCountry = country.value; + } + } + for( let timeZone of this.ociTimeZones) + { + if(timeZone.value == this.profile.timeZoneId){ + this.postData.selectedTimeZone = timeZone.value; + } + } + + + this.response = this.profileService.saveProfile(this.postData, this.profileId); + this.response.subscribe(data => { + const modalRef = this.ngModal.open(ConfirmationModalComponent); + let response; + modalRef.componentInstance.message = `Profile got saved Successfully`; + modalRef.result.then((result) => { + if (result === 'Close') { + this.getSelfProfileDetail(); + } + }, (reason) => { + this.closeResult = `Dismissed ${this.getDismissReason(reason)}`; + }); + + }); + } + + /** + * toggleRoles + * @param _element + */ + toggleRoles(_element) { + if (this.ociavailableRoles) { + for (var i = 0; i < this.ociavailableRoles.length; i++) { + var availableRole = this.ociavailableRoles[i]; + if (availableRole.selected && !this.finalSelectedRoles.includes(availableRole)) { + this.finalSelectedRoles.push(availableRole); + } + } + } + + if (!_element.selected) { + for (var i = 0; i < this.finalSelectedRoles.length; i++) { + var availableRole = this.finalSelectedRoles[i]; + if (availableRole.id == _element.id + && availableRole.name == _element.name) { + this.finalSelectedRoles.splice(i, 1); + } + } + } + if(_element.selected){ + this.addUserRole(_element); + }else{ + this.removeRole(_element); + } + } +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts new file mode 100644 index 00000000..5a5a41a8 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal-SDK + * =================================================================== + * 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 { + HttpEvent, + HttpInterceptor, + HttpHandler, + HttpRequest, + HttpHeaders, +} from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { v4 as uuid } from 'uuid'; +declare const getWebJunctionXSRFToken: any; +export class HeaderInterceptor implements HttpInterceptor { + intercept(req: HttpRequest, next: HttpHandler): Observable> { + // Clone the request to add the new header + // HttpHeader object immutable - copy values + var XSRFToken = getWebJunctionXSRFToken(); + console.log('XSRFToken:', XSRFToken); + const headerSettings: { [name: string]: string | string[]; } = {}; + headerSettings['X-ECOMP-RequestID'] = uuid(); + const requestType = req.params.get('requestType'); + if (XSRFToken.name && XSRFToken.value) + headerSettings['X-XSRF-TOKEN'] = XSRFToken.value; + if(requestType!=null && requestType==='fileUpload'){ + //headerSettings['Content-Type'] = 'multipart/form-data'; + }else{ + headerSettings['Content-Type'] = 'application/json'; + } + const newHeader = new HttpHeaders(headerSettings); + const clonedRequest = req.clone({ headers: newHeader, withCredentials: true }); + // Pass the cloned request instead of the original request to the next handle + return next.handle(clonedRequest); + } +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/utils/utils.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/utils/utils.js new file mode 100644 index 00000000..3fe1c1ce --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/utils/utils.js @@ -0,0 +1,43 @@ + +function getWebJunctionXSRFToken() { + var cookies = getCookies(); + var XSRFToken = { + name:'', + value:'' + }; + var contextRoot = getContextRoot(); + var hasXSRFToken = false; + for(var name in cookies) { + if(name.includes('XSRF-TOKEN')){ + if(name.includes('AMWEBJCT') && name.includes(contextRoot)){ + XSRFToken.name = name; + XSRFToken.value = cookies[name]; + }else if(name=='XSRF-TOKEN'){ + hasXSRFToken = true; + } + } + } + return (hasXSRFToken==true)?null:XSRFToken; +} + +function getCookies() { + var cookies = { }; + if (document.cookie && document.cookie != '') { + var split = document.cookie.split(';'); + for (var i = 0; i < split.length; i++) { + var name_value = split[i].split("="); + name_value[0] = name_value[0].replace(/^ /, ''); + cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]); + } + } + return cookies; +} + +function getContextRoot(){ + var pathName = window.location.pathname; + var pathArray = pathName.split( '/' ); + var contextRoot=''; + if(pathArray.length!=0 && pathArray.length>=1) + contextRoot = pathArray[1]; + return contextRoot; +} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/assets/images/spinner.gif b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/assets/images/spinner.gif new file mode 100644 index 00000000..c97ec6ea Binary files /dev/null and b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/assets/images/spinner.gif differ diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/styles/_spinner.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/styles/_spinner.scss new file mode 100644 index 00000000..406ca78a --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/styles/_spinner.scss @@ -0,0 +1,67 @@ +/*- + * ============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============================================ + * + * + */ +.ecomp-spinner { + background: url('../assets/images/spinner.gif') top left no-repeat; + width: 32px; + height: 32px; + position: absolute; + top: 35%; + left: calc(50% - 32px/2); +} +.ecomp-save-spinner { + background: url('../assets/images/spinner.gif') top left no-repeat; + width: 25px; + height: 25px; + background-size: 25px; + position: absolute; + left: -50px; + top: 2px; +} +.ecomp-small-spinner { + background: url('../assets/images/spinner.gif') top left no-repeat; + width: 25px; + height: 25px; + background-size: 25px; + position: relative; + display: inline-block; + vertical-align: 2px; + cursor: pointer; + top: 6px; + color: transparent; + margin-left: 8px; +} -- cgit 1.2.3-korg