From f446cfb57f14004d6b34b137f8fa9802f6fdbdf6 Mon Sep 17 00:00:00 2001 From: Sudarshan Kumar Date: Fri, 6 Dec 2019 22:50:16 +0530 Subject: Added portal-FE-common - angular upgrade code Added Layout Component- Footeter, global-search, header, header-menu, search-user, sidebar, tabbar, userbar and also added Account Onbaording changes Issue-ID: PORTAL-795 Change-Id: I815add150ba12c868c1b0f80f3dfcdf4ea804d70 Signed-off-by: Sudarshan Kumar --- .../account-add-details.component.html | 132 +++++++++++++++++ .../account-add-details.component.scss | 77 ++++++++++ .../account-add-details.component.spec.ts | 62 ++++++++ .../account-add-details.component.ts | 159 +++++++++++++++++++++ .../account-onboarding.component.html | 78 ++++++++++ .../account-onboarding.component.scss | 46 ++++++ .../account-onboarding.component.spec.ts | 63 ++++++++ .../account-onboarding.component.ts | 153 ++++++++++++++++++++ 8 files changed, 770 insertions(+) create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.html create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.scss create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.spec.ts create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.ts create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.scss create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.spec.ts create mode 100644 portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.ts (limited to 'portal-FE-common/src/app/pages/account-onboarding') diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.html b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.html new file mode 100644 index 00000000..31f28615 --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.html @@ -0,0 +1,132 @@ + + +
+ + + + + + + +
\ No newline at end of file diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.scss b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.scss new file mode 100644 index 00000000..4a490b1c --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.scss @@ -0,0 +1,77 @@ +/*- + * ============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============================================ + * + * + */ + +.account-properties-main { + padding-left: 20px; + padding-right: 20px; + margin-bottom: 50px; + height: 320px; + width: 100%; + overflow-x: auto; +} + +.required:before { + color: #cf2a2a; + margin-right: 2px; + content: "* "; + position: absolute; + top: 45px; + left: 28px; +} + +.account-properties-main input[type="text"] { + width: 20em; + margin-bottom: 10px; +} + +.account-properties-main input[type="password"] { + width: 20em; + margin-bottom: 10px; +} + +.add-endpoint-item .add-label-right{ + margin-left: 13em; +} + +.add-endpoint-item{ + display: inline-flex; +} + +.account-property{ + margin-top: 8px; +} \ No newline at end of file diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.spec.ts b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.spec.ts new file mode 100644 index 00000000..fd568194 --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.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 { AccountAddDetailsComponent } from './account-add-details.component'; + +describe('AccountAddDetailsComponent', () => { + let component: AccountAddDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AccountAddDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AccountAddDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.ts b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.ts new file mode 100644 index 00000000..e2c408a1 --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-add-details/account-add-details.component.ts @@ -0,0 +1,159 @@ +/*- + * ============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, Output, EventEmitter } from '@angular/core'; +import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { BasicAuthAccountService } from 'src/app/shared/services'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; + +@Component({ + selector: 'app-account-add-details', + templateUrl: './account-add-details.component.html', + styleUrls: ['./account-add-details.component.scss'] +}) +export class AccountAddDetailsComponent implements OnInit { + + result: any; + isEditMode: boolean = false; + dupliateName: boolean = false; + emptyAccountName: boolean = false; + emptyAccountUsername: boolean = false; + passwordMatched: boolean = false; + + @Input() accountOnboarding: any; + @Output() passEntry: EventEmitter = new EventEmitter(); + + constructor(public basicAuthAccountService: BasicAuthAccountService, public activeModal: NgbActiveModal, public ngbModal: NgbModal) { } + + ngOnInit() { + this.passwordMatched = true; + this.dupliateName = false; + this.emptyAccountName = false; + this.emptyAccountUsername = false; + + if(this.accountOnboarding.applicationName){ + this.isEditMode = true; + }else{ + this.isEditMode = false; + this.accountOnboarding.isActive = true; + this.accountOnboarding.endpointList = []; + } + //console.log("IsEditMode in Add account Dialog :: ",this.isEditMode) + + } + + addEndpoint(){ + const modalRef = this.ngbModal.open(ConfirmationModalComponent); + modalRef.componentInstance.title = ""; + modalRef.componentInstance.message = 'Please add the roles to this Username/MechId through AAF Screen'; + modalRef.result.then((result) => { }, (resut) => {return;}); + + /*this.accountOnboarding.endpointList.push({ + valid: true + });*/ + } + + //Add Or Update Account. + saveChanges(){ + var isValid = true; + //console.log("saveChanges called Account Onboarding"); + + if(this.accountOnboarding.applicationName == '' + || this.accountOnboarding.applicationName == undefined){ + this.emptyAccountName = true; + isValid = false; + } + + if(this.accountOnboarding.username == '' + || this.accountOnboarding.username == undefined){ + this.emptyAccountUsername = true; + isValid = false; + } + + if(this.dupliateName == true){ + isValid = false; + } + + if(this.dupliateName == true){ + isValid = false; + } + + if(this.accountOnboarding.password != this.accountOnboarding.repassword){ + this.passwordMatched = false; + isValid = false; + } + //console.log("isValid....",isValid) + if(!isValid) + return; + + var active = 'N'; + if(this.accountOnboarding.isActive == true) + active = 'Y'; + + var newAccount = { + applicationName: this.accountOnboarding.applicationName, + username: this.accountOnboarding.username, + password: this.accountOnboarding.password, + endpoints: this.accountOnboarding.endpoints, + isActive: active + }; + + if(this.isEditMode){ + var message = "Are you sure you want to change '" + this.accountOnboarding.applicationName + "'?" + this.basicAuthAccountService.updateAccount(this.accountOnboarding.id, newAccount) + .subscribe( _data => { + this.result = _data; + //console.log("updateAccount response :: ",this.result); + this.passEntry.emit(this.result); + this.ngbModal.dismissAll(); + }, error => { + console.log(error); + }); + }else{ + this.basicAuthAccountService.createAccount(newAccount) + .subscribe( _data => { + this.result = _data; + //console.log("createAccount response :: ",this.result); + this.passEntry.emit(this.result); + this.ngbModal.dismissAll(); + }, error => { + console.log(error); + }); + } + } +} diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html new file mode 100644 index 00000000..31f631eb --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.html @@ -0,0 +1,78 @@ + + +
+
+

App Account Management

+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
Account Name {{element.applicationName}} + Username {{element.username}} Delete + + + +
+ +
+
diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.scss b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.scss new file mode 100644 index 00000000..05d0cd22 --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.scss @@ -0,0 +1,46 @@ +/*- + * ============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============================================ + * + * + */ + + .container th{ + padding-bottom: 15px; + font-weight: bold; +} + +.ion-md-trash{ + cursor: pointer; +} \ No newline at end of file diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.spec.ts b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.spec.ts new file mode 100644 index 00000000..8e6e79ea --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.spec.ts @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AccountOnboardingComponent } from './account-onboarding.component'; + +describe('AccountOnboardingComponent', () => { + let component: AccountOnboardingComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AccountOnboardingComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AccountOnboardingComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.ts b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.ts new file mode 100644 index 00000000..9ed4f9da --- /dev/null +++ b/portal-FE-common/src/app/pages/account-onboarding/account-onboarding.component.ts @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { Component, OnInit, ViewChild, Input} from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; +import { MatSort, MatPaginator } from '@angular/material'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { BasicAuthAccountService } from '../../shared/services/index'; +import { IAccountOnboarding } from 'src/app/shared/model/account-onboarding/accountOnboarding'; +import { AccountAddDetailsComponent } from './account-add-details/account-add-details.component'; +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-account-onboarding', + templateUrl: './account-onboarding.component.html', + styleUrls: ['./account-onboarding.component.scss'] +}) +export class AccountOnboardingComponent implements OnInit { + + accountList: Array = []; + result: any; + isEditMode: boolean = false; + displayedColumns: string[] = ['accountName', 'userName','delete']; + dataSource = new MatTableDataSource(this.accountList); + @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor(public basicAuthAccountService: BasicAuthAccountService, public ngbModal: NgbModal) { } + + ngOnInit() { + this.getOnboardingAccounts(); + } + + populateTableData(wigetList: Array){ + this.dataSource = new MatTableDataSource(wigetList); + this.dataSource.sort = this.sort; + this.dataSource.paginator = this.paginator; + }; + + getOnboardingAccounts(){ + //console.log("getOnboardingAccounts called"); + this.basicAuthAccountService.getAccountList() + .subscribe(_data => { + this.result = _data; + //console.log("getOnboardingAccounts Data :: ", _data); + if (this.result == null || this.result == 'undefined') { + //console.log('BasicAuthAccountService::getOnboardingAccounts Failed: Result or result.data is null'); + }else { + this.accountList = this.result.response; + this.populateTableData(this.accountList); + } + }, error =>{ + console.log(error); + }); + + }; + + openAddNewAccountModal(rowData: any){ + //console.log("openAddNewAccountModal getting called..."); + const modalRef = this.ngbModal.open(AccountAddDetailsComponent, { size: 'lg' }); + modalRef.componentInstance.title = 'Account Details'; + if(rowData != 'undefined' && rowData){ + rowData.repassword = rowData.password; + modalRef.componentInstance.accountOnboarding = rowData; + this.isEditMode = true; + }else{ + modalRef.componentInstance.accountOnboarding = {}; + this.isEditMode = false; + } + modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { + //console.log("receivedEntry >>> ",receivedEntry); + if(receivedEntry){ + this.accountList = []; + this.getOnboardingAccounts(); + } + }); + } + + deleteAccount(selectedAccount : any){ + let confirmationMsg = 'You are about to delete this account : ' + selectedAccount.applicationName + '. Click OK to continue.'; + this.openInformationModal("Confirmation",confirmationMsg).result.then((result) => { + if (result === 'Ok') { + //console.log("deleteAccount called Account Onboarding"); + if(!selectedAccount || selectedAccount == null || selectedAccount =='undefined'){ + console.log('AccountOnboardingCtrl::deleteAccount: No Account or ID... cannot delete'); + return; + } + //console.log("deleteAccount>>id",selectedAccount.id) + this.basicAuthAccountService.deleteAccount(selectedAccount.id) + .subscribe( _data => { + this.result = _data; + //console.log("deleteAccount response :: ",this.result); + this.accountList.splice(this.accountList.indexOf(selectedAccount), 1); + this.getOnboardingAccounts(); + }, error => { + console.log(error); + }); + } + }, (resut) => { + return; + }) + } + + 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; + } + +} -- cgit 1.2.3-korg