summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts
diff options
context:
space:
mode:
authorAmichai Hemli <ah0398@intl.att.com>2019-07-09 14:23:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-09 14:23:37 +0000
commit58d22b526418ffeb89337fed9e20406da420bc6f (patch)
tree4357c9cfe1c92d57ac0a3f90167cade7af505b95 /vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts
parent302b02a847e7aa8ccf3ff4bc14ff8a9cf67511b0 (diff)
parent97d9f66df456ef4573047a90baa3cc3ee4bfb0b7 (diff)
Merge changes Ib4430bf2,Icc0bdb9e,I2736b984
* changes: Merge from ecomp 718fd196 - Ext. Services Simulator Merge from ecomp 718fd196 - Integration Tests Merge from ecomp 718fd196 - Modern UI
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts')
-rw-r--r--vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts91
1 files changed, 91 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts b/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts
new file mode 100644
index 000000000..211f59337
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/searchMembersModal/search-elements-modal.component.ts
@@ -0,0 +1,91 @@
+import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
+import {DialogComponent, DialogService} from "ng2-bootstrap-modal";
+import {IframeService} from "../../utils/iframe.service";
+import {AaiService} from "../../services/aaiService/aai.service";
+import {VnfGroupModel} from "../../models/vnfGroupModel";
+import {ElementsTableService} from "./members-table/elements-table.service";
+import {Level1Instance} from "../../models/level1Instance";
+import {ModalInformation} from "./members-table/element-table-row.model";
+import {NgRedux} from "@angular-redux/store";
+import {AppState} from "../../store/reducers";
+import {FormGroup} from "@angular/forms";
+import * as _ from "lodash";
+import {clearAllGenericModalhelper} from "../../storeUtil/utils/global/global.actions";
+@Component({
+ selector: 'search-members-modal',
+ templateUrl: 'search-elements-modal.component.html',
+ styleUrls: ['search-elements-modal.component.scss']
+})
+
+export class SearchElementsModalComponent extends DialogComponent<{ modalInformation: ModalInformation }, boolean> implements OnInit, OnDestroy {
+ modalInformation: ModalInformation;
+ parentElementClassName = 'content';
+ elementsData: Level1Instance[];
+ vnfGroupModel: VnfGroupModel;
+ disableSetElements: boolean = true;
+ disableSearchByNetworkRole: boolean = false;
+ dynamicFormGroup: FormGroup = null;
+
+ constructor(dialogService: DialogService,
+ private _iframeService: IframeService,
+ private _aaiService: AaiService,
+ private _membersTableService: ElementsTableService,
+ private _store: NgRedux<AppState>) {
+ super(dialogService);
+ ElementsTableService.changeFnTableDataTrigger.subscribe((triggerRes) => {
+ this._membersTableService.resetAll(this.modalInformation.uniqObjectField, this.modalInformation.maxSelectRow);
+ this.elementsData = triggerRes;
+ });
+
+ ElementsTableService.changeModalInformationDataTrigger.subscribe(({modalInformation, selectedRowsIds}) => {
+ this.disableSetElements = true;
+ this.modalInformation = modalInformation;
+ this.ngOnInit(selectedRowsIds);
+ })
+ }
+
+ @ViewChild('ElementsTableComponent') membersTable;
+
+ ngOnInit(selectedRowsIds?: string[]): void {
+ const genericModalHelper = this._store.getState().global.genericModalHelper;
+ if(!_.isNil(genericModalHelper) && !_.isNil(genericModalHelper[`${this.modalInformation.type}_TABLE_DATA`]) && !_.isNil(genericModalHelper[`selected${this.modalInformation.type}`])){
+ this.elementsData = this._store.getState().global.genericModalHelper[`${this.modalInformation.type}_TABLE_DATA`];
+ } else {
+ this.modalInformation.getElements()
+ .subscribe((result) => {
+ this.elementsData = result;
+ });
+ }
+ };
+
+ closeDialog(): void {
+ this._iframeService.removeFullScreen();
+ this._iframeService.removeClassCloseModal(this.parentElementClassName);
+ this.dialogService.removeDialog(this);
+ setTimeout(() => {
+ window.parent.postMessage("closeIframe", "*");
+ }, 15);
+ }
+
+ selectedMembersAmountChange(selectedMembersAmount: number): void {
+ this.disableSetElements = selectedMembersAmount == 0;
+ }
+
+ doneAction(): void {
+ this.modalInformation.topButton.action.call(this, this);
+ }
+
+ searchByCriteriaAction(): void {
+ this.modalInformation.searchButton.action.call(this, this);
+ }
+
+ backAction(): void {
+ if (this.modalInformation.backAction) {
+ this.modalInformation.backAction.call(this, this);
+ } else {
+ this.closeDialog();
+ }
+ }
+}
+
+