diff options
Diffstat (limited to 'ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit')
4 files changed, 163 insertions, 0 deletions
diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html new file mode 100644 index 00000000..8a967121 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.html @@ -0,0 +1,92 @@ +<!-- + ============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============================================ + + --> + + <div class="container"> + <div class="modal-header"> + <h4 class="modal-title">{{modalPopupTitle}}</h4> + <button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross')"> + <span aria-hidden="true">×</span> + </button> + </div> + + <div class="modal-body"> + <!-- This is the modal body where fields has to apper with respect to their field type --> + <div *ngFor="let column of columnsInfoList"> + {{column.dispalyTitle | titlecase}} + <div [ngSwitch]="column.type"> + <div *ngSwitchCase="'text'"> + <rdp-input-editor (changedColumnValue)="columnDataChanged($event, column.title)" + rowdata="{{selectedRowData}}" + columntitle="{{column.title}}" + disabled="{{column.isColumnDisabled}}" + > + </rdp-input-editor> + </div> + <div *ngSwitchCase="'dropdown'"> + <rdp-select-editor (changedColumnValue)="columnDataChanged($event, column.title)" + rowdata="{{selectedRowData}}" + [data]="column.listData" + columntitle="{{column.title}}"></rdp-select-editor> + </div> + <div *ngSwitchCase="'textarea'"> + <rdp-textarea-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-textarea-editor> + </div> + <div *ngSwitchCase="'checkbox'"> + <rdp-checkbox-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-checkbox-editor> + </div> + <div *ngSwitchCase="'radio'"> + <rdp-radio-editor (changedColumnValue)="columnDataChanged($event, column.title)" + [data]="column.listData" + rowdata="{{selectedRowData}}" + columntitle="{{column.title}}"></rdp-radio-editor> + </div> + <div *ngSwitchCase="'datepicker'"> + <rdp-datepicker-editor rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-datepicker-editor> + </div> + <div *ngSwitchDefault> + <rdp-input-editor (changedColumnValue)="columnDataChanged($event, column.title)" + rowdata="{{selectedRowData}}" columntitle="{{column.title}}"></rdp-input-editor> + </div> + </div> + </div> + </div> + + <div class="modal-footer"> + <button type="button" class="btn btn-primary" (click)="saveChanges()">Save</button> + <button type="button" class="btn btn-primary" (click)="activeModal.close('Close')">Cancel</button> + </div> + </div>
\ No newline at end of file diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.scss diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.spec.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.spec.ts new file mode 100644 index 00000000..755e33d9 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RdpDataTableEditComponent } from './rdp-data-table-edit.component'; + +describe('RdpDataTableEditComponent', () => { + let component: RdpDataTableEditComponent; + let fixture: ComponentFixture<RdpDataTableEditComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RdpDataTableEditComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RdpDataTableEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts new file mode 100644 index 00000000..ede8aa25 --- /dev/null +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts @@ -0,0 +1,46 @@ +import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { RdpDataTableService } from '../../shared/rdp-data-table.service'; + +@Component({ + selector: 'rdp-rdp-data-table-edit', + templateUrl: './rdp-data-table-edit.component.html', + styleUrls: ['./rdp-data-table-edit.component.scss'] +}) +export class RdpDataTableEditComponent implements OnInit { + + @Input() settings: any; + @Input() rowdata: any; + @Input() isEditMode: boolean; + @Output() passEntry: EventEmitter<any> = new EventEmitter(); + modalPopupTitle: string; + selectedRowData: any; + public columnsInfoList = []; + + constructor(public activeModal: NgbActiveModal, public rdpDataTableService: RdpDataTableService) { } + + ngOnInit() { + this.modalPopupTitle = "Edit"; + if (this.rowdata) { + this.selectedRowData = JSON.stringify(this.rowdata); + } + if (this.settings) { + if (this.settings.modalPopupTitle) { + this.modalPopupTitle = this.settings.modalPopupTitle; + } + for (var index in this.settings.columns) { + this.columnsInfoList.push(this.settings.columns[index]); + } + } + } + + saveChanges() { + this.passEntry.emit(this.rowdata); + this.activeModal.close(); + } + + columnDataChanged($event, columnTitle) { + this.rowdata[columnTitle] = $event; + } + +} |