summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/searchMembersModal/search-members-modal.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/searchMembersModal/search-members-modal.component.ts')
-rw-r--r--vid-webpack-master/src/app/shared/components/searchMembersModal/search-members-modal.component.ts82
1 files changed, 82 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/components/searchMembersModal/search-members-modal.component.ts b/vid-webpack-master/src/app/shared/components/searchMembersModal/search-members-modal.component.ts
new file mode 100644
index 000000000..9c65d222d
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/searchMembersModal/search-members-modal.component.ts
@@ -0,0 +1,82 @@
+import {Component, 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 {VnfMember} from "../../models/VnfMember";
+import {VnfGroupModel} from "../../models/vnfGroupModel";
+import {MembersTableService} from "./members-table/members-table.service";
+import {VnfGroupInstance} from "../../models/vnfGroupInstance";
+
+
+export interface PopupModel {
+ title: string;
+ serviceModelId : string;
+ searchFields: ISearchField[];
+ description : string;
+ subscriberId: string,
+ serviceType: string,
+ node: VnfGroupInstance,
+ vnfGroupModel: VnfGroupModel;
+
+}
+
+export interface ISearchField {
+ title: string;
+ value: any;
+ dataTestId: string;
+}
+
+@Component({
+ selector : 'search-members-modal',
+ templateUrl : 'search-members-modal.component.html',
+ styleUrls : ['search-members-modal.component.scss']
+})
+
+export class SearchMembersModalComponent extends DialogComponent<PopupModel, boolean> implements OnInit, OnDestroy {
+ title: string;
+ serviceModelId : string;
+ parentElementClassName = 'content';
+ membersData: VnfMember[];
+ description : string;
+ searchFields: ISearchField[];
+ vnfGroupModel: VnfGroupModel;
+ subscriberId: string;
+ serviceType: string;
+ node: VnfGroupInstance;
+ disableSetMembers: boolean = true;
+ constructor(dialogService: DialogService ,
+ private _iframeService : IframeService,
+ private _aaiService : AaiService,
+ private _membersTableService: MembersTableService){
+ super(dialogService);
+
+ }
+ @ViewChild('MembersTableComponent') membersTable;
+
+ ngOnInit() : void{
+ this._aaiService.getOptionalGroupMembers(this.serviceModelId, this.subscriberId, this.serviceType, (Object.values(this.vnfGroupModel.members))[0].sourceModelInvariant, this.vnfGroupModel.properties.type, this.vnfGroupModel.properties.role)
+ .subscribe((result: VnfMember[])=>{
+ this.membersData = this._membersTableService.filterUsedVnfMembers(this.serviceModelId, result);
+ });
+ };
+
+
+ closeDialog() : void{
+ this._iframeService.removeClassCloseModal(this.parentElementClassName);
+ this.dialogService.removeDialog(this);
+ setTimeout(() => {
+ window.parent.postMessage("closeIframe", "*");
+ }, 15);
+ }
+ selectedMembersAmountChange(selectedMembersAmount: number) : void {
+ this.disableSetMembers = selectedMembersAmount==0;
+ }
+
+
+ setMembers() : void {
+ this._membersTableService.setMembers({serviceId : this.serviceModelId, vnfGroupStoreKey : this.node.vnfGroupStoreKey});
+ this.closeDialog();
+ }
+}
+
+