+
+ /** terminate multiple ns instances function @public */
+ public terminate(): void {
+ this.isLoadingResults = true;
+ const modalData: MODALCLOSERESPONSEDATA = {
+ message: 'Done'
+ };
+ const idData: string[] = [];
+ this.params.identifierList.forEach((data: DELETEPARAMS) => {
+ idData.push(data.identifier);
+ });
+ if (idData.length > this.noOfInstances) {
+ this.activeModal.close(modalData);
+ this.notifierService.notify('warning', this.translateService.instant('WARNINGMESSAGE'));
+ } else {
+ const postData: {} = {
+ ns_ids: idData
+ };
+ let deletingURl: string = '';
+ deletingURl = this.deleteURL;
+ this.notifyMessage = 'DELETELOADMESSAGE';
+ const apiURLHeader: APIURLHEADER = {
+ url: deletingURl,
+ httpOptions: { headers: this.headers }
+ };
+ this.restService.postResource(apiURLHeader, postData).subscribe(() => {
+ this.activeModal.close(modalData);
+ this.isLoadingResults = false;
+ this.notifierService.notify('success', this.translateService.instant(this.notifyMessage));
+ }, (error: ERRORDATA) => {
+ this.isLoadingResults = false;
+ this.restService.handleError(error, 'post');
+ }, () => {
+ this.isLoadingResults = false;
+ });
+ }
+ }