0ca05b4c7249843ea5ee8dfae4f99a88135a15d5
[portal/sdk.git] /
1 import {Component, OnInit, Input, Output, EventEmitter, OnDestroy} from '@angular/core';
2 import {HttpClient, HttpHeaders} from '@angular/common/http';
3 import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
4 import {DefinitionSaveDialogComponent} from './definition-save-dialog/definition-save-dialog.component';
5 import {ActivatedRoute, Router} from '@angular/router';
6 import {environment} from '../../../../../../environments/environment';
7 import {DefinitionService} from './definition.service';
8 import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop';
9 import {isInteger, toInteger} from '@ng-bootstrap/ng-bootstrap/util/util';
10
11 @Component({
12     selector: 'app-definition',
13     templateUrl: './definition.component.html',
14     styleUrls: ['./definition.component.css'],
15     providers: [NgbModal]
16 })
17 export class DefinitionComponent implements OnInit, OnDestroy {
18     showSpinner: boolean;
19     @Input() closable = true;
20     @Input('reportId') reportId1: string;
21     @Input('reportMode') reportMode: string;
22     @Output() outputReportType = new EventEmitter<any>();
23     finalPostObj = {};
24     finalGetObj = {};
25     isEdit: boolean;
26     reportId: number;
27     reportName: string;
28     reportDescription: string;
29     reportType: string;
30     dataSrc: string;
31     helpText: string;
32     reportDefinition: string;
33     pageSize: number;
34     hideFormFields: boolean;
35     maxRows: number;
36     colsFrozen: number;
37     gridAlign: string;
38     emptyMessage: string;
39     heightContainer: number;
40     widthContainer: number;
41     allowScheduler: boolean;
42     sizedByContent: boolean;
43     hideFormFields1: boolean;
44     hideChart: boolean;
45     hideReportData: boolean;
46     hideExcel: boolean;
47     hidePDF: boolean;
48     disableColumnSort: boolean;
49     runTimeFormNum: number;
50     reportTitle: string;
51     reportSubTitle: string;
52     oneTime: boolean;
53     hourly: boolean;
54     daily: boolean;
55     MonFri: boolean;
56     Weekly: boolean;
57     Monthly: boolean;
58     oneTime1: boolean;
59     hourly1: boolean;
60     daily1: boolean;
61     MonFri1: boolean;
62     Weekly1: boolean;
63     Monthly1: boolean;
64     displayArea: string;
65     definitionPostResponse1: any;
66     definitionPostResponse: any;
67     showDialog: boolean;
68     status: string;
69     message: string;
70     dashboardObj: any;
71     dashboardLayoutHTML: any;
72     pilotModalComponent: DefinitionSaveDialogComponent;
73     IncomingReportId: number;
74     displayOptionsArr: {}[] = [];
75
76     constructor(private _http: HttpClient, private _route: ActivatedRoute, private _definitionService: DefinitionService, private _router: Router) {
77         this.showSpinner = true;
78         this.IncomingReportId = -1;
79         this.dashboardObj = [];
80         this.dashboardLayoutHTML = '';
81         this.displayOptionsArr = [];
82     }
83
84     ngOnDestroy(): void {
85         if (this.reportMode == 'Copy') {
86             this.clearSession();
87         }
88     }
89
90     ngOnInit() {
91         sessionStorage.clear();
92         const myItem = localStorage.getItem('notes');
93         localStorage.clear();
94         localStorage.setItem('notes', myItem);
95         this.isEdit = true;
96         this.showDialog = false;
97         this.showSpinner = true;
98         this._route.params.subscribe(params => {
99             if (params['reportId'] !== undefined) {
100                 this.IncomingReportId = params['reportId'];
101                 this.reportId1 = params['reportId'];
102             }
103         });
104         if (this.IncomingReportId == -1 && this.reportMode == 'Create') {
105             this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode)
106                 .subscribe((response) => {
107                     this.finalGetObj = response;
108                     this.reportId = response['reportId'];
109                     this.reportName = response['reportName'];
110                     this.reportDescription = response['reportDescr'];
111                     this.reportType = response['reportType'];
112                     this.dataSrc = response['dbInfo'];
113                     this.helpText = response['formHelpText'];
114                     this.reportDefinition = response['repDefType'];
115                     this.pageSize = response['pageSize'];
116                     this.hideFormFields1 = response['hideFormFieldsAfterRun'];
117                     this.maxRows = response['maxRowsInExcelCSVDownload'];
118                     this.colsFrozen = response['frozenColumns'];
119                     this.gridAlign = response['dataGridAlign'];
120                     this.emptyMessage = response['emptyMessage'];
121                     if (response['dashboardLayoutJSON']) {
122                         this.dashboardObj = JSON.parse(response['dashboardLayoutJSON']);
123                         this.dashboardLayoutHTML = response['dashboardLayoutHTML'];
124                     }
125                     if (response['displayArea']) {
126                         for (let i = 0; i < response["displayArea"].length; i++) {
127                             if (response['displayArea'][i]['selected'] === true) {
128                                 this.displayArea = response['displayArea'][i]['name'];
129                             }
130                         }
131                     }
132                     this.heightContainer = response['dataContainerHeight'];
133                     this.widthContainer = response['dataContainerWidth'];
134                     this.allowScheduler = (response['allowScheduler'] == 'Y' ? true : false);
135                     this.sizedByContent = (response['sizedByContent'] == 'Y' ? true : false);
136                     this.displayOptionsArr = response['displayOptions'];
137                     if (this.displayOptionsArr !== null) {
138                         if (this.displayOptionsArr.length > 0) {
139                             for (let cont of this.displayOptionsArr) {
140                                 if (cont['name'] == 'HideFormFields') {
141                                     this.hideFormFields = cont['selected'];
142                                 }
143                                 if (cont['name'] == 'HideChart') {
144                                     this.hideChart = cont['selected'];
145                                 }
146                                 if (cont['name'] == 'HideReportData') {
147                                     this.hideReportData = cont['selected'];
148                                 }
149                                 if (cont['name'] == 'HideExcel') {
150                                     this.hideExcel = cont['selected'];
151                                 }
152                                 if (cont['name'] == 'HidePdf') {
153                                     this.hidePDF = cont['selected'];
154                                 }
155                             }
156                         }
157                     }
158                     this.disableColumnSort = response['runtimeColSortDisabled'];
159                     this.runTimeFormNum = response['numFormCols'];
160                     this.reportTitle = response['reportTitle'];
161                     this.reportSubTitle = response['reportSubTitle'];
162                     this.oneTime = (response['oneTimeRec'] == 'Y' ? true : false);
163                     this.hourly = (response['hourlyRec'] == 'Y' ? true : false);
164                     this.daily = (response['dailyRec'] == 'Y' ? true : false);
165                     this.MonFri = (response['dailyMFRec'] == 'Y' ? true : false);
166                     this.Weekly = (response['weeklyRec'] == 'Y' ? true : false);
167                     this.Monthly = (response['monthlyRec'] == 'Y' ? true : false);
168                     this.showSpinner = false;
169                 });
170         }
171         if ((this.IncomingReportId !== -1 && this.reportMode == 'Edit')) {
172             this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode)
173                 .subscribe((response) => {
174                     this.finalGetObj = response;
175                     this.reportId = response['reportId'];
176                     this.reportName = response['reportName'];
177                     this.reportDescription = response['reportDescr'];
178                     this.reportType = response['reportType'];
179                     if (this.reportMode == 'Copy') {
180                         this.finalPostObj['reportId'] = -1;
181                         this.IncomingReportId = -1;
182                         this.reportId = -1;
183                     }
184                     if (this.reportType === 'Linear') {
185                         this.dataSrc = response['dbInfo'];
186                         this.helpText = response['formHelpText'];
187                         this.reportDefinition = response['repDefType'];
188                         this.pageSize = response['pageSize'];
189                         this.hideFormFields1 = response['hideFormFieldsAfterRun'];
190                         this.maxRows = response['maxRowsInExcelCSVDownload'];
191                         this.colsFrozen = response['frozenColumns'];
192                         this.gridAlign = response['dataGridAlign'];
193                         this.emptyMessage = response['emptyMessage'];
194                         if (response['displayArea']) {
195                             for (let i = 0; i < response["displayArea"].length; i++) {
196                                 if (response['displayArea'][i]['selected'] === true) {
197                                     this.displayArea = response['displayArea'][i]['name'];
198                                 }
199                             }
200                         }
201                         this.heightContainer = response['dataContainerHeight'];
202                         this.widthContainer = response['dataContainerWidth'];
203                         this.allowScheduler = (response['allowScheduler'] == 'Y' ? true : false);
204                         this.sizedByContent = (response['sizedByContent'] == 'Y' ? true : false);
205                         this.displayOptionsArr = response['displayOptions'];
206                         for (let cont of this.displayOptionsArr) {
207                             if (cont['name'] == 'HideFormFields') {
208                                 this.hideFormFields = cont['selected'];
209                             }
210                             if (cont['name'] == 'HideChart') {
211                                 this.hideChart = cont['selected'];
212                             }
213                             if (cont['name'] == 'HideReportData') {
214                                 this.hideReportData = cont['selected'];
215                             }
216                             if (cont['name'] == 'HideExcel') {
217                                 this.hideExcel = cont['selected'];
218                             }
219                             if (cont['name'] == 'HidePdf') {
220                                 this.hidePDF = cont['selected'];
221                             }
222                         }
223                         this.disableColumnSort = response['runtimeColSortDisabled'];
224                         this.runTimeFormNum = response['numFormCols'];
225
226                         this.reportTitle = response['reportTitle'];
227                         this.reportSubTitle = response['reportSubTitle'];
228                         this.oneTime = (response['oneTimeRec'] == 'Y' ? true : false);
229                         this.hourly = (response['hourlyRec'] == 'Y' ? true : false);
230                         this.daily = (response['dailyRec'] == 'Y' ? true : false);
231                         this.MonFri = (response['dailyMFRec'] == 'Y' ? true : false);
232                         this.Weekly = (response['weeklyRec'] == 'Y' ? true : false);
233                         this.Monthly = (response['monthlyRec'] == 'Y' ? true : false);
234                     } else {
235                         if (response['dashboardLayoutJSON']) {
236                             this.dashboardObj = JSON.parse(response['dashboardLayoutJSON']);
237                         }
238                         if (response['dashboardLayoutHTML']) {
239                             this.dashboardLayoutHTML = response['dashboardLayoutHTML'];
240                         }
241                     }
242                     this.showSpinner = false;
243                 });
244         }
245         if (this.reportMode == 'Copy') {
246             this._definitionService.copyReportById(this.IncomingReportId)
247                 .subscribe((response) => {
248                     this._definitionService.getDefinitionPageDetails(this.IncomingReportId, this.reportMode)
249                         .subscribe((response) => {
250                             this.finalGetObj = response;
251                             this.reportId = -1;
252                             this.reportName = response['reportName'];
253                             this.reportDescription = response['reportDescr'];
254                             this.reportType = response['reportType'];
255                             if (this.reportType === 'Linear') {
256                                 this.dataSrc = response['dbInfo'];
257                                 this.helpText = response['formHelpText'];
258                                 this.reportDefinition = response['repDefType'];
259                                 this.pageSize = response['pageSize'];
260                                 this.hideFormFields1 = response['hideFormFieldsAfterRun'];
261                                 this.maxRows = response['maxRowsInExcelCSVDownload'];
262                                 this.colsFrozen = response['frozenColumns'];
263                                 this.gridAlign = response['dataGridAlign'];
264                                 this.emptyMessage = response['emptyMessage'];
265                                 if (response['displayArea']) {
266                                     for (let i = 0; i < response["displayArea"].length; i++) {
267                                         if (response['displayArea'][i]['selected'] === true) {
268                                             this.displayArea = response['displayArea'][i]['name'];
269                                         }
270                                     }
271                                 }
272                                 this.heightContainer = response['dataContainerHeight'];
273                                 this.widthContainer = response['dataContainerWidth'];
274                                 this.allowScheduler = (response['allowScheduler'] == 'Y' ? true : false);
275                                 this.sizedByContent = (response['sizedByContent'] == 'Y' ? true : false);
276                                 this.displayOptionsArr = response['displayOptions'];
277                                 for (let cont of this.displayOptionsArr) {
278                                     if (cont['name'] == 'HideFormFields') {
279                                         this.hideFormFields = cont['selected'];
280                                     }
281                                     if (cont['name'] == 'HideChart') {
282                                         this.hideChart = cont['selected'];
283                                     }
284                                     if (cont['name'] == 'HideReportData') {
285                                         this.hideReportData = cont['selected'];
286                                     }
287                                     if (cont['name'] == 'HideExcel') {
288                                         this.hideExcel = cont['selected'];
289                                     }
290                                     if (cont['name'] == 'HidePdf') {
291                                         this.hidePDF = cont['selected'];
292                                     }
293                                 }
294                                 this.disableColumnSort = response['runtimeColSortDisabled'];
295                                 this.runTimeFormNum = response['numFormCols'];
296
297                                 this.reportTitle = response['reportTitle'];
298                                 this.reportSubTitle = response['reportSubTitle'];
299                                 this.oneTime = (response['oneTimeRec'] == 'Y' ? true : false);
300                                 this.hourly = (response['hourlyRec'] == 'Y' ? true : false);
301                                 this.daily = (response['dailyRec'] == 'Y' ? true : false);
302                                 this.MonFri = (response['dailyMFRec'] == 'Y' ? true : false);
303                                 this.Weekly = (response['weeklyRec'] == 'Y' ? true : false);
304                                 this.Monthly = (response['monthlyRec'] == 'Y' ? true : false);
305                             } else {
306                                 if (response['dashboardLayoutJSON']) {
307                                     this.dashboardObj = JSON.parse(response['dashboardLayoutJSON']);
308                                 }
309                                 if (response['dashboardLayoutHTML']) {
310                                     this.dashboardLayoutHTML = response['dashboardLayoutHTML'];
311                                 }
312                             }
313                             this.showSpinner = false;
314                         });
315                     this.showSpinner = false;
316                 });
317         }
318     }
319
320
321     saveDefinitionInfo() {
322         if ((this.IncomingReportId == -1 && this.reportMode == 'Create')) {
323             this.finalPostObj['tabName'] = 'Definition';
324             this.finalPostObj['tabId'] = 'Def';
325             this.finalPostObj['reportId'] = this.reportId;
326             this.finalPostObj['reportName'] = this.reportName;
327             this.finalPostObj['reportDescr'] = this.reportDescription;
328             this.finalPostObj['reportType'] = this.reportType;
329             this.finalPostObj['reportTypeList'] = null;
330             this.finalPostObj['dbInfo'] = this.dataSrc;
331             this.finalPostObj['formHelpText'] = this.helpText;
332             this.finalPostObj['pageSize'] = this.pageSize;
333             this.finalPostObj['dbInfoList'] = [
334                 {
335                     'id': 'local',
336                     'name': 'local',
337                     'selected': false
338                 }
339             ];
340             this.finalPostObj['displayArea'] = [
341                 {
342                     'id': 'HOME',
343                     'name': 'HOME',
344                     'selected': (this.displayArea == 'HOME' ? true : false)
345                 },
346                 {
347                     'id': 'CUSTOMER',
348                     'name': 'CUSTOMER',
349                     'selected': (this.displayArea == 'CUSTOMER' ? true : false)
350                 },
351                 {
352                     'id': 'REPORTS',
353                     'name': 'REPORTS',
354                     'selected': (this.displayArea == 'REPORTS' ? true : false)
355                 }
356             ];
357             this.finalPostObj['hideFormFieldsAfterRun'] = this.hideFormFields1;
358             this.finalPostObj['maxRowsInExcelCSVDownload'] = this.maxRows;
359             this.finalPostObj['frozenColumns'] = this.colsFrozen;
360             this.finalPostObj['dataGridAlign'] = this.gridAlign;
361             this.finalPostObj['emptyMessage'] = this.emptyMessage;
362             this.finalPostObj['dataContainerHeight'] = this.heightContainer;
363             this.finalPostObj['dataContainerWidth'] = this.widthContainer;
364             this.finalPostObj['displayOptions'] = [
365                 {
366                     'name': 'HideFormFields',
367                     'selected': (this.hideFormFields == undefined ? false : this.hideFormFields)
368                 },
369                 {
370                     'name': 'HideChart',
371                     'selected': (this.hideChart == undefined ? false : this.hideChart)
372                 },
373                 {
374                     'name': 'HideReportData',
375                     'selected': (this.hideReportData == undefined ? false : this.hideReportData)
376                 },
377                 {
378                     'name': 'HideExcel',
379                     'selected': (this.hideExcel == undefined ? false : this.hideExcel)
380                 },
381                 {
382                     'name': 'HidePdf',
383                     'selected': (this.hidePDF == undefined ? false : this.hidePDF)
384                 }
385             ];
386             this.finalPostObj['runtimeColSortDisabled'] = this.disableColumnSort;
387             this.finalPostObj['numFormCols'] = this.runTimeFormNum;
388             if (undefined != this.reportTitle && this.reportTitle.length > 0) {
389                 this.finalPostObj['reportTitle'] = this.reportTitle;
390             } else {
391                 this.finalPostObj['reportTitle'] = this.reportName;
392             }
393             this.finalPostObj['reportSubTitle'] = this.reportSubTitle;
394             this.finalPostObj['oneTimeRec'] = this.oneTime;
395             this.finalPostObj['hourlyRec'] = this.hourly;
396             this.finalPostObj['dailyRec'] = this.daily;
397             this.finalPostObj['dailyMFRec'] = this.MonFri;
398             this.finalPostObj['weeklyRec'] = this.Weekly;
399             this.finalPostObj['monthlyRec'] = this.Monthly;
400             this.finalPostObj['allowScheduler'] = (this.allowScheduler == true ? 'Y' : 'N');
401             this.finalPostObj['sizedByContent'] = (this.sizedByContent == true ? 'Y' : 'N');
402             this.finalPostObj['repDefType'] = this.reportDefinition;
403             if (this.reportType === 'Dashboard') {
404                 this.dashboardObj = this.dashboardObj.sort(function (a, b) {
405                     if (a['x'] === b['x']) {
406                         return a['y'] - b['y'];
407                     } else {
408                         return a['x'] - b['x'];
409                     }
410                 });
411                 this.finalPostObj['dashboardLayoutJSON'] = JSON.stringify(this.dashboardObj);
412                 this.finalPostObj['dashboardLayoutHTML'] = this.dashboardLayoutHTML;
413             }
414             this._http.post(environment.baseUrl + 'report/wizard/save_def_tab_data/Create', this.finalPostObj, {headers: new HttpHeaders({'Content-Type': 'application/json'})})
415                 .subscribe((response) => {
416                     if (response['message'] === 'Success Definition of given report is saved in session.') {
417                         this.status = 'Success!';
418                         this.message = 'Your change has been saved! Definition is updated.';
419                         if (this.reportType == 'Dashboard') {
420                             let stackTrace = '';
421                             stackTrace = response['anyStacktrace'];
422                             stackTrace = stackTrace.substring(0, stackTrace.indexOf('-'));
423                             this.reportId = parseInt(stackTrace);
424                             this._router.navigate(['v2/app/reports', 'Edit', this.reportId]);
425                         }
426                         this.showDialog = !this.showDialog;
427                         this.closable = true;
428                     } else {
429                         this.status = 'Failure!';
430                         this.message = 'Definition could not be updated.';
431                         this.showDialog = !this.showDialog;
432                         this.closable = true;
433                     }
434                 });
435         }
436         if ((this.IncomingReportId !== -1 && this.reportMode == 'Edit') || this.reportMode == 'Copy') {
437             this.finalPostObj['tabName'] = 'Definition';
438             this.finalPostObj['tabId'] = 'Def';
439             this.finalPostObj['reportId'] = this.reportId;
440             this.finalPostObj['reportName'] = this.reportName;
441             this.finalPostObj['reportDescr'] = this.reportDescription;
442             this.finalPostObj['reportType'] = this.reportType;
443             if (this.reportMode == 'Copy') {
444                 this.finalPostObj['reportId'] = -1;
445                 this.IncomingReportId = -1;
446             }
447             if (this.reportType === 'Dashboard') {
448                 this.dashboardObj = this.dashboardObj.sort(function (a, b) {
449                     if (a['x'] === b['x']) {
450                         return a['y'] - b['y'];
451                     } else {
452                         return a['x'] - b['x'];
453                     }
454                 });
455                 this.finalPostObj['dashboardLayoutJSON'] = JSON.stringify(this.dashboardObj);
456                 this.finalPostObj['dashboardLayoutHTML'] = this.dashboardLayoutHTML;
457             } else {
458                 this.finalPostObj['reportTypeList'] = null;
459                 this.finalPostObj['dbInfo'] = this.dataSrc;
460                 this.finalPostObj['formHelpText'] = this.helpText;
461                 this.finalPostObj['pageSize'] = this.pageSize;
462                 this.finalPostObj['dbInfoList'] = [
463                     {
464                         'id': 'local',
465                         'name': 'local',
466                         'selected': false
467                     }
468                 ];
469                 this.finalPostObj['displayArea'] = [
470                     {
471                         'id': 'HOME',
472                         'name': 'HOME',
473                         'selected': (this.displayArea == 'HOME' ? true : false)
474                     },
475                     {
476                         'id': 'CUSTOMER',
477                         'name': 'CUSTOMER',
478                         'selected': (this.displayArea == 'CUSTOMER' ? true : false)
479                     },
480                     {
481                         'id': 'REPORTS',
482                         'name': 'REPORTS',
483                         'selected': (this.displayArea == 'REPORTS' ? true : false)
484                     }
485                 ];
486                 this.finalPostObj['hideFormFieldsAfterRun'] = this.hideFormFields1;
487                 this.finalPostObj['maxRowsInExcelCSVDownload'] = this.maxRows;
488                 this.finalPostObj['frozenColumns'] = this.colsFrozen;
489                 this.finalPostObj['dataGridAlign'] = this.gridAlign;
490                 this.finalPostObj['emptyMessage'] = this.emptyMessage;
491                 this.finalPostObj['dataContainerHeight'] = this.heightContainer;
492                 this.finalPostObj['dataContainerWidth'] = this.widthContainer;
493                 this.finalPostObj['displayOptions'] = [
494                     {
495                         'name': 'HideFormFields',
496                         'selected': (this.hideFormFields == undefined ? false : this.hideFormFields)
497                     },
498                     {
499                         'name': 'HideChart',
500                         'selected': (this.hideChart == undefined ? false : this.hideChart)
501                     },
502                     {
503                         'name': 'HideReportData',
504                         'selected': (this.hideReportData == undefined ? false : this.hideReportData)
505                     },
506                     {
507                         'name': 'HideExcel',
508                         'selected': (this.hideExcel == undefined ? false : this.hideExcel)
509                     },
510                     {
511                         'name': 'HidePdf',
512                         'selected': (this.hidePDF == undefined ? false : this.hidePDF)
513                     }
514                 ];
515                 this.finalPostObj['runtimeColSortDisabled'] = this.disableColumnSort;
516                 this.finalPostObj['numFormCols'] = this.runTimeFormNum;
517                 if ( this.reportTitle.length > 0) {
518                     this.finalPostObj['reportTitle'] = this.reportTitle;
519                 } else {
520                     this.finalPostObj['reportTitle'] = this.reportName;;
521                 }
522                 this.finalPostObj['reportSubTitle'] = this.reportSubTitle;
523                 this.finalPostObj['oneTimeRec'] = this.oneTime;
524                 this.finalPostObj['hourlyRec'] = this.hourly;
525                 this.finalPostObj['dailyRec'] = this.daily;
526                 this.finalPostObj['dailyMFRec'] = this.MonFri;
527                 this.finalPostObj['weeklyRec'] = this.Weekly;
528                 this.finalPostObj['monthlyRec'] = this.Monthly;
529                 this.finalPostObj['allowScheduler'] = (this.allowScheduler == true ? 'Y' : 'N');
530                 this.finalPostObj['sizedByContent'] = (this.sizedByContent == true ? 'Y' : 'N');
531                 this.finalPostObj['repDefType'] = this.reportDefinition;
532             }
533             this._definitionService.portDefinitionPageDetails(this.IncomingReportId, this.finalPostObj)
534                 .subscribe((response) => {
535                     if (response['message'] === 'Success Definition of given report is saved in session.') {
536                         this.status = 'Success!';
537                         this.message = 'Your change has been saved! Definition is updated.';
538                         if (this.reportMode == 'Copy') {
539                             let stackTrace = '';
540                             stackTrace = response['anyStacktrace'];
541                             stackTrace = stackTrace.substring(0, stackTrace.indexOf('-'));
542                             this.reportId = parseInt(stackTrace);
543                             this._router.navigate(['v2/app/reports', 'Edit', this.reportId]);
544                         }
545                         this.showDialog = !this.showDialog;
546                         this.closable = true;
547                         if (this.reportType == 'Dashboard') {
548
549                         }
550                     } else {
551                         this.status = 'Failure!';
552                         this.message = 'Definition could not be updated.';
553                         this.showDialog = !this.showDialog;
554                         this.closable = true;
555                     }
556                 });
557         }
558     }
559
560     close() {
561         this.showDialog = !this.showDialog;
562         this.closable = false;
563     }
564
565     onTransferDashboardObj(transferredDashboardObj: any) {
566         this.dashboardObj = transferredDashboardObj;
567
568     }
569
570     clearSession() {
571         this._definitionService.clearSession()
572             .subscribe((response) => {
573                 console.log(response);
574                 this._router.navigate(['v2/app/report-list']);
575             });
576
577     }
578
579     getReportType() {
580         let outPutValues = [];
581         outPutValues['reportType'] = this.reportType;
582         this.outputReportType.emit(outPutValues);
583     }
584 }